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

Side by Side Diff: git_cl.py

Issue 16366008: Add the option to bypass watchlists. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 7 years, 6 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.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 import json 10 import json
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 items = sum((i.split(',') for i in l), []) 1337 items = sum((i.split(',') for i in l), [])
1338 stripped_items = (i.strip() for i in items) 1338 stripped_items = (i.strip() for i in items)
1339 return sorted(filter(None, stripped_items)) 1339 return sorted(filter(None, stripped_items))
1340 1340
1341 1341
1342 @usage('[args to "git diff"]') 1342 @usage('[args to "git diff"]')
1343 def CMDupload(parser, args): 1343 def CMDupload(parser, args):
1344 """upload the current changelist to codereview""" 1344 """upload the current changelist to codereview"""
1345 parser.add_option('--bypass-hooks', action='store_true', dest='bypass_hooks', 1345 parser.add_option('--bypass-hooks', action='store_true', dest='bypass_hooks',
1346 help='bypass upload presubmit hook') 1346 help='bypass upload presubmit hook')
1347 parser.add_option('--bypass-watchlists', action='store_true',
1348 dest='bypass_watchlists',
1349 help='bypass watchlists auto CC-ing reviewers')
1347 parser.add_option('-f', action='store_true', dest='force', 1350 parser.add_option('-f', action='store_true', dest='force',
1348 help="force yes to questions (don't prompt)") 1351 help="force yes to questions (don't prompt)")
1349 parser.add_option('-m', dest='message', help='message for patchset') 1352 parser.add_option('-m', dest='message', help='message for patchset')
1350 parser.add_option('-t', dest='title', help='title for patchset') 1353 parser.add_option('-t', dest='title', help='title for patchset')
1351 parser.add_option('-r', '--reviewers', 1354 parser.add_option('-r', '--reviewers',
1352 action='append', default=[], 1355 action='append', default=[],
1353 help='reviewer email addresses') 1356 help='reviewer email addresses')
1354 parser.add_option('--cc', 1357 parser.add_option('--cc',
1355 action='append', default=[], 1358 action='append', default=[],
1356 help='cc email addresses') 1359 help='cc email addresses')
(...skipping 27 matching lines...) Expand all
1384 base_branch = args[0] 1387 base_branch = args[0]
1385 else: 1388 else:
1386 # Default to diffing against common ancestor of upstream branch 1389 # Default to diffing against common ancestor of upstream branch
1387 base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip() 1390 base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip()
1388 args = [base_branch, 'HEAD'] 1391 args = [base_branch, 'HEAD']
1389 1392
1390 # Apply watchlists on upload. 1393 # Apply watchlists on upload.
1391 change = cl.GetChange(base_branch, None) 1394 change = cl.GetChange(base_branch, None)
1392 watchlist = watchlists.Watchlists(change.RepositoryRoot()) 1395 watchlist = watchlists.Watchlists(change.RepositoryRoot())
1393 files = [f.LocalPath() for f in change.AffectedFiles()] 1396 files = [f.LocalPath() for f in change.AffectedFiles()]
1394 cl.SetWatchers(watchlist.GetWatchersForPaths(files)) 1397 if not options.bypass_watchlists:
1398 cl.SetWatchers(watchlist.GetWatchersForPaths(files))
1395 1399
1396 if not options.bypass_hooks: 1400 if not options.bypass_hooks:
1397 hook_results = cl.RunHook(committing=False, 1401 hook_results = cl.RunHook(committing=False,
1398 may_prompt=not options.force, 1402 may_prompt=not options.force,
1399 verbose=options.verbose, 1403 verbose=options.verbose,
1400 change=change) 1404 change=change)
1401 if not hook_results.should_continue(): 1405 if not hook_results.should_continue():
1402 return 1 1406 return 1
1403 if not options.reviewers and hook_results.reviewers: 1407 if not options.reviewers and hook_results.reviewers:
1404 options.reviewers = hook_results.reviewers.split(',') 1408 options.reviewers = hook_results.reviewers.split(',')
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 GenUsage(parser, 'help') 2097 GenUsage(parser, 'help')
2094 return CMDhelp(parser, argv) 2098 return CMDhelp(parser, argv)
2095 2099
2096 2100
2097 if __name__ == '__main__': 2101 if __name__ == '__main__':
2098 # These affect sys.stdout so do it outside of main() to simplify mocks in 2102 # These affect sys.stdout so do it outside of main() to simplify mocks in
2099 # unit testing. 2103 # unit testing.
2100 fix_encoding.fix_encoding() 2104 fix_encoding.fix_encoding()
2101 colorama.init() 2105 colorama.init()
2102 sys.exit(main(sys.argv[1:])) 2106 sys.exit(main(sys.argv[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