You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2017/11/06 16:11:22 UTC

mesos git commit: Included commit message in `push-commits.py`.

Repository: mesos
Updated Branches:
  refs/heads/master 6fec95d28 -> e0ef27c46


Included commit message in `push-commits.py`.

This script previously closed the reviews without any description.
Now it includes the commit log for easy reference.

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


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

Branch: refs/heads/master
Commit: e0ef27c467cad7174f2eddbb9c4250123b17d090
Parents: 6fec95d
Author: Vinod Kone <vi...@gmail.com>
Authored: Fri Nov 3 15:58:16 2017 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon Nov 6 10:06:55 2017 -0600

----------------------------------------------------------------------
 support/push-commits.py | 44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e0ef27c4/support/push-commits.py
----------------------------------------------------------------------
diff --git a/support/push-commits.py b/support/push-commits.py
index 3e9d05c..cd751cb 100755
--- a/support/push-commits.py
+++ b/support/push-commits.py
@@ -44,37 +44,45 @@ REVIEWBOARD_URL = 'https://reviews.apache.org'
 
 def get_reviews(revision_range):
     """Return the list of reviews found in the commits in the revision range."""
-    log = check_output(['git',
-                        '--no-pager',
-                        'log',
-                        '--no-color',
-                        '--reverse',
-                        revision_range]).strip()
-
-    review_ids = []
-    for line in log.split('\n'):
-        pos = line.find('Review: ')
+    reviews = [] # List of (review id, commit log) tuples
+
+    rev_list = check_output(['git',
+                             'rev-list',
+                             '--reverse',
+                             revision_range]).strip().split('\n')
+    for rev in rev_list:
+        commit_log = check_output(['git',
+                                   '--no-pager',
+                                   'show',
+                                   '--no-color',
+                                   '--no-patch',
+                                   rev]).strip()
+
+        pos = commit_log.find('Review: ')
         if pos != -1:
             pattern = re.compile('Review: ({url})$'.format(
                 url=os.path.join(REVIEWBOARD_URL, 'r', '[0-9]+')))
-            match = pattern.search(line.strip().strip('/'))
+            match = pattern.search(commit_log.strip().strip('/'))
             if match is None:
-                print "\nInvalid ReviewBoard URL: '{}'".format(line[pos:])
+                print "\nInvalid ReviewBoard URL: '{}'".format(commit_log[pos:])
                 sys.exit(1)
 
             url = match.group(1)
-            review_ids.append(os.path.basename(url))
+            reviews.append((os.path.basename(url), commit_log))
 
-    return review_ids
+    return reviews
 
 
 def close_reviews(reviews, options):
     """Mark the given reviews as submitted on ReviewBoard."""
-    for review_id in reviews:
+    for review_id, commit_log in reviews:
         print 'Closing review', review_id
         if not options['dry_run']:
-            # TODO(vinod): Include the commit message as '--description'.
-            check_output(['rbt', 'close', review_id])
+            check_output(['rbt',
+                          'close',
+                          '--description',
+                          commit_log,
+                          review_id])
 
 
 def parse_options():
@@ -122,8 +130,6 @@ def main():
 
     reviews = get_reviews(merge_base + ".." + current_branch_ref)
 
-    print 'Found reviews', reviews
-
     # Push the current branch to remote master.
     remote = check_output(['git',
                            'config',