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 2014/04/16 17:28:42 UTC

git commit: Checks in post-reviews.py to make more user-friendly.

Repository: mesos
Updated Branches:
  refs/heads/master 74b042ac2 -> 316bac66d


Checks in post-reviews.py to make more user-friendly.

This is a small fix but wanted most by me, whenever working on master
branch directly with small patches, rather than a dedicate branch,
post-reviews.py doesn't handle this situation but just fail with the
trace back like:

% ./support/post-reviews.py
Running post-review across all of ...
Traceback (most recent call last):
  File "./support/post-reviews.py", line 104, in <module>
    sha = line.split()[0]
IndexError: list index out of range

This is not quite user friendly or make a lot of sense. This patch will
handle the above situation and notice user useful information.

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


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

Branch: refs/heads/master
Commit: 316bac66dce9a6f73e2724888b759174b0652fcc
Parents: 74b042a
Author: Chengwei Yang <ch...@gmail.com>
Authored: Wed Apr 16 08:24:01 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Wed Apr 16 08:24:01 2014 -0700

----------------------------------------------------------------------
 support/post-reviews.py | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/316bac66/support/post-reviews.py
----------------------------------------------------------------------
diff --git a/support/post-reviews.py b/support/post-reviews.py
index 602e660..cb009be 100755
--- a/support/post-reviews.py
+++ b/support/post-reviews.py
@@ -72,6 +72,11 @@ parent_branch = 'master'
 branch_ref = execute(['git', 'symbolic-ref', 'HEAD']).strip()
 branch = branch_ref.replace('refs/heads/', '', 1)
 
+# do not work on master branch
+if branch == "master":
+    print "we're expecting you to be working on another branch from master!"
+    sys.exit(1)
+
 temporary_branch = '_post-reviews_' + branch
 
 # Always delete the temporary branch.
@@ -98,6 +103,10 @@ log = execute(['git',
                '--reverse',
                merge_base + '..HEAD']).strip()
 
+if len(log) <= 0:
+    print "No new change compare with master branch!"
+    sys.exit(1)
+
 shas = []
 
 for line in log.split('\n'):