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

Unified Diff: tools/release/common_includes.py

Issue 870903003: Refactor version increment in release scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/release/push_to_candidates.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/release/common_includes.py
diff --git a/tools/release/common_includes.py b/tools/release/common_includes.py
index 40c47b2871e40faac6b75daa8cbfe6ddfd30efc1..65cf8572bb8f204d715786816febda64a41d1016 100644
--- a/tools/release/common_includes.py
+++ b/tools/release/common_includes.py
@@ -47,6 +47,7 @@ from git_recipes import GitFailedException
CHANGELOG_FILE = "ChangeLog"
VERSION_FILE = os.path.join("src", "version.cc")
+VERSION_RE = re.compile(r"^\d+\.\d+\.\d+(?:\.\d+)?$")
# V8 base directory.
V8_BASE = os.path.dirname(
@@ -380,7 +381,7 @@ class Step(GitRecipesMixin):
def __getitem__(self, key):
# Convenience method to allow direct [] access on step classes for
# manipulating the backed state dict.
- return self._state[key]
+ return self._state.get(key)
tandrii(chromium) 2015/01/27 23:59:28 Are you sure there were no code relying on KeyErro
def __setitem__(self, key, value):
# Convenience method to allow direct [] access on step classes for
@@ -589,6 +590,20 @@ class Step(GitRecipesMixin):
except GitFailedException:
self.WaitForResolvingConflicts(patch_file)
+ def GetLatestVersion(self):
+ # Use cached version if available.
+ if self["latest_version"]:
+ return self["latest_version"]
+
+ # Make sure tags are fetched.
+ self.Git("fetch origin +refs/tags/*:refs/tags/*")
+ version_parts = sorted(filter(VERSION_RE.match, self.vc.GetTags()),
+ key=SortingKey, reverse=True)[0].split(".")
+ if len(version_parts) == 3:
+ version_parts.append("0")
+ self["latest_version"] = ".".join(version_parts)
+ return self["latest_version"]
+
def FindLastCandidatesPush(
self, parent_hash="", branch="", include_patches=False):
push_pattern = "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*"
« no previous file with comments | « no previous file | tools/release/push_to_candidates.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698