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

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

Issue 591783003: Refactoring: Remove more legacy from release scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Read version file relative to cwd. Created 6 years, 3 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
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 23 matching lines...) Expand all
34 34
35 ALREADY_MERGING_SENTINEL_FILE = "ALREADY_MERGING_SENTINEL_FILE" 35 ALREADY_MERGING_SENTINEL_FILE = "ALREADY_MERGING_SENTINEL_FILE"
36 COMMIT_HASHES_FILE = "COMMIT_HASHES_FILE" 36 COMMIT_HASHES_FILE = "COMMIT_HASHES_FILE"
37 TEMPORARY_PATCH_FILE = "TEMPORARY_PATCH_FILE" 37 TEMPORARY_PATCH_FILE = "TEMPORARY_PATCH_FILE"
38 38
39 CONFIG = { 39 CONFIG = {
40 BRANCHNAME: "prepare-merge", 40 BRANCHNAME: "prepare-merge",
41 PERSISTFILE_BASENAME: "/tmp/v8-merge-to-branch-tempfile", 41 PERSISTFILE_BASENAME: "/tmp/v8-merge-to-branch-tempfile",
42 ALREADY_MERGING_SENTINEL_FILE: 42 ALREADY_MERGING_SENTINEL_FILE:
43 "/tmp/v8-merge-to-branch-tempfile-already-merging", 43 "/tmp/v8-merge-to-branch-tempfile-already-merging",
44 VERSION_FILE: "src/version.cc",
45 TEMPORARY_PATCH_FILE: "/tmp/v8-prepare-merge-tempfile-temporary-patch", 44 TEMPORARY_PATCH_FILE: "/tmp/v8-prepare-merge-tempfile-temporary-patch",
46 COMMITMSG_FILE: "/tmp/v8-prepare-merge-tempfile-commitmsg", 45 COMMITMSG_FILE: "/tmp/v8-prepare-merge-tempfile-commitmsg",
47 COMMIT_HASHES_FILE: "/tmp/v8-merge-to-branch-tempfile-PATCH_COMMIT_HASHES", 46 COMMIT_HASHES_FILE: "/tmp/v8-merge-to-branch-tempfile-PATCH_COMMIT_HASHES",
48 } 47 }
49 48
50 49
51 class Preparation(Step): 50 class Preparation(Step):
52 MESSAGE = "Preparation." 51 MESSAGE = "Preparation."
53 52
54 def RunStep(self): 53 def RunStep(self):
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 class IncrementVersion(Step): 176 class IncrementVersion(Step):
178 MESSAGE = "Increment version number." 177 MESSAGE = "Increment version number."
179 178
180 def RunStep(self): 179 def RunStep(self):
181 if self._options.revert_bleeding_edge: 180 if self._options.revert_bleeding_edge:
182 return 181 return
183 new_patch = str(int(self["patch"]) + 1) 182 new_patch = str(int(self["patch"]) + 1)
184 if self.Confirm("Automatically increment PATCH_LEVEL? (Saying 'n' will " 183 if self.Confirm("Automatically increment PATCH_LEVEL? (Saying 'n' will "
185 "fire up your EDITOR on %s so you can make arbitrary " 184 "fire up your EDITOR on %s so you can make arbitrary "
186 "changes. When you're done, save the file and exit your " 185 "changes. When you're done, save the file and exit your "
187 "EDITOR.)" % self.Config(VERSION_FILE)): 186 "EDITOR.)" % VERSION_FILE):
188 text = FileToText(self.Config(VERSION_FILE)) 187 text = FileToText(os.path.join(self.default_cwd, VERSION_FILE))
189 text = MSub(r"(?<=#define PATCH_LEVEL)(?P<space>\s+)\d*$", 188 text = MSub(r"(?<=#define PATCH_LEVEL)(?P<space>\s+)\d*$",
190 r"\g<space>%s" % new_patch, 189 r"\g<space>%s" % new_patch,
191 text) 190 text)
192 TextToFile(text, self.Config(VERSION_FILE)) 191 TextToFile(text, os.path.join(self.default_cwd, VERSION_FILE))
193 else: 192 else:
194 self.Editor(self.Config(VERSION_FILE)) 193 self.Editor(os.path.join(self.default_cwd, VERSION_FILE))
195 self.ReadAndPersistVersion("new_") 194 self.ReadAndPersistVersion("new_")
196 self["version"] = "%s.%s.%s.%s" % (self["new_major"], 195 self["version"] = "%s.%s.%s.%s" % (self["new_major"],
197 self["new_minor"], 196 self["new_minor"],
198 self["new_build"], 197 self["new_build"],
199 self["new_patch"]) 198 self["new_patch"])
200 199
201 200
202 class CommitLocal(Step): 201 class CommitLocal(Step):
203 MESSAGE = "Commit to local branch." 202 MESSAGE = "Commit to local branch."
204 203
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 UploadStep, 323 UploadStep,
325 CommitRepository, 324 CommitRepository,
326 PrepareSVN, 325 PrepareSVN,
327 TagRevision, 326 TagRevision,
328 CleanUp, 327 CleanUp,
329 ] 328 ]
330 329
331 330
332 if __name__ == "__main__": # pragma: no cover 331 if __name__ == "__main__": # pragma: no cover
333 sys.exit(MergeToBranch(CONFIG).Run()) 332 sys.exit(MergeToBranch(CONFIG).Run())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698