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

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

Issue 83603002: Improve and refactor push-to-trunk script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Presubmit correction. 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 | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/push_to_trunk.py
diff --git a/tools/push-to-trunk/push_to_trunk.py b/tools/push-to-trunk/push_to_trunk.py
index 24dfb676805a29cbdca11166c3fdfe71e9c338b5..d78aacbd2b6202170335fb8069fa9ea0858eddd9 100755
--- a/tools/push-to-trunk/push_to_trunk.py
+++ b/tools/push-to-trunk/push_to_trunk.py
@@ -30,6 +30,7 @@ import datetime
import optparse
import sys
import tempfile
+import urllib2
from common_includes import *
@@ -91,6 +92,21 @@ class DetectLastPush(Step):
class PrepareChangeLog(Step):
MESSAGE = "Prepare raw ChangeLog entry."
+ def Reload(self, body):
+ """Attempts to reload the commit message from rietveld in order to allow
+ late changes to the LOG flag. Note: This is brittle to future changes of
+ the web page name or structure.
+ """
+ match = re.search(r"^Review URL: https://codereview\.chromium\.org/(\d+)$",
+ body, flags=re.M)
+ if match:
+ cl_url = "https://codereview.chromium.org/%s/description" % match.group(1)
+ try:
+ body = self.ReadURL(cl_url)
+ except urllib2.URLError:
+ pass
+ return body
+
def RunStep(self):
self.RestoreIfUnset("last_push")
@@ -112,7 +128,7 @@ class PrepareChangeLog(Step):
commit_messages = [
[
self.Git("log -1 %s --format=\"%%s\"" % commit),
- self.Git("log -1 %s --format=\"%%B\"" % commit),
+ self.Reload(self.Git("log -1 %s --format=\"%%B\"" % commit)),
self.Git("log -1 %s --format=\"%%an\"" % commit),
] for commit in commits.splitlines()
]
@@ -151,6 +167,7 @@ class EditChangeLog(Step):
changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip()
changelog_entry = StripComments(changelog_entry)
changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines()))
+ changelog_entry = changelog_entry.lstrip()
if changelog_entry == "":
self.Die("Empty ChangeLog entry.")
@@ -541,6 +558,12 @@ def ProcessOptions(options):
if options.s < 0:
print "Bad step number %d" % options.s
return False
+ if options.f and not options.r:
+ print "A reviewer (-r) is required in forced mode."
+ return False
+ if options.f and not options.c:
+ print "A chromium checkout (-c) is required in forced mode."
+ return False
return True
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698