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

Unified Diff: git_cl.py

Issue 7134097: Fix support for AUTHOR presubmit check in git cl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 3ffa9ad7a5e86dc08da05de68a0757837b740164..7e767862acd648b6155018e0acb0de501e779019 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -510,7 +510,8 @@ or verify this branch is set up to track another (via the --track argument to
self.SetPatchset(0)
self.has_issue = False
- def RunHook(self, committing, upstream_branch, tbr, may_prompt, verbose):
+ def RunHook(self, committing, upstream_branch, tbr, may_prompt, verbose,
+ author):
"""Calls sys.exit() if the hook fails; returns a HookResults otherwise."""
root = RunCommand(['git', 'rev-parse', '--show-cdup']).strip() or '.'
absroot = os.path.abspath(root)
@@ -530,6 +531,9 @@ or verify this branch is set up to track another (via the --track argument to
# with these log messages.
description = RunCommand(['git', 'log', '--pretty=format:%s%n%n%b',
'%s...' % (upstream_branch)]).strip()
+
+ if not author:
+ author = RunGit(['config', 'user.email'])
change = presubmit_support.GitChange(
name,
description,
@@ -537,7 +541,7 @@ or verify this branch is set up to track another (via the --track argument to
files,
issue,
patchset,
- None)
+ author)
# Apply watchlists on upload.
if not committing:
@@ -893,7 +897,8 @@ def CMDpresubmit(parser, args):
base_branch = cl.GetUpstreamBranch()
cl.RunHook(committing=not options.upload, upstream_branch=base_branch,
- tbr=False, may_prompt=False, verbose=options.verbose)
+ tbr=False, may_prompt=False, verbose=options.verbose,
+ author=None)
return 0
@@ -939,7 +944,8 @@ def CMDupload(parser, args):
if not options.bypass_hooks and not options.force:
hook_results = cl.RunHook(committing=False, upstream_branch=base_branch,
tbr=False, may_prompt=True,
- verbose=options.verbose)
+ verbose=options.verbose,
+ author=None)
if not options.reviewers and hook_results.reviewers:
options.reviewers = hook_results.reviewers
@@ -1094,7 +1100,8 @@ def SendUpstream(parser, args, cmd):
if not options.bypass_hooks and not options.force:
cl.RunHook(committing=True, upstream_branch=base_branch,
- tbr=options.tbr, may_prompt=True, verbose=options.verbose)
+ tbr=options.tbr, may_prompt=True, verbose=options.verbose,
+ author=options.contributor)
if cmd == 'dcommit':
# Check the tree status if the tree status URL is set.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698