| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # git-cl -- a git-command for integrating reviews on Rietveld | 2 # git-cl -- a git-command for integrating reviews on Rietveld |
| 3 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 3 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
| 4 | 4 |
| 5 import errno | 5 import errno |
| 6 import logging | 6 import logging |
| 7 import optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import subprocess | 10 import subprocess |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 output = RunGit(['svn', 'dcommit', '--no-rebase']) | 987 output = RunGit(['svn', 'dcommit', '--no-rebase']) |
| 988 finally: | 988 finally: |
| 989 # And then swap back to the original branch and clean up. | 989 # And then swap back to the original branch and clean up. |
| 990 RunGit(['checkout', '-q', cl.GetBranch()]) | 990 RunGit(['checkout', '-q', cl.GetBranch()]) |
| 991 RunGit(['branch', '-D', MERGE_BRANCH]) | 991 RunGit(['branch', '-D', MERGE_BRANCH]) |
| 992 | 992 |
| 993 if cl.GetIssue(): | 993 if cl.GetIssue(): |
| 994 if cmd == 'dcommit' and 'Committed r' in output: | 994 if cmd == 'dcommit' and 'Committed r' in output: |
| 995 revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) | 995 revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) |
| 996 elif cmd == 'push' and retcode == 0: | 996 elif cmd == 'push' and retcode == 0: |
| 997 revision = output.splitlines()[1].split('\t')[2].split('..')[1] | 997 m = (re.match(r'.*?([a-f0-9]{7})\.\.([a-f0-9]{7})$', l) |
| 998 for l in output.splitlines(False)) |
| 999 m = filter(None, m) |
| 1000 if not len(m) == 1: |
| 1001 DieWithError("Couldn't parse ouput to extract the committed hash:\n%s" % |
| 1002 output) |
| 1003 revision = m[0].group(2) |
| 998 else: | 1004 else: |
| 999 return 1 | 1005 return 1 |
| 1000 viewvc_url = settings.GetViewVCUrl() | 1006 viewvc_url = settings.GetViewVCUrl() |
| 1001 if viewvc_url and revision: | 1007 if viewvc_url and revision: |
| 1002 cl.description += ('\n\nCommitted: ' + viewvc_url + revision) | 1008 cl.description += ('\n\nCommitted: ' + viewvc_url + revision) |
| 1003 print ('Closing issue ' | 1009 print ('Closing issue ' |
| 1004 '(you may be prompted for your codereview password)...') | 1010 '(you may be prompted for your codereview password)...') |
| 1005 cl.CloseIssue() | 1011 cl.CloseIssue() |
| 1006 cl.SetIssue(0) | 1012 cl.SetIssue(0) |
| 1007 return 0 | 1013 return 0 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1249 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1244 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1250 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 1245 | 1251 |
| 1246 # Not a known command. Default to help. | 1252 # Not a known command. Default to help. |
| 1247 GenUsage(parser, 'help') | 1253 GenUsage(parser, 'help') |
| 1248 return CMDhelp(parser, argv) | 1254 return CMDhelp(parser, argv) |
| 1249 | 1255 |
| 1250 | 1256 |
| 1251 if __name__ == '__main__': | 1257 if __name__ == '__main__': |
| 1252 sys.exit(main(sys.argv[1:])) | 1258 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |