Commit b96b92f6 authored by jochen@chromium.org's avatar jochen@chromium.org

If no description is given, use the log messages of all commits for presubmit checks.

BUG=54240
TEST=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@58353 0039d316-1c4b-4281-b951-d872f2087c98
parent 9806750e
......@@ -40,19 +40,19 @@ class ChangeOptions:
absroot = os.path.abspath(root)
if not root:
raise Exception("Could not get root directory.")
log = Backquote(['git', 'show', '--name-only',
'--pretty=format:%H%n%s%n%n%b'])
m = re.match(r'^(\w+)\n(.*)$', log, re.MULTILINE|re.DOTALL)
if not m:
raise Exception("Could not parse log message: %s" % log)
name = m.group(1)
# We use the sha1 of HEAD as a name of this change.
name = Backquote(['git', 'rev-parse', 'HEAD'])
files = scm.GIT.CaptureStatus([root], upstream_branch)
issue = BackquoteAsInteger(['git', 'cl', 'status', '--field=id'])
patchset = BackquoteAsInteger(['git', 'cl', 'status', '--field=patch'])
if issue:
description = Backquote(['git', 'cl', 'status', '--field=desc'])
else:
description = m.group(2)
# If the change was never uploaded, use the log messages of all commits
# up to the branch point, as git cl upload will prefill the description
# with these log messages.
description = Backquote(['git', 'log', '--pretty=format:%s%n%n%b',
'%s...' % (upstream_branch)])
self.change = presubmit_support.GitChange(name, description, absroot, files,
issue, patchset)
......
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