Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index ea1238261dc8c1aa2fe6d30485a13264bd1de242..d0419bcf7162b9f846d3b1f969b0a68ad503a3cd 100644 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -29,6 +29,7 @@ except ImportError: |
| DEFAULT_SERVER = 'http://codereview.appspot.com' |
| PREDCOMMIT_HOOK = '.git/hooks/pre-cl-dcommit' |
| +POSTDCOMMIT_HOOK = '.git/hooks/post-cl-dcommit' |
| PREUPLOAD_HOOK = '.git/hooks/pre-cl-upload' |
| DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup' |
| @@ -971,6 +972,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. |
| + retcode = -1 |
| try: |
| RunGit(['checkout', '-q', '-b', MERGE_BRANCH, base_branch]) |
| RunGit(['merge', '--squash', cl.GetBranchRef()]) |
| @@ -986,12 +988,15 @@ def SendUpstream(parser, args, cmd): |
| logging.debug(output) |
| else: |
| # dcommit the merge branch. |
| - output = RunGit(['svn', 'dcommit', '--no-rebase']) |
| + retcode, output = RunGitWithCode(['svn', 'dcommit', '--no-rebase']) |
| finally: |
| # And then swap back to the original branch and clean up. |
| RunGit(['checkout', '-q', cl.GetBranch()]) |
| RunGit(['branch', '-D', MERGE_BRANCH]) |
| + if retcode == 0 and os.path.isfile(POSTDCOMMIT_HOOK): |
|
Evan Martin
2010/12/23 00:32:07
My point was that you don't need to check retcode
sadrul
2010/12/23 00:41:32
Ah. I wasn't sure if that would always be the case
|
| + RunHook(POSTDCOMMIT_HOOK, upstream_branch=base_branch, error_ok=True) |
| + |
| if cl.GetIssue(): |
| if cmd == 'dcommit' and 'Committed r' in output: |
| revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) |