[llvm] r313334 - merge-request.sh: Update to use new "Fixed by Commit(s)" field

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 19:25:22 PDT 2017


Author: tstellar
Date: Thu Sep 14 19:25:22 2017
New Revision: 313334

URL: http://llvm.org/viewvc/llvm-project?rev=313334&view=rev
Log:
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

Modified:
    llvm/trunk/utils/release/merge-request.sh

Modified: llvm/trunk/utils/release/merge-request.sh
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/release/merge-request.sh?rev=313334&r1=313333&r2=313334&view=diff
==============================================================================
--- llvm/trunk/utils/release/merge-request.sh (original)
+++ llvm/trunk/utils/release/merge-request.sh Thu Sep 14 19:25:22 2017
@@ -14,7 +14,7 @@
 
 dryrun=""
 stable_version=""
-revision=""
+revisions=""
 BUGZILLA_BIN=""
 BUGZILLA_CMD=""
 release_metabug=""
@@ -31,6 +31,7 @@ function usage() {
   echo " -user EMAIL             Your email address for logging into bugzilla."
   echo " -stable-version X.Y     The stable release version (e.g. 4.0, 5.0)."
   echo " -r NUM                  Revision number to merge (e.g. 1234567)."
+  echo "                         This option can be specified multiple times."
   echo " -bugzilla-bin PATH      Path to bugzilla binary (optional)."
   echo " -assign-to EMAIL        Assign bug to user with EMAIL (optional)."
   echo " -dry-run                Print commands instead of executing them."
@@ -48,7 +49,7 @@ while [ $# -gt 0 ]; do
       ;;
     -r)
       shift
-      revision="$1"
+      revisions="$revisions $1"
       ;;
     -project)
       shift
@@ -91,14 +92,17 @@ case $stable_version in
   4.0)
     release_metabug="32061"
     ;;
+  5.0)
+    release_metabug="34492"
+    ;;
   *)
     echo "error: invalid stable version"
     exit 1
 esac
 bugzilla_version=$stable_version
 
-if [ -z "$revision" ]; then
-  echo "error: revision not specified"
+if [ -z "$revisions" ]; then
+  echo "error: no revisions specified"
   exit 1
 fi
 
@@ -124,25 +128,23 @@ BUGZILLA_MAJOR_VERSION=`$BUGZILLA_BIN --
 
 if [ $BUGZILLA_MAJOR_VERSION -eq 1 ]; then
 
-  echo "***************************** Warning *******************************"
-  echo "You are using an older version of the bugzilla cli tool.  You will be "
-  echo "able to create bugs, but this script will crash with the following "
-  echo "error when trying to read back information about the bug you created:"
-  echo ""
-  echo "KeyError: 'internals'"
-  echo ""
-  echo "To avoid this error, use version 2.0.0 or higher"
-  echo "https://pypi.python.org/pypi/python-bugzilla"
-  echo "*********************************************************************"
+  echo "***************************** Error ** ********************************"
+  echo "You are using an older version of the bugzilla cli tool, which is not "
+  echo "supported.  You need to use bugzilla cli version 2.0.0 or higher:"
+  echo "***********************************************************************"
+  exit 1
 fi
 
 BUGZILLA_CMD="$BUGZILLA_BIN --bugzilla=$bugzilla_url"
 
-bug_url="https://reviews.llvm.org/rL$revision"
+rev_string=""
+for r in $revisions; do
+  rev_string="$rev_string r$r"
+done
 
 echo "Checking for duplicate bugs..."
 
-check_duplicates=`$BUGZILLA_CMD query --url $bug_url`
+check_duplicates=`$BUGZILLA_CMD query --blocked=$release_metabug --field="cf_fixed_by_commits=$rev_string"`
 
 if [ -n "$check_duplicates" ]; then
   echo "Duplicate bug found:"
@@ -152,47 +154,55 @@ fi
 
 echo "Done"
 
-# Get short commit summary
+# Get short commit summary.  To avoid having a huge summary, we just
+# use the commit message for the first commit.
 commit_summary=''
-commit_msg=`svn log -r $revision https://llvm.org/svn/llvm-project/`
-if [ $? -ne 0 ]; then
-  echo "warning: failed to get commit message."
-  commit_msg=""
-fi
+for r in $revisions; do
+  commit_msg=`svn log -r $r https://llvm.org/svn/llvm-project/`
+  if [ $? -ne 0 ]; then
+    echo "warning: failed to get commit message."
+    commit_msg=""
+  fi
+  break
+done
 
 if [ -n "$commit_msg" ]; then
   commit_summary=`echo "$commit_msg" | sed '4q;d' | cut -c1-80`
   commit_summary=" : ${commit_summary}"
 fi
 
-bug_summary="Merge r$revision into the $stable_version branch${commit_summary}"
+bug_summary="Merge${rev_string} into the $stable_version branch${commit_summary}"
 
-if [ -z "$dryrun" ]; then
-  set -x
-fi
+set -x
+
+# Login to bugzilla
+$BUGZILLA_CMD login $bugzilla_user
 
-${dryrun} $BUGZILLA_CMD --login --user=$bugzilla_user new \
+bug_id=`${dryrun} $BUGZILLA_CMD --ensure-logged-in new \
   -p "$bugzilla_product" \
-  -c "$bugzilla_component" -u $bug_url --blocked=$release_metabug \
+  -c "$bugzilla_component" --blocked=$release_metabug \
   -o All --priority=P --arch All -v $bugzilla_version \
+  --field="cf_fixed_by_commits=$rev_string" \
   --summary "${bug_summary}" \
-  -l "Is this patch OK to merge to the $stable_version branch?" \
+  -l "Is it OK to merge the following revision(s) to the $stable_version branch?" \
   $bugzilla_assigned_to \
-  --oneline
-
-set +x
+  -i`
 
 if [ -n "$dryrun" ]; then
   exit 0
 fi
 
-if [ $BUGZILLA_MAJOR_VERSION -eq 1 ]; then
-  success=`$BUGZILLA_CMD query --url $bug_url`
-  if [ -z "$success" ]; then
-    echo "Failed to create bug."
-    exit 1
-  fi
+set +x
 
-  echo " Created new bug:"
-  echo $success
+if [ -z "$bug_id" ]; then
+  echo "Failed to create bug."
+  exit 1
 fi
+
+echo " Created new bug:"
+echo https://llvm.org/PR$bug_id
+
+# Add links to revisions
+for r in $revisions; do
+  $BUGZILLA_CMD --ensure-logged-in modify -l "https://reviews.llvm.org/rL$r" $bug_id
+done




More information about the llvm-commits mailing list