Index: commit_queue.py |
diff --git a/commit_queue.py b/commit_queue.py |
index 25ddb38127df55b553238c65af7bcde78d794c3a..c8301ebb1c363fe45ace7d469d9aa4e16ca12312 100755 |
--- a/commit_queue.py |
+++ b/commit_queue.py |
@@ -77,6 +77,19 @@ def need_issue(fn): |
return hook |
+def get_commit(obj, issue): |
+ """Gets the commit bit flag of an issue.""" |
+ try: |
+ print int(obj.get_issue_properties(issue, False)['commit']) |
+ except urllib2.HTTPError, e: |
+ if e.code == 404: |
Michael Hablich
2015/11/30 13:24:19
Nit: Line 85 to 91 could be extracted in a separat
Michael Achenbach
2015/11/30 13:35:37
Done.
|
+ print >> sys.stderr, 'Issue %d doesn\'t exist.' % issue |
+ elif e.code == 403: |
+ print >> sys.stderr, 'Access denied to issue %d.' % issue |
+ else: |
+ raise |
+ return 1 |
+ |
def set_commit(obj, issue, flag): |
"""Sets the commit bit flag on an issue.""" |
try: |
@@ -99,6 +112,13 @@ def CMDset(parser, args): |
parser.error('Unrecognized args: %s' % ' '.join(args)) |
return set_commit(obj, options.issue, '1') |
+@need_issue |
+def CMDget(parser, args): |
+ """Gets the commit bit.""" |
+ options, args, obj = parser.parse_args(args) |
+ if args: |
+ parser.error('Unrecognized args: %s' % ' '.join(args)) |
+ return get_commit(obj, options.issue) |
@need_issue |
def CMDclear(parser, args): |