You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ne...@apache.org on 2014/05/09 01:03:57 UTC

git commit: KAFKA-1442 RBTools post-review is deprecated; reviewed by Neha Narkhede

Repository: kafka
Updated Branches:
  refs/heads/trunk 754dacb90 -> 1d35cce79


KAFKA-1442 RBTools post-review is deprecated; reviewed by Neha Narkhede


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

Branch: refs/heads/trunk
Commit: 1d35cce79d3f2e928fe27d109f962c0a9dda73ea
Parents: 754dacb
Author: Sriharsha Chintalapani <sc...@hortonworks.com>
Authored: Thu May 8 16:02:55 2014 -0700
Committer: Neha Narkhede <ne...@gmail.com>
Committed: Thu May 8 16:03:49 2014 -0700

----------------------------------------------------------------------
 kafka-patch-review.py | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/1d35cce7/kafka-patch-review.py
----------------------------------------------------------------------
diff --git a/kafka-patch-review.py b/kafka-patch-review.py
index dc6664d..dc45549 100644
--- a/kafka-patch-review.py
+++ b/kafka-patch-review.py
@@ -2,10 +2,11 @@
 
 import argparse
 import sys
-import os 
+import os
 import time
 import datetime
 import tempfile
+import commands
 from jira.client import JIRA
 
 def get_jira():
@@ -17,7 +18,11 @@ def get_jira():
   home=home.rstrip('/')
   jira_config = dict(line.strip().split('=') for line in open(home + '/jira.ini'))
   jira = JIRA(options,basic_auth=(jira_config['user'], jira_config['password']))
-  return jira 
+  return jira
+
+def cmd_exists(cmd):
+  status, result = commands.getstatusoutput(cmd)
+  return status
 
 def main():
   ''' main(), shut up, pylint '''
@@ -31,6 +36,15 @@ def main():
   popt.add_argument('-db', '--debug', action='store_true', required=False, help='Enable debug mode')
   opt = popt.parse_args()
 
+  post_review_tool = None
+  if (cmd_exists("post-review") == 0):
+    post_review_tool = "post-review"
+  elif (cmd_exists("rbt") == 0):
+    post_review_tool = "rbt post"
+  else:
+    print "please install RBTools"
+    sys.exit(1)
+
   patch_file=tempfile.gettempdir() + "/" + opt.jira + ".patch"
   if opt.reviewboard:
     ts = time.time()
@@ -62,9 +76,9 @@ def main():
   p=os.popen(git_remote_update)
   p.close()
 
-  rb_command="post-review --publish --tracking-branch " + opt.branch + " --target-groups=kafka --bugs-closed=" + opt.jira
+  rb_command= post_review_tool + " --publish --tracking-branch " + opt.branch + " --target-groups=kafka --bugs-closed=" + opt.jira
   if opt.debug:
-    rb_command=rb_command + " --debug" 
+    rb_command=rb_command + " --debug"
   summary="Patch for " + opt.jira
   if opt.summary:
     summary=opt.summary
@@ -92,9 +106,9 @@ def main():
       p.close()
       sys.exit(1)
   p.close()
-  if opt.debug: 
+  if opt.debug:
     print 'rb url=',rb_url
- 
+
   git_command="git diff " + opt.branch + " > " + patch_file
   if opt.debug:
     print git_command
@@ -108,16 +122,15 @@ def main():
   jira.add_attachment(issue,attachment)
   attachment.close()
 
-  comment="Created reviewboard " 
+  comment="Created reviewboard "
   if not opt.reviewboard:
-    print 'Created a new reviewboard ',rb_url,
+    print 'Created a new reviewboard',rb_url,
   else:
-    print 'Updated reviewboard'
+    print 'Updated reviewboard',rb_url
     comment="Updated reviewboard "
 
-  comment = comment + rb_url + ' against branch ' + opt.branch 
+  comment = comment + rb_url + ' against branch ' + opt.branch
   jira.add_comment(opt.jira, comment)
 
 if __name__ == '__main__':
   sys.exit(main())
-