Commit 13f623ca authored by maruel@chromium.org's avatar maruel@chromium.org

Fix git-cl --contributor flag support for presubmit checks.

Chromium's presubmit check assumes the author is an email address.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/7484002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@93645 0039d316-1c4b-4281-b951-d872f2087c98
parent 4dd09375
...@@ -532,7 +532,7 @@ or verify this branch is set up to track another (via the --track argument to ...@@ -532,7 +532,7 @@ or verify this branch is set up to track another (via the --track argument to
'%s...' % (upstream_branch)]).strip() '%s...' % (upstream_branch)]).strip()
if not author: if not author:
author = RunGit(['config', 'user.email']).strip() author = RunGit(['config', 'user.email']).strip() or None
change = presubmit_support.GitChange( change = presubmit_support.GitChange(
name, name,
description, description,
...@@ -1064,6 +1064,11 @@ def SendUpstream(parser, args, cmd): ...@@ -1064,6 +1064,11 @@ def SendUpstream(parser, args, cmd):
# Default to merging against our best guess of the upstream branch. # Default to merging against our best guess of the upstream branch.
args = [cl.GetUpstreamBranch()] args = [cl.GetUpstreamBranch()]
if options.contributor:
if not re.match('^.*\s<\S+@\S+>$', options.contributor):
print "Please provide contibutor as 'First Last <email@example.com>'"
return 1
base_branch = args[0] base_branch = args[0]
# Make sure index is up-to-date before running diff-index. # Make sure index is up-to-date before running diff-index.
...@@ -1095,9 +1100,12 @@ def SendUpstream(parser, args, cmd): ...@@ -1095,9 +1100,12 @@ def SendUpstream(parser, args, cmd):
return 1 return 1
if not options.bypass_hooks and not options.force: if not options.bypass_hooks and not options.force:
author = None
if options.contributor:
author = re.search(r'\<(.*)\>', options.contributor).group(1)
cl.RunHook(committing=True, upstream_branch=base_branch, cl.RunHook(committing=True, upstream_branch=base_branch,
may_prompt=True, verbose=options.verbose, may_prompt=True, verbose=options.verbose,
author=options.contributor) author=author)
if cmd == 'dcommit': if cmd == 'dcommit':
# Check the tree status if the tree status URL is set. # Check the tree status if the tree status URL is set.
...@@ -1123,9 +1131,6 @@ def SendUpstream(parser, args, cmd): ...@@ -1123,9 +1131,6 @@ def SendUpstream(parser, args, cmd):
description += "\n\nReview URL: %s" % cl.GetIssueURL() description += "\n\nReview URL: %s" % cl.GetIssueURL()
if options.contributor: if options.contributor:
if not re.match('^.*\s<\S+@\S+>$', options.contributor):
print "Please provide contibutor as 'First Last <email@example.com>'"
return 1
description += "\nPatch from %s." % options.contributor description += "\nPatch from %s." % options.contributor
print 'Description:', repr(description) print 'Description:', repr(description)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment