OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env 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 | 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 errno | 10 import errno |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 else: | 1176 else: |
1177 RunGit(['commit', '-m', description]) | 1177 RunGit(['commit', '-m', description]) |
1178 if cmd == 'push': | 1178 if cmd == 'push': |
1179 # push the merge branch. | 1179 # push the merge branch. |
1180 remote, branch = cl.FetchUpstreamTuple() | 1180 remote, branch = cl.FetchUpstreamTuple() |
1181 retcode, output = RunGitWithCode( | 1181 retcode, output = RunGitWithCode( |
1182 ['push', '--porcelain', remote, 'HEAD:%s' % branch]) | 1182 ['push', '--porcelain', remote, 'HEAD:%s' % branch]) |
1183 logging.debug(output) | 1183 logging.debug(output) |
1184 else: | 1184 else: |
1185 # dcommit the merge branch. | 1185 # dcommit the merge branch. |
1186 retcode, output = RunGitWithCode(['svn', 'dcommit', '--no-rebase']) | 1186 retcode, output = RunGitWithCode(['svn', 'dcommit', |
| 1187 '--no-rebase', '--rmdir']) |
1187 finally: | 1188 finally: |
1188 # And then swap back to the original branch and clean up. | 1189 # And then swap back to the original branch and clean up. |
1189 RunGit(['checkout', '-q', cl.GetBranch()]) | 1190 RunGit(['checkout', '-q', cl.GetBranch()]) |
1190 RunGit(['branch', '-D', MERGE_BRANCH]) | 1191 RunGit(['branch', '-D', MERGE_BRANCH]) |
1191 | 1192 |
1192 if cl.GetIssue(): | 1193 if cl.GetIssue(): |
1193 if cmd == 'dcommit' and 'Committed r' in output: | 1194 if cmd == 'dcommit' and 'Committed r' in output: |
1194 revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) | 1195 revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) |
1195 elif cmd == 'push' and retcode == 0: | 1196 elif cmd == 'push' and retcode == 0: |
1196 match = (re.match(r'.*?([a-f0-9]{7})\.\.([a-f0-9]{7})$', l) | 1197 match = (re.match(r'.*?([a-f0-9]{7})\.\.([a-f0-9]{7})$', l) |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1445 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
1445 | 1446 |
1446 # Not a known command. Default to help. | 1447 # Not a known command. Default to help. |
1447 GenUsage(parser, 'help') | 1448 GenUsage(parser, 'help') |
1448 return CMDhelp(parser, argv) | 1449 return CMDhelp(parser, argv) |
1449 | 1450 |
1450 | 1451 |
1451 if __name__ == '__main__': | 1452 if __name__ == '__main__': |
1452 fix_encoding.fix_encoding() | 1453 fix_encoding.fix_encoding() |
1453 sys.exit(main(sys.argv[1:])) | 1454 sys.exit(main(sys.argv[1:])) |
OLD | NEW |