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

Unified Diff: apply_issue.py

Issue 1372133004: Readability improvement in apply_issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 2 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: apply_issue.py
diff --git a/apply_issue.py b/apply_issue.py
index 755373b273a6d30e04cbd0933283642fedea8852..dd9075791c98799ba63f7827b200e7c156153f7b 100755
--- a/apply_issue.py
+++ b/apply_issue.py
@@ -27,9 +27,10 @@ import scm
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-RETURN_CODE_ARG_PARSER = 2 # default in python.
-RETURN_CODE_INFRA_FAILURE = 3 # considered as infra failure.
-RETURN_CODE_OTHERWISE = 1 # any other failure, likely patch apply one.
+RETURN_CODE_OK = 0 # any other failure, likely patch apply one.
Sergey Berezin 2015/10/05 19:06:58 drive-by nit: that's not a failure :-)
+RETURN_CODE_OTHER_FAILURE = 1 # any other failure, likely patch apply one.
+RETURN_CODE_ARGPARSE_FAILURE = 2 # default in python.
+RETURN_CODE_INFRA_FAILURE = 3 # considered as infra failure.
class Unbuffered(object):
@@ -178,7 +179,7 @@ def main():
properties = rietveld_obj.get_issue_properties(options.issue, False)
except rietveld.upload.ClientLoginError as e:
print('Accessing the issue requires proper credentials.')
- return RETURN_CODE_OTHERWISE
+ return RETURN_CODE_OTHER_FAILURE
except urllib2.URLError:
logging.exception('failed to fetch issue properties')
return RETURN_CODE_INFRA_FAILURE
@@ -241,7 +242,7 @@ def main():
options.server, issue_to_apply)
# If we got this far, then this is likely missing patchset.
# Thus, it's not infra failure.
- return RETURN_CODE_OTHERWISE
+ return RETURN_CODE_OTHER_FAILURE
except urllib2.URLError:
logging.exception(
'Failed to fetch the patch for issue %d, patchset %d',
@@ -282,7 +283,7 @@ def main():
print(str(e))
print('CWD=%s' % os.getcwd())
print('Checkout path=%s' % scm_obj.project_path)
- return RETURN_CODE_OTHERWISE
+ return RETURN_CODE_OTHER_FAILURE
if ('DEPS' in map(os.path.basename, patchset.filenames)
and not options.ignore_deps):
@@ -313,7 +314,7 @@ def main():
annotated_gclient.emit_buildprops(revisions)
return retcode
- return 0
+ return RETURN_CODE_OK
if __name__ == "__main__":
@@ -322,4 +323,4 @@ if __name__ == "__main__":
sys.exit(main())
except KeyboardInterrupt:
sys.stderr.write('interrupted\n')
- sys.exit(RETURN_CODE_OTHERWISE)
+ sys.exit(RETURN_CODE_OTHER_FAILURE)
« 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