You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2013/07/16 09:04:14 UTC

git commit: More sophisticated hack for post-reviews.py.

Updated Branches:
  refs/heads/master 3f89d05a2 -> ea69c0123


More sophisticated hack for post-reviews.py.

Review: https://reviews.apache.org/r/12590


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ea69c012
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ea69c012
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ea69c012

Branch: refs/heads/master
Commit: ea69c01236632ee839151a9bf510fda73e67c120
Parents: 3f89d05
Author: Benjamin Hindman <be...@gmail.com>
Authored: Mon Jul 15 23:26:53 2013 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Mon Jul 15 23:57:45 2013 -0700

----------------------------------------------------------------------
 support/post-reviews.py | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ea69c012/support/post-reviews.py
----------------------------------------------------------------------
diff --git a/support/post-reviews.py b/support/post-reviews.py
index 89407e9..ef6c9a2 100755
--- a/support/post-reviews.py
+++ b/support/post-reviews.py
@@ -157,17 +157,36 @@ for i in range(len(shas)):
 
     revision_range = previous + ':' + sha
 
+    #################################################################
+    # THIS IS A GIANT HACK FOR GETTING POST-REVIEWS TO WORK UNTIL
+    # APACHE INFRASTRUCTURE MANAGES TO FIX REVIEW BOARD!
+
+    # Create a temporary branch from incubator-mesos/master.
+    hack_temporary_branch = '_post-reviews_' + branch + '_' + str(i)
+    execute(['git', 'checkout', '--track', '-b', hack_temporary_branch, 'incubator-mesos/master'])
+    atexit.register(lambda: execute(['git', 'branch', '-D', hack_temporary_branch], True))
+
+    # Then 'cherry-pick' from 'git merge-base incubator-mesos/master
+    # master' to 'sha'. This assumes your branch's parent is 'master'.
+    hack_merge_base = execute(['git', 'merge-base', hack_temporary_branch, 'master']).strip()
+    execute(['git', 'cherry-pick', hack_merge_base + '..' + sha])
+
+    # Then post-review with '--tracking-branch=incubator-mesos/master'
+    # and '--revision-range=HEAD~1:HEAD'
     if review_request_id is None:
         output = execute(['post-review',
                           '--repository-url=' + repository,
                           '--tracking-branch=incubator-mesos/master',
-                          '--revision-range=' + revision_range] + sys.argv[1:]).strip()
+                          '--revision-range=HEAD~1:HEAD'] + sys.argv[1:]).strip()
     else:
         output = execute(['post-review',
                           '--review-request-id=' + review_request_id,
                           '--repository-url=' + repository,
                           '--tracking-branch=incubator-mesos/master',
-                          '--revision-range=' + revision_range] + sys.argv[1:]).strip()
+                          '--revision-range=HEAD~1:HEAD'] + sys.argv[1:]).strip()
+    execute(['git', 'checkout', branch])
+    execute(['git', 'branch', '-D', hack_temporary_branch])
+    #################################################################
 
     print output