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

Side by Side Diff: tools/push-to-trunk/merge_to_branch.py

Issue 223753002: Add merged patches to commit title in merge-to-branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 the V8 project authors. All rights reserved. 2 # Copyright 2014 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 self.Die("Cannot determine git hash for r%s" % revision) 127 self.Die("Cannot determine git hash for r%s" % revision)
128 self["patch_commit_hashes"].append(next_hash) 128 self["patch_commit_hashes"].append(next_hash)
129 129
130 # Stringify: [123, 234] -> "r123, r234" 130 # Stringify: [123, 234] -> "r123, r234"
131 self["revision_list"] = ", ".join(map(lambda s: "r%s" % s, 131 self["revision_list"] = ", ".join(map(lambda s: "r%s" % s,
132 self["full_revision_list"])) 132 self["full_revision_list"]))
133 133
134 if not self["revision_list"]: # pragma: no cover 134 if not self["revision_list"]: # pragma: no cover
135 self.Die("Revision list is empty.") 135 self.Die("Revision list is empty.")
136 136
137 if self._options.revert: 137 # The commit message title is added below after the version is specified.
138 if not self._options.revert_bleeding_edge: 138 self["new_commit_msg"] = ""
139 self["new_commit_msg"] = ("Rollback of %s in %s branch."
140 % (self["revision_list"], self["merge_to_branch"]))
141 else:
142 self["new_commit_msg"] = "Revert %s." % self["revision_list"]
143 else:
144 self["new_commit_msg"] = ("Merged %s into %s branch."
145 % (self["revision_list"], self["merge_to_branch"]))
146 self["new_commit_msg"] += "\n\n"
147 139
148 for commit_hash in self["patch_commit_hashes"]: 140 for commit_hash in self["patch_commit_hashes"]:
149 patch_merge_desc = self.GitLog(n=1, format="%s", git_hash=commit_hash) 141 patch_merge_desc = self.GitLog(n=1, format="%s", git_hash=commit_hash)
150 self["new_commit_msg"] += "%s\n\n" % patch_merge_desc 142 self["new_commit_msg"] += "%s\n\n" % patch_merge_desc
151 143
152 bugs = [] 144 bugs = []
153 for commit_hash in self["patch_commit_hashes"]: 145 for commit_hash in self["patch_commit_hashes"]:
154 msg = self.GitLog(n=1, git_hash=commit_hash) 146 msg = self.GitLog(n=1, git_hash=commit_hash)
155 for bug in re.findall(r"^[ \t]*BUG[ \t]*=[ \t]*(.*?)[ \t]*$", msg, 147 for bug in re.findall(r"^[ \t]*BUG[ \t]*=[ \t]*(.*?)[ \t]*$", msg,
156 re.M): 148 re.M):
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 self["version"] = "%s.%s.%s.%s" % (self["new_major"], 198 self["version"] = "%s.%s.%s.%s" % (self["new_major"],
207 self["new_minor"], 199 self["new_minor"],
208 self["new_build"], 200 self["new_build"],
209 self["new_patch"]) 201 self["new_patch"])
210 202
211 203
212 class CommitLocal(Step): 204 class CommitLocal(Step):
213 MESSAGE = "Commit to local branch." 205 MESSAGE = "Commit to local branch."
214 206
215 def RunStep(self): 207 def RunStep(self):
216 if not self._options.revert_bleeding_edge: 208 # Add a commit message title.
217 self["new_commit_msg"] = "Version %s\n\n%s" % (self["version"], 209 if self._options.revert:
218 self["new_commit_msg"]) 210 if not self._options.revert_bleeding_edge:
211 title = ("Version %s (rollback of %s)"
212 % (self["version"], self["revision_list"]))
213 else:
214 title = "Revert %s." % self["revision_list"]
215 else:
216 title = ("Version %s (merged %s)"
217 % (self["version"], self["revision_list"]))
218 self["new_commit_msg"] = "%s\n\n%s" % (title, self["new_commit_msg"])
219 TextToFile(self["new_commit_msg"], self.Config(COMMITMSG_FILE)) 219 TextToFile(self["new_commit_msg"], self.Config(COMMITMSG_FILE))
220 self.GitCommit(file_name=self.Config(COMMITMSG_FILE)) 220 self.GitCommit(file_name=self.Config(COMMITMSG_FILE))
221 221
222 222
223 class CommitRepository(Step): 223 class CommitRepository(Step):
224 MESSAGE = "Commit to the repository." 224 MESSAGE = "Commit to the repository."
225 225
226 def RunStep(self): 226 def RunStep(self):
227 self.GitCheckout(self.Config(BRANCHNAME)) 227 self.GitCheckout(self.Config(BRANCHNAME))
228 self.WaitForLGTM() 228 self.WaitForLGTM()
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 UploadStep, 325 UploadStep,
326 CommitRepository, 326 CommitRepository,
327 PrepareSVN, 327 PrepareSVN,
328 TagRevision, 328 TagRevision,
329 CleanUp, 329 CleanUp,
330 ] 330 ]
331 331
332 332
333 if __name__ == "__main__": # pragma: no cover 333 if __name__ == "__main__": # pragma: no cover
334 sys.exit(MergeToBranch(CONFIG).Run()) 334 sys.exit(MergeToBranch(CONFIG).Run())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698