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
experimental/szager/collated-output
jochen@chromium.org 15 years ago
parent 9806750e14
commit b96b92f662

@ -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)

Loading…
Cancel
Save