Revision: 19163
Author:   [email protected]
Date:     Thu Feb  6 15:34:46 2014 UTC
Log: Add support to automatically search for corresponding architecture ports in merge-to-branch.sh.

BUG=
[email protected], [email protected]

Review URL: https://codereview.chromium.org/152343011
http://code.google.com/p/v8/source/detail?r=19163

Modified:
 /branches/bleeding_edge/tools/merge-to-branch.sh

=======================================
--- /branches/bleeding_edge/tools/merge-to-branch.sh Thu Jan 16 14:40:56 2014 UTC +++ /branches/bleeding_edge/tools/merge-to-branch.sh Thu Feb 6 15:34:46 2014 UTC
@@ -137,12 +137,56 @@
     || die "Creating branch $BRANCHNAME failed."
 fi

+let CURRENT_STEP+=1
+if [ $START_STEP -le $CURRENT_STEP ] ; then
+ echo ">>> Step $CURRENT_STEP: Search for corresponding architecture ports."
+  for REVISION in "$@" ; do
+    # Add the revision to the array if it isn't already added.
+    if  [[ ! "${FULL_REVISION_LIST[@]}" =~ (^| )$REVISION($| ) ]] ; then
+      FULL_REVISION_LIST=("${FULL_REVISION_LIST[@]}" "$REVISION")
+    fi
+    # Search for commits which matches the "Port rXXX" pattern.
+    GIT_HASHES=$(git log svn/bleeding_edge --reverse \
+                 --format=%H --grep="Port r$REVISION")
+    if [ -n "$GIT_HASHES" ]; then
+      while read -r NEXT_GIT_HASH; do
+ NEXT_SVN_REVISION=$(git svn find-rev $NEXT_GIT_HASH svn/bleeding_edge)
+        [[ -n "$NEXT_SVN_REVISION" ]] \
+          || die "Cannot determine svn revision for $NEXT_GIT_HASH"
+ FULL_REVISION_LIST=("${FULL_REVISION_LIST[@]}" "$NEXT_SVN_REVISION")
+        REVISION_TITLE=$(git log -1 --format=%s $NEXT_GIT_HASH)
+        # Is this revision included in the original revision list?
+        if [[ $@ =~ (^| )$NEXT_SVN_REVISION($| ) ]] ; then
+          echo "Found port of r$REVISION -> \
+r$NEXT_SVN_REVISION (already included): $REVISION_TITLE"
+        else
+          echo "Found port of r$REVISION -> \
+r$NEXT_SVN_REVISION: $REVISION_TITLE"
+ PORT_REVISION_LIST=("${PORT_REVISION_LIST[@]}" "$NEXT_SVN_REVISION")
+        fi
+      done <<< "$GIT_HASHES"
+    fi
+  done
+  # Next step expects a list, not an array.
+  FULL_REVISION_LIST="${FULL_REVISION_LIST[@]}"
+  # Do we find any port?
+  if [ ${#PORT_REVISION_LIST[@]} -ne 0 ] ; then
+ confirm "Automatically add corresponding ports (${PORT_REVISION_LIST[*]})?"
+    #: 'n': Restore the original revision list.
+    if [ $? -ne 0 ] ; then
+      FULL_REVISION_LIST="$@"
+    fi
+  fi
+  persist "FULL_REVISION_LIST"
+fi
+
 let CURRENT_STEP+=1
 if [ $START_STEP -le $CURRENT_STEP ] ; then
   echo ">>> Step $CURRENT_STEP: Find the git \
 revisions associated with the patches."
+  restore_if_unset "FULL_REVISION_LIST"
   current=0
-  for REVISION in "$@" ; do
+  for REVISION in $FULL_REVISION_LIST ; do
     NEXT_HASH=$(git svn find-rev "r$REVISION" svn/bleeding_edge)
     [[ -n "$NEXT_HASH" ]] \
       || die "Cannot determine git hash for r$REVISION"

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to