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

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

Issue 10538056: Merged r11546 into 3.9 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.9
Patch Set: Created 8 years, 6 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') | tools/presubmit.py » ('j') | 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 -m Specify a commit message for the patch
53 -r Reverse specified patches
52 EOF 54 EOF
53 } 55 }
54 56
55 persist_patch_commit_hashes() { 57 persist_patch_commit_hashes() {
56 echo "PATCH_COMMIT_HASHES=( ${PATCH_COMMIT_HASHES[@]} )" > $COMMIT_HASHES_FILE 58 echo "PATCH_COMMIT_HASHES=( ${PATCH_COMMIT_HASHES[@]} )" > $COMMIT_HASHES_FILE
57 } 59 }
58 60
59 restore_patch_commit_hashes() { 61 restore_patch_commit_hashes() {
60 source $COMMIT_HASHES_FILE 62 source $COMMIT_HASHES_FILE
61 } 63 }
62 64
63 restore_patch_commit_hashes_if_unset() { 65 restore_patch_commit_hashes_if_unset() {
64 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && restore_patch_commit_hashes 66 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && restore_patch_commit_hashes
65 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && [[ -z "$EXTRA_PATCH" ]] && \ 67 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && [[ -z "$EXTRA_PATCH" ]] && \
66 die "Variable PATCH_COMMIT_HASHES could not be restored." 68 die "Variable PATCH_COMMIT_HASHES could not be restored."
67 } 69 }
68 70
69 ########## Option parsing 71 ########## Option parsing
70 72
71 while getopts ":hs:fp:" OPTION ; do 73 while getopts ":hs:fp:rm:" OPTION ; do
72 case $OPTION in 74 case $OPTION in
73 h) usage 75 h) usage
74 exit 0 76 exit 0
75 ;; 77 ;;
76 p) EXTRA_PATCH=$OPTARG 78 p) EXTRA_PATCH=$OPTARG
77 ;; 79 ;;
78 f) rm -f "$ALREADY_MERGING_SENTINEL_FILE" 80 f) rm -f "$ALREADY_MERGING_SENTINEL_FILE"
79 ;; 81 ;;
82 r) REVERSE_PATCH="--reverse"
83 ;;
84 m) NEW_COMMIT_MSG=$OPTARG
85 ;;
80 s) START_STEP=$OPTARG 86 s) START_STEP=$OPTARG
81 ;; 87 ;;
82 ?) echo "Illegal option: -$OPTARG" 88 ?) echo "Illegal option: -$OPTARG"
83 usage 89 usage
84 exit 1 90 exit 1
85 ;; 91 ;;
86 esac 92 esac
87 done 93 done
88 let OPTION_COUNT=$OPTIND-1 94 let OPTION_COUNT=$OPTIND-1
89 shift $OPTION_COUNT 95 shift $OPTION_COUNT
90 96
91 ########## Regular workflow 97 ########## Regular workflow
92 98
93 # If there is a merge in progress, abort. 99 # If there is a merge in progress, abort.
94 [[ -e "$ALREADY_MERGING_SENTINEL_FILE" ]] && [[ $START_STEP -eq 0 ]] \ 100 [[ -e "$ALREADY_MERGING_SENTINEL_FILE" ]] && [[ $START_STEP -eq 0 ]] \
95 && die "A merge is already in progress" 101 && die "A merge is already in progress"
96 touch "$ALREADY_MERGING_SENTINEL_FILE" 102 touch "$ALREADY_MERGING_SENTINEL_FILE"
97 103
98 initial_environment_checks 104 initial_environment_checks
99 105
100 if [ $START_STEP -le $CURRENT_STEP ] ; then 106 if [ $START_STEP -le $CURRENT_STEP ] ; then
101 if [ ${#@} -lt 2 ] && [ -z "$EXTRA_PATCH" ] ; then 107 if [ ${#@} -lt 2 ] ; then
102 die "Either a patch file or revision numbers must be specified" 108 if [ -z "$EXTRA_PATCH" ] ; then
109 die "Either a patch file or revision numbers must be specified"
110 fi
111 if [ -z "$NEW_COMMIT_MSG" ] ; then
112 die "You must specify a merge comment if no patches are specified"
113 fi
103 fi 114 fi
104 echo ">>> Step $CURRENT_STEP: Preparation" 115 echo ">>> Step $CURRENT_STEP: Preparation"
105 MERGE_TO_BRANCH=$1 116 MERGE_TO_BRANCH=$1
106 [[ -n "$MERGE_TO_BRANCH" ]] || die "Please specify a branch to merge to" 117 [[ -n "$MERGE_TO_BRANCH" ]] || die "Please specify a branch to merge to"
107 shift 118 shift
108 persist "MERGE_TO_BRANCH" 119 persist "MERGE_TO_BRANCH"
109 common_prepare 120 common_prepare
110 fi 121 fi
111 122
112 let CURRENT_STEP+=1 123 let CURRENT_STEP+=1
(...skipping 11 matching lines...) Expand all
124 current=0 135 current=0
125 for REVISION in "$@" ; do 136 for REVISION in "$@" ; do
126 NEXT_HASH=$(git svn find-rev "r$REVISION" svn/bleeding_edge) 137 NEXT_HASH=$(git svn find-rev "r$REVISION" svn/bleeding_edge)
127 [[ -n "$NEXT_HASH" ]] \ 138 [[ -n "$NEXT_HASH" ]] \
128 || die "Cannot determine git hash for r$REVISION" 139 || die "Cannot determine git hash for r$REVISION"
129 PATCH_COMMIT_HASHES[$current]="$NEXT_HASH" 140 PATCH_COMMIT_HASHES[$current]="$NEXT_HASH"
130 [[ -n "$REVISION_LIST" ]] && REVISION_LIST="$REVISION_LIST," 141 [[ -n "$REVISION_LIST" ]] && REVISION_LIST="$REVISION_LIST,"
131 REVISION_LIST="$REVISION_LIST r$REVISION" 142 REVISION_LIST="$REVISION_LIST r$REVISION"
132 let current+=1 143 let current+=1
133 done 144 done
134 if [ -z "$REVISION_LIST" ] ; then 145 if [ -n "$REVISION_LIST" ] ; then
135 NEW_COMMIT_MSG="Applied patch to $MERGE_TO_BRANCH branch." 146 if [ -n "$REVERSE_PATCH" ] ; then
136 else 147 NEW_COMMIT_MSG="Rollback of$REVISION_LIST in $MERGE_TO_BRANCH branch."
137 NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch." 148 else
149 NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch."
150 fi;
138 fi; 151 fi;
139 152
140 echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE 153 echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE
141 echo "" >> $COMMITMSG_FILE 154 echo "" >> $COMMITMSG_FILE
142 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do 155 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do
143 PATCH_MERGE_DESCRIPTION=$(git log -1 --format=%s $HASH) 156 PATCH_MERGE_DESCRIPTION=$(git log -1 --format=%s $HASH)
144 echo "$PATCH_MERGE_DESCRIPTION" >> $COMMITMSG_FILE 157 echo "$PATCH_MERGE_DESCRIPTION" >> $COMMITMSG_FILE
145 echo "" >> $COMMITMSG_FILE 158 echo "" >> $COMMITMSG_FILE
146 done 159 done
147 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do 160 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" 271 restore_if_unset "TO_URL"
259 restore_if_unset "REVISION_LIST" 272 restore_if_unset "REVISION_LIST"
260 restore_version_if_unset "NEW" 273 restore_version_if_unset "NEW"
261 common_cleanup 274 common_cleanup
262 echo "*** SUMMARY ***" 275 echo "*** SUMMARY ***"
263 echo "version: $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" 276 echo "version: $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH"
264 echo "branch: $TO_URL" 277 echo "branch: $TO_URL"
265 echo "svn revision: $SVN_REVISION" 278 echo "svn revision: $SVN_REVISION"
266 [[ -n "$REVISION_LIST" ]] && echo "patches:$REVISION_LIST" 279 [[ -n "$REVISION_LIST" ]] && echo "patches:$REVISION_LIST"
267 fi 280 fi
OLDNEW
« no previous file with comments | « tools/common-includes.sh ('k') | tools/presubmit.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698