(self)
| 30 | MESSAGE = "Increment version number." |
| 31 | |
| 32 | def RunStep(self): |
| 33 | latest_version = self.GetLatestVersion() |
| 34 | |
| 35 | # The version file on main can be used to bump up major/minor at |
| 36 | # branch time. |
| 37 | self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteMainBranch()) |
| 38 | self.ReadAndPersistVersion("main_") |
| 39 | main_version = self.ArrayToVersion("main_") |
| 40 | |
| 41 | # Use the highest version from main or from tags to determine the new |
| 42 | # version. |
| 43 | authoritative_version = sorted( |
| 44 | [main_version, latest_version], key=LooseVersion)[1] |
| 45 | self.StoreVersion(authoritative_version, "authoritative_") |
| 46 | |
| 47 | # Variables prefixed with 'new_' contain the new version numbers for the |
| 48 | # ongoing candidates push. |
| 49 | self["new_major"] = self["authoritative_major"] |
| 50 | self["new_minor"] = self["authoritative_minor"] |
| 51 | self["new_build"] = str(int(self["authoritative_build"]) + 1) |
| 52 | |
| 53 | # Make sure patch level is 0 in a new push. |
| 54 | self["new_patch"] = "0" |
| 55 | |
| 56 | # The new version is not a candidate. |
| 57 | self["new_candidate"] = "0" |
| 58 | |
| 59 | self["version"] = "%s.%s.%s" % (self["new_major"], |
| 60 | self["new_minor"], |
| 61 | self["new_build"]) |
| 62 | |
| 63 | print ("Incremented version to %s" % self["version"]) |
| 64 | |
| 65 | |
| 66 | class DetectLastRelease(Step): |
nothing calls this directly
no test coverage detected