 Chromium Code Reviews
 Chromium Code Reviews Issue 1398033003:
  [Release] Update merge script to leverage auto-tag bot  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1398033003:
  [Release] Update merge script to leverage auto-tag bot  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| 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..99bc2e26cac979763f46240ab1daa34e23ac8360 100755 | 
| --- a/tools/release/merge_to_branch.py | 
| +++ b/tools/release/merge_to_branch.py | 
| @@ -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" | 
| 
Michael Achenbach
2015/10/21 12:32:35
Maybe s/Hash/Revision
 
Michael Hablich
2015/10/21 12:41:26
You mean like Hash: 4df56dsssss r12345
?
 
Michael Achenbach
2015/10/21 12:51:17
No I mean literally. Use the more commonly used wo
 
Michael Hablich
2015/10/22 14:25:50
Acknowledged.
 | 
| + 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] | 
| 
Michael Achenbach
2015/10/21 12:32:35
Why not make a pure cherry-pick in case of one com
 
Michael Hablich
2015/10/21 12:41:26
I didn't want to introduce more complexity into th
 
Michael Achenbach
2015/10/21 12:51:17
It offers the full original commit message instead
 
Michael Hablich
2015/10/22 14:25:49
So, I tried cherry-picks on our branches a few tim
 | 
| + 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,12 @@ class MergeToBranch(ScriptsBase): | 
| SearchArchitecturePorts, | 
| CreateCommitMessage, | 
| ApplyPatches, | 
| - PrepareVersion, | 
| - IncrementVersion, | 
| + # PrepareVersion, | 
| 
Michael Achenbach
2015/10/21 12:32:35
nit: Remove the comments.
 
Michael Achenbach
2015/10/21 12:38:37
Done.
 
Michael Hablich
2015/10/21 12:41:26
Done.
 | 
| + # IncrementVersion, | 
| CommitLocal, | 
| UploadStep, | 
| 
Michael Achenbach
2015/10/21 12:32:35
Maybe make the upload step configurable and let it
 
Michael Hablich
2015/10/21 12:41:26
I don't think more configuration will help. 
Addi
 
Michael Achenbach
2015/10/21 12:51:17
I don't care how it would be done technically. But
 | 
| CommitRepository, | 
| - TagRevision, | 
| + # TagRevision, | 
| CleanUp, | 
| ] |