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

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

Issue 389353003: Add script to bump up version on bleeding edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | « tools/push-to-trunk/bump_up_version.py ('k') | tools/push-to-trunk/git_recipes.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 4dfb6d7d279449d7dfcc5c2f1e6dc66562899004..6dbb3f06ebbbc45f66fd73512ba9050449a3f75b 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -171,6 +171,16 @@ def MakeChangeLogBugReference(body):
return ""
+def SortingKey(version):
+ """Key for sorting version number strings: '3.11' > '3.2.1.1'"""
+ version_keys = map(int, version.split("."))
+ # Fill up to full version numbers to normalize comparison.
+ while len(version_keys) < 4: # pragma: no cover
+ version_keys.append(0)
+ # Fill digits.
+ return ".".join(map("{0:04d}".format, version_keys))
+
+
# 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):
@@ -369,7 +379,7 @@ class Step(GitRecipesMixin):
def DeleteBranch(self, name):
for line in self.GitBranch().splitlines():
- if re.match(r".*\s+%s$" % name, line):
+ if re.match(r"\*?\s*%s$" % re.escape(name), line):
msg = "Branch %s exists, do you want to delete it?" % name
if self.Confirm(msg):
self.GitDeleteBranch(name)
@@ -467,6 +477,25 @@ class Step(GitRecipesMixin):
return self.GitLog(n=1, format="%H", grep=push_pattern,
parent_hash=parent_hash, branch=branch)
+ def ArrayToVersion(self, prefix):
+ return ".".join([self[prefix + "major"],
+ self[prefix + "minor"],
+ self[prefix + "build"],
+ self[prefix + "patch"]])
+
+ def SetVersion(self, version_file, prefix):
+ output = ""
+ for line in FileToText(version_file).splitlines():
+ if line.startswith("#define MAJOR_VERSION"):
+ line = re.sub("\d+$", self[prefix + "major"], line)
+ elif line.startswith("#define MINOR_VERSION"):
+ line = re.sub("\d+$", self[prefix + "minor"], line)
+ elif line.startswith("#define BUILD_NUMBER"):
+ line = re.sub("\d+$", self[prefix + "build"], line)
+ elif line.startswith("#define PATCH_LEVEL"):
+ line = re.sub("\d+$", self[prefix + "patch"], line)
+ output += "%s\n" % line
+ TextToFile(output, version_file)
class UploadStep(Step):
MESSAGE = "Upload for code review."
« no previous file with comments | « tools/push-to-trunk/bump_up_version.py ('k') | tools/push-to-trunk/git_recipes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698