Chromium Code Reviews| Index: tools/release/merge_to_branch.py |
| diff --git a/tools/release/merge_to_branch.py b/tools/release/merge_to_branch.py |
| index 699fe1b3c66dbc5fc67970616eb811136ecad844..0b2513d6540a065c4fcb400e1662c473ace92b55 100755 |
| --- a/tools/release/merge_to_branch.py |
| +++ b/tools/release/merge_to_branch.py |
| @@ -74,7 +74,7 @@ class SearchArchitecturePorts(Step): |
| for revision in self["full_revision_list"]: |
| # Search for commits which matches the "Port XXX" pattern. |
| git_hashes = self.GitLog(reverse=True, format="%H", |
| - grep="Port %s" % revision, |
| + grep="^[P,p]ort %s" % revision, |
|
Michael Achenbach
2015/10/21 12:38:37
Does there really need to be a comma in the charac
Michael Hablich
2015/10/22 14:25:50
Done.
|
| branch=self.vc.RemoteMasterBranch()) |
| for git_hash in git_hashes.splitlines(): |
| revision_title = self.GitLog(n=1, format="%s", git_hash=git_hash) |
| @@ -99,6 +99,12 @@ class SearchArchitecturePorts(Step): |
| class CreateCommitMessage(Step): |
| MESSAGE = "Create commit message." |
| + def _create_commit_description(self, commit_hash): |
| + patch_merge_desc = self.GitLog(n=1, format="%s", git_hash=commit_hash) |
| + description = "Merged: " + patch_merge_desc + "\n" |
| + description = description + "Hash: " + commit_hash + "\n\n" |
| + return description |
| + |
| def RunStep(self): |
| # Stringify: ["abcde", "12345"] -> "abcde, 12345" |
| @@ -107,17 +113,18 @@ class CreateCommitMessage(Step): |
| if not self["revision_list"]: # pragma: no cover |
| self.Die("Revision list is empty.") |
| - action_text = "Merged %s" |
| + msg_pieces = [] |
| - # The commit message title is added below after the version is specified. |
| - msg_pieces = [ |
| - "\n".join(action_text % s for s in self["full_revision_list"]), |
| - ] |
| - msg_pieces.append("\n\n") |
| + if len(self["full_revision_list"]) > 1: |
| + self["commit_title"] = "Merged: Squashed multiple commits." |
| + else: |
| + commit_hash = self["full_revision_list"][0] |
| + patch_merge_desc = self.GitLog(n=1, format="%s", git_hash=commit_hash) |
| + title = "Merged: " + patch_merge_desc |
| + self["commit_title"] = title |
| for commit_hash in self["full_revision_list"]: |
| - patch_merge_desc = self.GitLog(n=1, format="%s", git_hash=commit_hash) |
| - msg_pieces.append("%s\n\n" % patch_merge_desc) |
| + msg_pieces.append(self._create_commit_description(commit_hash)) |
| bugs = [] |
| for commit_hash in self["full_revision_list"]: |
| @@ -144,44 +151,11 @@ class ApplyPatches(Step): |
| if self._options.patch: |
| self.ApplyPatch(self._options.patch) |
| - |
| -class PrepareVersion(Step): |
| - MESSAGE = "Prepare version file." |
| - |
| - def RunStep(self): |
| - # This is used to calculate the patch level increment. |
| - self.ReadAndPersistVersion() |
| - |
| - |
| -class IncrementVersion(Step): |
| - MESSAGE = "Increment version number." |
| - |
| - def RunStep(self): |
| - new_patch = str(int(self["patch"]) + 1) |
| - if self.Confirm("Automatically increment V8_PATCH_LEVEL? (Saying 'n' will " |
| - "fire up your EDITOR on %s so you can make arbitrary " |
| - "changes. When you're done, save the file and exit your " |
| - "EDITOR.)" % VERSION_FILE): |
| - text = FileToText(os.path.join(self.default_cwd, VERSION_FILE)) |
| - text = MSub(r"(?<=#define V8_PATCH_LEVEL)(?P<space>\s+)\d*$", |
| - r"\g<space>%s" % new_patch, |
| - text) |
| - TextToFile(text, os.path.join(self.default_cwd, VERSION_FILE)) |
| - else: |
| - self.Editor(os.path.join(self.default_cwd, VERSION_FILE)) |
| - self.ReadAndPersistVersion("new_") |
| - self["version"] = "%s.%s.%s.%s" % (self["new_major"], |
| - self["new_minor"], |
| - self["new_build"], |
| - self["new_patch"]) |
| - |
| - |
| class CommitLocal(Step): |
| MESSAGE = "Commit to local branch." |
| def RunStep(self): |
| # Add a commit message title. |
| - self["commit_title"] = "Version %s (cherry-pick)" % self["version"] |
| self["new_commit_msg"] = "%s\n\n%s" % (self["commit_title"], |
| self["new_commit_msg"]) |
| TextToFile(self["new_commit_msg"], self.Config("COMMITMSG_FILE")) |
| @@ -197,17 +171,6 @@ class CommitRepository(Step): |
| self.GitPresubmit() |
| self.vc.CLLand() |
| - |
| -class TagRevision(Step): |
| - MESSAGE = "Create the tag." |
| - |
| - def RunStep(self): |
| - print "Creating tag %s" % self["version"] |
| - self.vc.Tag(self["version"], |
| - self.vc.RemoteBranch(self["merge_to_branch"]), |
| - self["commit_title"]) |
| - |
| - |
| class CleanUp(Step): |
| MESSAGE = "Cleanup." |
| @@ -276,12 +239,9 @@ class MergeToBranch(ScriptsBase): |
| SearchArchitecturePorts, |
| CreateCommitMessage, |
| ApplyPatches, |
| - PrepareVersion, |
| - IncrementVersion, |
| CommitLocal, |
| UploadStep, |
| CommitRepository, |
| - TagRevision, |
| CleanUp, |
| ] |