OLD | NEW |
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 |
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(None)]).strip() | 22 ['config', 'branch.%s.rietveldissue' % GIT.GetBranch('.')], |
| 23 '.').strip() |
23 except subprocess2.CalledProcessError: | 24 except subprocess2.CalledProcessError: |
24 return None | 25 return None |
25 | 26 |
26 | 27 |
27 def GetRietveldPatchsetNumber(): | 28 def GetRietveldPatchsetNumber(): |
28 try: | 29 try: |
29 return GIT.Capture( | 30 return GIT.Capture( |
30 ['config', 'branch.%s.rietveldpatchset' % GIT.GetBranch(None)]).strip() | 31 ['config', 'branch.%s.rietveldpatchset' % GIT.GetBranch('.')], |
| 32 '.').strip() |
31 except subprocess2.CalledProcessError: | 33 except subprocess2.CalledProcessError: |
32 return None | 34 return None |
33 | 35 |
34 | 36 |
35 def GetRietveldServerUrl(): | 37 def GetRietveldServerUrl(): |
36 try: | 38 try: |
37 return GIT.Capture(['config', 'rietveld.server']).strip() | 39 return GIT.Capture(['config', 'rietveld.server'], '.').strip() |
38 except subprocess2.CalledProcessError: | 40 except subprocess2.CalledProcessError: |
39 return None | 41 return None |
40 | 42 |
41 | 43 |
42 if __name__ == '__main__': | 44 if __name__ == '__main__': |
43 args = sys.argv[1:] | 45 args = sys.argv[1:] |
44 patchset = GetRietveldPatchsetNumber() | 46 patchset = GetRietveldPatchsetNumber() |
45 if patchset: | 47 if patchset: |
46 args.extend([ | 48 args.extend([ |
47 '--issue', GetRietveldIssueNumber(), | 49 '--issue', GetRietveldIssueNumber(), |
(...skipping 11 matching lines...) Expand all Loading... |
59 sys.exit(trychange.TryChange( | 61 sys.exit(trychange.TryChange( |
60 args, change, swallow_exception=False, | 62 args, change, swallow_exception=False, |
61 prog='git try', | 63 prog='git try', |
62 extra_epilog='\n' | 64 extra_epilog='\n' |
63 'git try will diff against your tracked branch and will ' | 65 'git try will diff against your tracked branch and will ' |
64 'detect your rietveld\n' | 66 'detect your rietveld\n' |
65 'code review if you are using git-cl\n')) | 67 'code review if you are using git-cl\n')) |
66 except third_party.upload.ClientLoginError, e: | 68 except third_party.upload.ClientLoginError, e: |
67 print('Got an exception while trying to log in to Rietveld.') | 69 print('Got an exception while trying to log in to Rietveld.') |
68 print(str(e)) | 70 print(str(e)) |
OLD | NEW |