Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: utils/set_tree_status.py

Issue 6816019: Enable force tree closure. (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/set_tree_status.py
diff --git a/utils/set_tree_status.py b/utils/set_tree_status.py
index a189503bf17c2ec8568bb477dda21fb07b7d5ff7..d140eb7ff258bd92739d39914bf06cba19bca977 100755
--- a/utils/set_tree_status.py
+++ b/utils/set_tree_status.py
@@ -7,9 +7,10 @@
# password protected authorization.
#
# Example usage:
-# ./set_tree_status.py "a quoted space separated message."
+# ./set_tree_status.py [options] "a quoted space separated message."
import getpass
+import optparse
import os
import sys
import urllib
@@ -30,12 +31,13 @@ def get_pwd():
return getpass.getpass()
-def post_status(message):
- status = get_status()
- if 'tree is closed' in status.lower():
- print >> sys.stderr, 'Tree is already closed for some other reason.'
- print >> sys.stderr, status
- return -1
+def post_status(force, message):
+ if not force:
+ status = get_status()
+ if 'tree is closed' in status.lower():
+ print >> sys.stderr, 'Tree is already closed for some other reason.'
+ print >> sys.stderr, status
+ return -1
data = {
'message': message,
'username': getpass.getuser(),
@@ -46,8 +48,12 @@ def post_status(message):
if __name__ == '__main__':
- if len(sys.argv) != 2:
- print('Usage: set_tree_status.py "message"')
- sys.exit(1)
-
- sys.exit(post_status(sys.argv[1]))
+ parser = optparse.OptionParser("%prog [options] quoted_message")
+ parser.add_option('--noforce',
+ dest='force', action='store_false',
+ default=True,
+ help='Dont force to close tree if it is already closed.')
+ options, args = parser.parse_args()
+ if not args:
+ print >> sys.stderr, 'missing tree close message.'
+ sys.exit(post_status(options.force, args[0]))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698