Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: git_cl/git_cl.py

Issue 5972005: Add support for post-dcommit hooks (Closed) Base URL: http://git.chromium.org/git/git-cl.git@master
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | git_cl/test/post-dcommit-hook-test.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl/git_cl.py
===================================================================
--- git_cl/git_cl.py (revision 70941)
+++ git_cl/git_cl.py (working copy)
@@ -29,6 +29,7 @@
DEFAULT_SERVER = 'http://codereview.appspot.com'
PREDCOMMIT_HOOK = '.git/hooks/pre-cl-dcommit'
+POSTUPSTREAM_HOOK_PATTERN = '.git/hooks/post-cl-%s'
PREUPLOAD_HOOK = '.git/hooks/pre-cl-upload'
DESCRIPTION_BACKUP_FILE = '~/.git_cl_description_backup'
@@ -973,6 +974,7 @@
# 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()])
@@ -988,7 +990,7 @@
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()])
@@ -1008,6 +1010,11 @@
'(you may be prompted for your codereview password)...')
cl.CloseIssue()
cl.SetIssue(0)
+
+ if retcode == 0:
+ hook = POSTUPSTREAM_HOOK_PATTERN % cmd
+ RunHook(hook, upstream_branch=base_branch, error_ok=True)
+
return 0
« no previous file with comments | « no previous file | git_cl/test/post-dcommit-hook-test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698