Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index ea1238261dc8c1aa2fe6d30485a13264bd1de242..416f60e48755420c0113d01e6dbc984c41040c81 100644 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -217,6 +217,13 @@ class Settings(object): |
| self.viewvc_url = self._GetConfig('rietveld.viewvc-url', error_ok=True) |
| return self.viewvc_url |
| + def GetRenamedBranch(self, cmd, branch): |
| + rename = self._GetConfig('rietveld.rename-after-%s' % cmd, |
| + error_ok=True) |
|
M-A Ruel
2010/12/22 20:28:21
align either at ( or at +4 from previous line.
sadrul
2010/12/22 20:39:50
Done.
|
| + if rename: |
| + rename = rename.replace('%s', branch) |
| + return rename |
| + |
| def _GetConfig(self, param, **kwargs): |
| self.LazyUpdateIfNeeded() |
| return RunGit(['config', param], **kwargs).strip() |
| @@ -971,6 +978,7 @@ def SendUpstream(parser, args, cmd): |
| # Stuff our change into the merge branch. |
| # We wrap in a try...finally block so if anything goes wrong, |
| # we clean up the branches. |
| + success = False |
|
M-A Ruel
2010/12/22 20:28:21
You could use instead;
retcode = 0
and check for
sadrul
2010/12/22 20:39:50
I set retcode = 1 here so that the branch doesn't
|
| try: |
| RunGit(['checkout', '-q', '-b', MERGE_BRANCH, base_branch]) |
| RunGit(['merge', '--squash', cl.GetBranchRef()]) |
| @@ -983,15 +991,23 @@ def SendUpstream(parser, args, cmd): |
| remote, branch = cl.FetchUpstreamTuple() |
| retcode, output = RunGitWithCode( |
| ['push', '--porcelain', remote, 'HEAD:%s' % branch]) |
| + success = True |
| logging.debug(output) |
| else: |
| # dcommit the merge branch. |
| output = RunGit(['svn', 'dcommit', '--no-rebase']) |
| + success = True |
| + |
| finally: |
| # And then swap back to the original branch and clean up. |
| RunGit(['checkout', '-q', cl.GetBranch()]) |
| RunGit(['branch', '-D', MERGE_BRANCH]) |
| + if success: |
| + rename = settings.GetRenamedBranch(cmd, cl.GetBranch()) |
| + if rename: |
| + RunGit(['branch', '-m', cl.GetBranch(), rename]) |
| + |
| if cl.GetIssue(): |
| if cmd == 'dcommit' and 'Committed r' in output: |
| revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) |