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

Unified Diff: depot_tools/git_cl_hooks.py

Issue 3345003: If no description is given, use the log messages of all commits for presubmit... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: '' Created 10 years, 4 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: depot_tools/git_cl_hooks.py
===================================================================
--- depot_tools/git_cl_hooks.py (revision 58346)
+++ depot_tools/git_cl_hooks.py (working copy)
@@ -40,19 +40,19 @@
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)
« 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