Last active
February 19, 2020 17:00
-
-
Save aivils/620f6828f8e4f6f59c65e42d8c0134ca to your computer and use it in GitHub Desktop.
Applies patch created by 'repo diff' command Android Open Source Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Android | |
## Script to patch up diff reated by `repo diff` | |
if [ -z "$1" ] || [ ! -e "$1" ]; then | |
echo "Usages: $0 <repo_diff_file>"; | |
exit 0; | |
fi | |
rm -fr _tmp_splits* | |
cat $1 | csplit -qf '' -b "_tmp_splits.%d.diff" - '/^project.*\/$/' '{*}' | |
working_dir=`pwd` | |
for proj_diff in `ls _tmp_splits.*.diff` | |
do | |
chg_dir=`cat $proj_diff | grep '^project.*\/$' | cut -d " " -f 2` | |
echo "FILE: $proj_diff $chg_dir" | |
if [ -e $chg_dir ]; then | |
( cd $chg_dir; \ | |
cat $working_dir/$proj_diff | grep -v '^project.*\/$' | patch -Np1;); | |
else | |
echo "$0: Project directory $chg_dir don't exists."; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment