From 924b5673828ee509a160f3489f7941f77fe58889 Mon Sep 17 00:00:00 2001 From: "danno@chromium.org" Date: Mon, 26 Mar 2012 11:35:17 +0000 Subject: [PATCH] Support reverse patching in merge-to-branch.sh R=jkummerow@chromium.org Review URL: https://chromiumcodereview.appspot.com/9839056 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11142 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- tools/common-includes.sh | 2 +- tools/merge-to-branch.sh | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/common-includes.sh b/tools/common-includes.sh index 8f0e78b..c7d5bc2 100644 --- a/tools/common-includes.sh +++ b/tools/common-includes.sh @@ -175,7 +175,7 @@ the uploaded CL." # Takes a file containing the patch to apply as first argument. apply_patch() { - patch -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \ + patch $REVERSE_PATCH -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \ { cat "$PATCH_OUTPUT_FILE" && die "Applying the patch failed."; } tee < "$PATCH_OUTPUT_FILE" >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE") rm "$PATCH_OUTPUT_FILE" diff --git a/tools/merge-to-branch.sh b/tools/merge-to-branch.sh index 49bf3e4..85b64d7 100755 --- a/tools/merge-to-branch.sh +++ b/tools/merge-to-branch.sh @@ -49,6 +49,7 @@ OPTIONS: -h Show this message -s Specify the step where to start work. Default: 0. -p Specify a patch file to apply as part of the merge + -r Reverse specified patches EOF } @@ -68,7 +69,7 @@ restore_patch_commit_hashes_if_unset() { ########## Option parsing -while getopts ":hs:fp:" OPTION ; do +while getopts ":hs:fp:r" OPTION ; do case $OPTION in h) usage exit 0 @@ -77,6 +78,8 @@ while getopts ":hs:fp:" OPTION ; do ;; f) rm -f "$ALREADY_MERGING_SENTINEL_FILE" ;; + r) REVERSE_PATCH="--reverse" + ;; s) START_STEP=$OPTARG ;; ?) echo "Illegal option: -$OPTARG" @@ -134,7 +137,11 @@ revisions associated with the patches." if [ -z "$REVISION_LIST" ] ; then NEW_COMMIT_MSG="Applied patch to $MERGE_TO_BRANCH branch." else - NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch." + if [ -n "$REVERSE_PATCH" ] ; then + NEW_COMMIT_MSG="Rollback of$REVISION_LIST in $MERGE_TO_BRANCH branch." + else + NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch." + fi; fi; echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE -- 2.7.4