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

Side by Side Diff: git_try.py

Issue 1003733006: Splitting trychange for git_try and removing no longer needed support for: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 9 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 | tests/trychange_git_unittest.py » ('j') | trychange_git.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """Wrapper for trychange.py for git checkout.""" 5 """Wrapper for trychange.py for git checkout."""
6 6
7 import logging 7 import logging
8 import sys 8 import sys
9 9
10 import breakpad # pylint: disable=W0611 10 import breakpad # pylint: disable=W0611
11 11
12 from scm import GIT 12 from scm import GIT
13 import subprocess2 13 import subprocess2
14 import third_party.upload 14 import third_party.upload
15 import trychange 15 import trychange_git
16 import git_cl 16 import git_cl
17 17
18 18
19 def GetRietveldIssueNumber(): 19 def GetRietveldIssueNumber():
20 try: 20 try:
21 return GIT.Capture( 21 return GIT.Capture(
22 ['config', 'branch.%s.rietveldissue' % GIT.GetBranch('.')], 22 ['config', 'branch.%s.rietveldissue' % GIT.GetBranch('.')],
23 '.').strip() 23 '.').strip()
24 except subprocess2.CalledProcessError: 24 except subprocess2.CalledProcessError:
25 return None 25 return None
(...skipping 20 matching lines...) Expand all
46 if patchset: 46 if patchset:
47 args.extend([ 47 args.extend([
48 '--issue', GetRietveldIssueNumber(), 48 '--issue', GetRietveldIssueNumber(),
49 '--patchset', patchset, 49 '--patchset', patchset,
50 ]) 50 ])
51 else: 51 else:
52 rietveld_url = GetRietveldServerUrl() 52 rietveld_url = GetRietveldServerUrl()
53 if rietveld_url: 53 if rietveld_url:
54 args.extend(['--rietveld_url', GetRietveldServerUrl()]) 54 args.extend(['--rietveld_url', GetRietveldServerUrl()])
55 try: 55 try:
56 cl = git_cl.Changelist()
57 change = cl.GetChange(cl.GetUpstreamBranch(), None)
58 # Hack around a limitation in logging. 56 # Hack around a limitation in logging.
59 logging.getLogger().handlers = [] 57 logging.getLogger().handlers = []
60 sys.exit(trychange.TryChange( 58 sys.exit(trychange_git.TryChange_Git(
61 args, change, swallow_exception=False, 59 args, swallow_exception=False,
62 prog='git try', 60 prog='git try',
63 extra_epilog='\n' 61 extra_epilog='\n'
64 'git try will diff against your tracked branch and will ' 62 'git try will diff against your tracked branch and will '
65 'detect your rietveld\n' 63 'detect your rietveld\n'
66 'code review if you are using git-cl\n')) 64 'code review if you are using git-cl\n'))
67 except third_party.upload.ClientLoginError, e: 65 except third_party.upload.ClientLoginError, e:
68 print('Got an exception while trying to log in to Rietveld.') 66 print('Got an exception while trying to log in to Rietveld.')
69 print(str(e)) 67 print(str(e))
70 return 0 68 return 0
71 69
72 70
73 if __name__ == '__main__': 71 if __name__ == '__main__':
74 try: 72 try:
75 sys.exit(main(sys.argv[1:])) 73 sys.exit(main(sys.argv[1:]))
76 except KeyboardInterrupt: 74 except KeyboardInterrupt:
77 sys.stderr.write('interrupted\n') 75 sys.stderr.write('interrupted\n')
78 sys.exit(1) 76 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | tests/trychange_git_unittest.py » ('j') | trychange_git.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698