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

Unified Diff: tools/push-to-trunk/common_includes.py

Issue 61263011: Refactor ChangeLog generation for push-to-trunk script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 | tools/push-to-trunk/push_to_trunk.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/common_includes.py
diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py
index eb2bfb07b3549838395dbc363b62d52db9383656..669aa6be1f4362d8113b73af86e8057d8f6cb134 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -75,6 +75,34 @@ def GetLastChangeLogEntries(change_log_file):
return "".join(result)
+def MakeChangeLogBody(commit_generator):
+ result = ""
+ for (title, body, author) in commit_generator():
+ # Add the commit's title line.
+ result += "%s\n" % title.rstrip()
+
+ # Grep for "BUG=xxxx" lines in the commit message and convert them to
+ # "(issue xxxx)".
+ out = body.splitlines()
+ out = filter(lambda x: re.search(r"^BUG=", x), out)
+ out = filter(lambda x: not re.search(r"BUG=$", x), out)
+ out = filter(lambda x: not re.search(r"BUG=none$", x), out)
+
+ # TODO(machenbach): Handle multiple entries (e.g. BUG=123, 234).
+ def FormatIssue(text):
+ text = re.sub(r"BUG=v8:(.*)$", r"(issue \1)", text)
+ text = re.sub(r"BUG=chromium:(.*)$", r"(Chromium issue \1)", text)
+ text = re.sub(r"BUG=(.*)$", r"(Chromium issue \1)", text)
+ return " %s\n" % text
+
+ for line in map(FormatIssue, out):
+ result += line
+
+ # Append the commit's author for reference.
+ result += "%s\n\n" % author.rstrip()
+ return result
+
+
# Some commands don't like the pipe, e.g. calling vi from within the script or
# from subscripts like git cl upload.
def Command(cmd, args="", prefix="", pipe=True):
« no previous file with comments | « no previous file | tools/push-to-trunk/push_to_trunk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698