OLD | NEW |
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 from distutils.version import LooseVersion | 10 from distutils.version import LooseVersion |
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 elif IsGitVersionAtLeast('1.7.12'): | 2363 elif IsGitVersionAtLeast('1.7.12'): |
2364 cmd.append('--3way') | 2364 cmd.append('--3way') |
2365 try: | 2365 try: |
2366 subprocess2.check_call(cmd, env=GetNoGitPagerEnv(), | 2366 subprocess2.check_call(cmd, env=GetNoGitPagerEnv(), |
2367 stdin=patch_data, stdout=subprocess2.VOID) | 2367 stdin=patch_data, stdout=subprocess2.VOID) |
2368 except subprocess2.CalledProcessError: | 2368 except subprocess2.CalledProcessError: |
2369 DieWithError('Failed to apply the patch') | 2369 DieWithError('Failed to apply the patch') |
2370 | 2370 |
2371 # If we had an issue, commit the current state and register the issue. | 2371 # If we had an issue, commit the current state and register the issue. |
2372 if not nocommit: | 2372 if not nocommit: |
2373 RunGit(['commit', '-m', 'patch from issue %s' % issue]) | 2373 RunGit(['commit', '-m', ('patch from issue %(i)s at patchset ' |
| 2374 '%(p)s (http://crrev.com/%(i)s#ps%(p)s)' |
| 2375 % {'i': issue, 'p': patchset})]) |
2374 cl = Changelist() | 2376 cl = Changelist() |
2375 cl.SetIssue(issue) | 2377 cl.SetIssue(issue) |
2376 cl.SetPatchset(patchset) | 2378 cl.SetPatchset(patchset) |
2377 print "Committed patch locally." | 2379 print "Committed patch locally." |
2378 else: | 2380 else: |
2379 print "Patch applied to index." | 2381 print "Patch applied to index." |
2380 return 0 | 2382 return 0 |
2381 | 2383 |
2382 | 2384 |
2383 def CMDrebase(parser, args): | 2385 def CMDrebase(parser, args): |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2889 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
2888 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2890 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
2889 | 2891 |
2890 | 2892 |
2891 if __name__ == '__main__': | 2893 if __name__ == '__main__': |
2892 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2894 # These affect sys.stdout so do it outside of main() to simplify mocks in |
2893 # unit testing. | 2895 # unit testing. |
2894 fix_encoding.fix_encoding() | 2896 fix_encoding.fix_encoding() |
2895 colorama.init() | 2897 colorama.init() |
2896 sys.exit(main(sys.argv[1:])) | 2898 sys.exit(main(sys.argv[1:])) |
OLD | NEW |