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

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

Issue 670263004: Switch push-to-trunk to git mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Switch the tests to git. Created 6 years, 2 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 | 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 b22c900aa258bb24d9186edff6dbc1869bd6df71..ea481e0f3eaeb10ef3d0bb351c2f09bebaae6fd9 100755
--- a/tools/push-to-trunk/push_to_trunk.py
+++ b/tools/push-to-trunk/push_to_trunk.py
@@ -34,8 +34,9 @@ import urllib2
from common_includes import *
-PUSH_MESSAGE_SUFFIX = " (based on bleeding_edge revision r%d)"
-PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$")
+PUSH_MSG_SVN_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$")
+PUSH_MSG_GIT_SUFFIX = " (based on %s)"
+PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$")
class Preparation(Step):
MESSAGE = "Preparation."
@@ -65,7 +66,7 @@ class PreparePushRevision(Step):
def RunStep(self):
if self._options.revision:
- self["push_hash"] = self.vc.SvnGit(self._options.revision)
+ self["push_hash"] = self._options.revision
else:
self["push_hash"] = self.GitLog(n=1, format="%H", git_hash="HEAD")
if not self["push_hash"]: # pragma: no cover
@@ -92,16 +93,24 @@ class DetectLastPush(Step):
# Retrieve the bleeding edge revision of the last push from the text in
# the push commit message.
last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push)
- last_push_be_svn = PUSH_MESSAGE_RE.match(last_push_title).group(1)
- if not last_push_be_svn: # pragma: no cover
- self.Die("Could not retrieve bleeding edge revision for trunk push %s"
- % last_push)
- last_push_bleeding_edge = self.vc.SvnGit(last_push_be_svn)
+ # TODO(machenbach): This is only needed for the git transition. Can be
+ # removed after one successful trunk push.
+ match = PUSH_MSG_SVN_RE.match(last_push_title)
+ if match:
+ last_push_be_svn = match.group(1)
+ if not last_push_be_svn: # pragma: no cover
+ self.Die("Could not retrieve bleeding edge rev for trunk push %s"
+ % last_push)
+ last_push_bleeding_edge = self.vc.SvnGit(last_push_be_svn)
+ else:
+ last_push_bleeding_edge = PUSH_MSG_GIT_RE.match(
+ last_push_title).group("git_rev")
+
if not last_push_bleeding_edge: # pragma: no cover
self.Die("Could not retrieve bleeding edge git hash for trunk push %s"
% last_push)
- # This points to the svn revision of the last push on trunk.
+ # This points to the git hash of the last push on trunk.
self["last_push_trunk"] = last_push
# This points to the last bleeding_edge revision that went into the last
# push.
@@ -270,10 +279,8 @@ class SquashCommits(Step):
# Remove date and trailing white space.
text = re.sub(r"^%s: " % self["date"], "", text.rstrip())
- # Retrieve svn revision for showing the used bleeding edge revision in the
- # commit message.
- self["svn_revision"] = self.vc.GitSvn(self["push_hash"])
- suffix = PUSH_MESSAGE_SUFFIX % int(self["svn_revision"])
+ # Show the used master hash in the commit message.
+ suffix = PUSH_MSG_GIT_SUFFIX % self["push_hash"]
text = MSub(r"^(Version \d+\.\d+\.\d+)$", "\\1%s" % suffix, text)
# Remove indentation and merge paragraphs into single long lines, keeping
@@ -395,7 +402,7 @@ class PushToTrunk(ScriptsBase):
parser.add_argument("-l", "--last-push",
help="The git commit ID of the last push to trunk.")
parser.add_argument("-R", "--revision",
- help="The svn revision to push (defaults to HEAD).")
+ help="The git commit ID to push (defaults to HEAD).")
def _ProcessOptions(self, options): # pragma: no cover
if not options.manual and not options.reviewer:
@@ -404,10 +411,6 @@ class PushToTrunk(ScriptsBase):
if not options.manual and not options.author:
print "Specify your chromium.org email with -a in (semi-)automatic mode."
return False
- if options.revision and not int(options.revision) > 0:
- print("The --revision flag must be a positiv integer pointing to a "
- "valid svn revision.")
- return False
options.tbr_commit = not options.manual
return True
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698