llvm.org GIT mirror llvm / 4d63668
merge-request.sh: Update to use new "Fixed by Commit(s)" field Summary: This will be used instead of the url field to track which commits need to be merged. This patch also drops support for version 1.x of the bugzilla CLI tool. Reviewers: hansw, hans Reviewed By: hans Subscribers: hans, llvm-commits Differential Revision: https://reviews.llvm.org/D37786 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313334 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 3 years ago
1 changed file(s) with 54 addition(s) and 44 deletion(s). Raw diff Collapse all Expand all
1313
1414 dryrun=""
1515 stable_version=""
16 revision=""
16 revisions=""
1717 BUGZILLA_BIN=""
1818 BUGZILLA_CMD=""
1919 release_metabug=""
3030 echo " -user EMAIL Your email address for logging into bugzilla."
3131 echo " -stable-version X.Y The stable release version (e.g. 4.0, 5.0)."
3232 echo " -r NUM Revision number to merge (e.g. 1234567)."
33 echo " This option can be specified multiple times."
3334 echo " -bugzilla-bin PATH Path to bugzilla binary (optional)."
3435 echo " -assign-to EMAIL Assign bug to user with EMAIL (optional)."
3536 echo " -dry-run Print commands instead of executing them."
4748 ;;
4849 -r)
4950 shift
50 revision="$1"
51 revisions="$revisions $1"
5152 ;;
5253 -project)
5354 shift
8990 case $stable_version in
9091 4.0)
9192 release_metabug="32061"
93 ;;
94 5.0)
95 release_metabug="34492"
9296 ;;
9397 *)
9498 echo "error: invalid stable version"
96100 esac
97101 bugzilla_version=$stable_version
98102
99 if [ -z "$revision" ]; then
100 echo "error: revision not specified"
103 if [ -z "$revisions" ]; then
104 echo "error: no revisions specified"
101105 exit 1
102106 fi
103107
123127
124128 if [ $BUGZILLA_MAJOR_VERSION -eq 1 ]; then
125129
126 echo "***************************** Warning *******************************"
127 echo "You are using an older version of the bugzilla cli tool. You will be "
128 echo "able to create bugs, but this script will crash with the following "
129 echo "error when trying to read back information about the bug you created:"
130 echo ""
131 echo "KeyError: 'internals'"
132 echo ""
133 echo "To avoid this error, use version 2.0.0 or higher"
134 echo "https://pypi.python.org/pypi/python-bugzilla"
135 echo "*********************************************************************"
130 echo "***************************** Error ** ********************************"
131 echo "You are using an older version of the bugzilla cli tool, which is not "
132 echo "supported. You need to use bugzilla cli version 2.0.0 or higher:"
133 echo "***********************************************************************"
134 exit 1
136135 fi
137136
138137 BUGZILLA_CMD="$BUGZILLA_BIN --bugzilla=$bugzilla_url"
139138
140 bug_url="https://reviews.llvm.org/rL$revision"
139 rev_string=""
140 for r in $revisions; do
141 rev_string="$rev_string r$r"
142 done
141143
142144 echo "Checking for duplicate bugs..."
143145
144 check_duplicates=`$BUGZILLA_CMD query --url $bug_url`
146 check_duplicates=`$BUGZILLA_CMD query --blocked=$release_metabug --field="cf_fixed_by_commits=$rev_string"`
145147
146148 if [ -n "$check_duplicates" ]; then
147149 echo "Duplicate bug found:"
151153
152154 echo "Done"
153155
154 # Get short commit summary
156 # Get short commit summary. To avoid having a huge summary, we just
157 # use the commit message for the first commit.
155158 commit_summary=''
156 commit_msg=`svn log -r $revision https://llvm.org/svn/llvm-project/`
157 if [ $? -ne 0 ]; then
158 echo "warning: failed to get commit message."
159 commit_msg=""
160 fi
159 for r in $revisions; do
160 commit_msg=`svn log -r $r https://llvm.org/svn/llvm-project/`
161 if [ $? -ne 0 ]; then
162 echo "warning: failed to get commit message."
163 commit_msg=""
164 fi
165 break
166 done
161167
162168 if [ -n "$commit_msg" ]; then
163169 commit_summary=`echo "$commit_msg" | sed '4q;d' | cut -c1-80`
164170 commit_summary=" : ${commit_summary}"
165171 fi
166172
167 bug_summary="Merge r$revision into the $stable_version branch${commit_summary}"
168
169 if [ -z "$dryrun" ]; then
170 set -x
171 fi
172
173 ${dryrun} $BUGZILLA_CMD --login --user=$bugzilla_user new \
173 bug_summary="Merge${rev_string} into the $stable_version branch${commit_summary}"
174
175 set -x
176
177 # Login to bugzilla
178 $BUGZILLA_CMD login $bugzilla_user
179
180 bug_id=`${dryrun} $BUGZILLA_CMD --ensure-logged-in new \
174181 -p "$bugzilla_product" \
175 -c "$bugzilla_component" -u $bug_url --blocked=$release_metabug \
182 -c "$bugzilla_component" --blocked=$release_metabug \
176183 -o All --priority=P --arch All -v $bugzilla_version \
184 --field="cf_fixed_by_commits=$rev_string" \
177185 --summary "${bug_summary}" \
178 -l "Is this patch OK to merge to the $stable_version branch?" \
186 -l "Is it OK to merge the following revision(s) to the $stable_version branch?" \
179187 $bugzilla_assigned_to \
180 --oneline
181
182 set +x
188 -i`
183189
184190 if [ -n "$dryrun" ]; then
185191 exit 0
186192 fi
187193
188 if [ $BUGZILLA_MAJOR_VERSION -eq 1 ]; then
189 success=`$BUGZILLA_CMD query --url $bug_url`
190 if [ -z "$success" ]; then
191 echo "Failed to create bug."
192 exit 1
193 fi
194
195 echo " Created new bug:"
196 echo $success
197 fi
194 set +x
195
196 if [ -z "$bug_id" ]; then
197 echo "Failed to create bug."
198 exit 1
199 fi
200
201 echo " Created new bug:"
202 echo https://llvm.org/PR$bug_id
203
204 # Add links to revisions
205 for r in $revisions; do
206 $BUGZILLA_CMD --ensure-logged-in modify -l "https://reviews.llvm.org/rL$r" $bug_id
207 done