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

Unified Diff: tools/release/push_to_candidates.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
Index: tools/release/push_to_candidates.py
diff --git a/tools/release/push_to_candidates.py b/tools/release/push_to_candidates.py
index 9da0fde1a0a62a6132f8f37abad9f1f1eb032448..6f71a5b851ede917dcd2447f4ae2c2b90a1e5a1e 100755
--- a/tools/release/push_to_candidates.py
+++ b/tools/release/push_to_candidates.py
@@ -45,9 +45,6 @@ class Preparation(Step):
self.InitialEnvironmentChecks(self.default_cwd)
self.CommonPrepare()
- # Make sure tags are fetched.
- self.Git("fetch origin +refs/tags/*:refs/tags/*")
-
if(self["current_branch"] == self.Config("CANDIDATESBRANCH")
or self["current_branch"] == self.Config("BRANCHNAME")):
print "Warning: Script started on branch %s" % self["current_branch"]
@@ -114,37 +111,29 @@ class DetectLastPush(Step):
self["last_push_master"] = last_push_master
-class GetLatestVersion(Step):
- MESSAGE = "Get latest version from tags."
+class IncrementVersion(Step):
+ MESSAGE = "Increment version number."
def RunStep(self):
- versions = sorted(filter(VERSION_RE.match, self.vc.GetTags()),
- key=SortingKey, reverse=True)
- self.StoreVersion(versions[0], "latest_")
- self["latest_version"] = self.ArrayToVersion("latest_")
+ latest_version = self.GetLatestVersion()
# The version file on master can be used to bump up major/minor at
# branch time.
self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteMasterBranch())
self.ReadAndPersistVersion("master_")
- self["master_version"] = self.ArrayToVersion("master_")
-
- if SortingKey(self["master_version"]) > SortingKey(self["latest_version"]):
- self["latest_version"] = self["master_version"]
- self.StoreVersion(self["latest_version"], "latest_")
-
- print "Determined latest version %s" % self["latest_version"]
+ master_version = self.ArrayToVersion("master_")
+ # Use the highest version from master or from tags to determine the new
+ # version.
+ authoritative_version = sorted(
+ [master_version, latest_version], key=SortingKey)[1]
+ self.StoreVersion(authoritative_version, "authoritative_")
-class IncrementVersion(Step):
- MESSAGE = "Increment version number."
-
- def RunStep(self):
# Variables prefixed with 'new_' contain the new version numbers for the
# ongoing candidates push.
- self["new_major"] = self["latest_major"]
- self["new_minor"] = self["latest_minor"]
- self["new_build"] = str(int(self["latest_build"]) + 1)
+ self["new_major"] = self["authoritative_major"]
+ self["new_minor"] = self["authoritative_minor"]
+ self["new_build"] = str(int(self["authoritative_build"]) + 1)
# Make sure patch level is 0 in a new push.
self["new_patch"] = "0"
@@ -153,6 +142,8 @@ class IncrementVersion(Step):
self["new_minor"],
self["new_build"])
+ print ("Incremented version to %s" % self["version"])
+
class PrepareChangeLog(Step):
MESSAGE = "Prepare raw ChangeLog entry."
@@ -429,7 +420,6 @@ class PushToCandidates(ScriptsBase):
FreshBranch,
PreparePushRevision,
DetectLastPush,
- GetLatestVersion,
IncrementVersion,
PrepareChangeLog,
EditChangeLog,

Powered by Google App Engine
This is Rietveld 408576698