Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tools/merge-to-branch.sh

Issue 9839056: Support reverse patching in merge-to-branch.sh (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/common-includes.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright 2012 the V8 project authors. All rights reserved. 2 # Copyright 2012 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 cat << EOF 42 cat << EOF
43 usage: $0 [OPTIONS]... [BRANCH] [REVISION]... 43 usage: $0 [OPTIONS]... [BRANCH] [REVISION]...
44 44
45 Performs the necessary steps to merge revisions from bleeding_edge 45 Performs the necessary steps to merge revisions from bleeding_edge
46 to other branches, including trunk. 46 to other branches, including trunk.
47 47
48 OPTIONS: 48 OPTIONS:
49 -h Show this message 49 -h Show this message
50 -s Specify the step where to start work. Default: 0. 50 -s Specify the step where to start work. Default: 0.
51 -p Specify a patch file to apply as part of the merge 51 -p Specify a patch file to apply as part of the merge
52 -r Reverse specified patches
52 EOF 53 EOF
53 } 54 }
54 55
55 persist_patch_commit_hashes() { 56 persist_patch_commit_hashes() {
56 echo "PATCH_COMMIT_HASHES=( ${PATCH_COMMIT_HASHES[@]} )" > $COMMIT_HASHES_FILE 57 echo "PATCH_COMMIT_HASHES=( ${PATCH_COMMIT_HASHES[@]} )" > $COMMIT_HASHES_FILE
57 } 58 }
58 59
59 restore_patch_commit_hashes() { 60 restore_patch_commit_hashes() {
60 source $COMMIT_HASHES_FILE 61 source $COMMIT_HASHES_FILE
61 } 62 }
62 63
63 restore_patch_commit_hashes_if_unset() { 64 restore_patch_commit_hashes_if_unset() {
64 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && restore_patch_commit_hashes 65 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && restore_patch_commit_hashes
65 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && [[ -z "$EXTRA_PATCH" ]] && \ 66 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && [[ -z "$EXTRA_PATCH" ]] && \
66 die "Variable PATCH_COMMIT_HASHES could not be restored." 67 die "Variable PATCH_COMMIT_HASHES could not be restored."
67 } 68 }
68 69
69 ########## Option parsing 70 ########## Option parsing
70 71
71 while getopts ":hs:fp:" OPTION ; do 72 while getopts ":hs:fp:r" OPTION ; do
72 case $OPTION in 73 case $OPTION in
73 h) usage 74 h) usage
74 exit 0 75 exit 0
75 ;; 76 ;;
76 p) EXTRA_PATCH=$OPTARG 77 p) EXTRA_PATCH=$OPTARG
77 ;; 78 ;;
78 f) rm -f "$ALREADY_MERGING_SENTINEL_FILE" 79 f) rm -f "$ALREADY_MERGING_SENTINEL_FILE"
79 ;; 80 ;;
81 r) REVERSE_PATCH="--reverse"
82 ;;
80 s) START_STEP=$OPTARG 83 s) START_STEP=$OPTARG
81 ;; 84 ;;
82 ?) echo "Illegal option: -$OPTARG" 85 ?) echo "Illegal option: -$OPTARG"
83 usage 86 usage
84 exit 1 87 exit 1
85 ;; 88 ;;
86 esac 89 esac
87 done 90 done
88 let OPTION_COUNT=$OPTIND-1 91 let OPTION_COUNT=$OPTIND-1
89 shift $OPTION_COUNT 92 shift $OPTION_COUNT
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 [[ -n "$NEXT_HASH" ]] \ 130 [[ -n "$NEXT_HASH" ]] \
128 || die "Cannot determine git hash for r$REVISION" 131 || die "Cannot determine git hash for r$REVISION"
129 PATCH_COMMIT_HASHES[$current]="$NEXT_HASH" 132 PATCH_COMMIT_HASHES[$current]="$NEXT_HASH"
130 [[ -n "$REVISION_LIST" ]] && REVISION_LIST="$REVISION_LIST," 133 [[ -n "$REVISION_LIST" ]] && REVISION_LIST="$REVISION_LIST,"
131 REVISION_LIST="$REVISION_LIST r$REVISION" 134 REVISION_LIST="$REVISION_LIST r$REVISION"
132 let current+=1 135 let current+=1
133 done 136 done
134 if [ -z "$REVISION_LIST" ] ; then 137 if [ -z "$REVISION_LIST" ] ; then
135 NEW_COMMIT_MSG="Applied patch to $MERGE_TO_BRANCH branch." 138 NEW_COMMIT_MSG="Applied patch to $MERGE_TO_BRANCH branch."
136 else 139 else
137 NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch." 140 if [ -n "$REVERSE_PATCH" ] ; then
141 NEW_COMMIT_MSG="Rollback of$REVISION_LIST in \
142 $MERGE_TO_BRANCH branch."
143 else
144 NEW_COMMIT_MSG="Merged$REVISION_LIST into \
145 $MERGE_TO_BRANCH branch."
146 fi;
138 fi; 147 fi;
139 148
140 echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE 149 echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE
141 echo "" >> $COMMITMSG_FILE 150 echo "" >> $COMMITMSG_FILE
142 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do 151 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do
143 PATCH_MERGE_DESCRIPTION=$(git log -1 --format=%s $HASH) 152 PATCH_MERGE_DESCRIPTION=$(git log -1 --format=%s $HASH)
144 echo "$PATCH_MERGE_DESCRIPTION" >> $COMMITMSG_FILE 153 echo "$PATCH_MERGE_DESCRIPTION" >> $COMMITMSG_FILE
145 echo "" >> $COMMITMSG_FILE 154 echo "" >> $COMMITMSG_FILE
146 done 155 done
147 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do 156 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 restore_if_unset "TO_URL" 267 restore_if_unset "TO_URL"
259 restore_if_unset "REVISION_LIST" 268 restore_if_unset "REVISION_LIST"
260 restore_version_if_unset "NEW" 269 restore_version_if_unset "NEW"
261 common_cleanup 270 common_cleanup
262 echo "*** SUMMARY ***" 271 echo "*** SUMMARY ***"
263 echo "version: $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" 272 echo "version: $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH"
264 echo "branch: $TO_URL" 273 echo "branch: $TO_URL"
265 echo "svn revision: $SVN_REVISION" 274 echo "svn revision: $SVN_REVISION"
266 [[ -n "$REVISION_LIST" ]] && echo "patches:$REVISION_LIST" 275 [[ -n "$REVISION_LIST" ]] && echo "patches:$REVISION_LIST"
267 fi 276 fi
OLDNEW
« no previous file with comments | « tools/common-includes.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698