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

Side by Side Diff: git_cl.py

Issue 2250323003: Add --issue flag to git cl status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Changelist has fancy logic in __init__, so override issue after the fact. Created 4 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld and Gerrit.""" 8 """A git-command for integrating reviews on Rietveld and Gerrit."""
9 9
10 from __future__ import print_function 10 from __future__ import print_function
(...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 - Green LGTM'ed 3271 - Green LGTM'ed
3272 - Magenta in the commit queue 3272 - Magenta in the commit queue
3273 - Cyan was committed, branch can be deleted 3273 - Cyan was committed, branch can be deleted
3274 3274
3275 Also see 'git cl comments'. 3275 Also see 'git cl comments'.
3276 """ 3276 """
3277 parser.add_option('--field', 3277 parser.add_option('--field',
3278 help='print only specific field (desc|id|patch|status|url)') 3278 help='print only specific field (desc|id|patch|status|url)')
3279 parser.add_option('-f', '--fast', action='store_true', 3279 parser.add_option('-f', '--fast', action='store_true',
3280 help='Do not retrieve review status') 3280 help='Do not retrieve review status')
3281 parser.add_option('-i', '--issue', type=int,
3282 help='Operate on this issue number instead of the current'
3283 ' branch\'s implicit issue. Only valid with --field.')
3281 parser.add_option( 3284 parser.add_option(
3282 '-j', '--maxjobs', action='store', type=int, 3285 '-j', '--maxjobs', action='store', type=int,
3283 help='The maximum number of jobs to use when retrieving review status') 3286 help='The maximum number of jobs to use when retrieving review status')
3284 3287
3285 auth.add_auth_options(parser) 3288 auth.add_auth_options(parser)
3286 options, args = parser.parse_args(args) 3289 options, args = parser.parse_args(args)
3287 if args: 3290 if args:
3288 parser.error('Unsupported args: %s' % args) 3291 parser.error('Unsupported args: %s' % args)
3289 auth_config = auth.extract_auth_config_from_options(options) 3292 auth_config = auth.extract_auth_config_from_options(options)
3290 3293
3294 if not options.field and options.issue is not None:
Vadim Sh. 2016/08/17 19:39:38 Is it None or 0? Option type is 'int', I forgot wh
3295 parser.error('--issue may only be specified in conjunction with --field')
3296
3291 if options.field: 3297 if options.field:
3292 cl = Changelist(auth_config=auth_config) 3298 cl = Changelist(auth_config=auth_config)
tandrii(chromium) 2016/08/17 19:41:04 passing it here is also OK, so long as you know wh
3299 if options.issue:
3300 cl.issue = options.issue
3293 if options.field.startswith('desc'): 3301 if options.field.startswith('desc'):
3294 print(cl.GetDescription()) 3302 print(cl.GetDescription())
3295 elif options.field == 'id': 3303 elif options.field == 'id':
3296 issueid = cl.GetIssue() 3304 issueid = cl.GetIssue()
3297 if issueid: 3305 if issueid:
3298 print(issueid) 3306 print(issueid)
3299 elif options.field == 'patch': 3307 elif options.field == 'patch':
3300 patchset = cl.GetPatchset() 3308 patchset = cl.GetPatchset()
3301 if patchset: 3309 if patchset:
3302 print(patchset) 3310 print(patchset)
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
5109 if __name__ == '__main__': 5117 if __name__ == '__main__':
5110 # These affect sys.stdout so do it outside of main() to simplify mocks in 5118 # These affect sys.stdout so do it outside of main() to simplify mocks in
5111 # unit testing. 5119 # unit testing.
5112 fix_encoding.fix_encoding() 5120 fix_encoding.fix_encoding()
5113 setup_color.init() 5121 setup_color.init()
5114 try: 5122 try:
5115 sys.exit(main(sys.argv[1:])) 5123 sys.exit(main(sys.argv[1:]))
5116 except KeyboardInterrupt: 5124 except KeyboardInterrupt:
5117 sys.stderr.write('interrupted\n') 5125 sys.stderr.write('interrupted\n')
5118 sys.exit(1) 5126 sys.exit(1)
OLDNEW
« 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