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

Unified Diff: tools/push-to-trunk/push_to_trunk.py

Issue 81193002: Pythonification and refactoring of push-to-trunk. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Refactor step generation. Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/push_to_trunk.py
diff --git a/tools/push-to-trunk/push_to_trunk.py b/tools/push-to-trunk/push_to_trunk.py
index 7278323e223b09379abef5402ba356be372f39ec..24dfb676805a29cbdca11166c3fdfe71e9c338b5 100755
--- a/tools/push-to-trunk/push_to_trunk.py
+++ b/tools/push-to-trunk/push_to_trunk.py
@@ -53,8 +53,7 @@ CONFIG = {
class Preparation(Step):
- def __init__(self):
- Step.__init__(self, "Preparation.")
+ MESSAGE = "Preparation."
def RunStep(self):
self.InitialEnvironmentChecks()
@@ -64,8 +63,7 @@ class Preparation(Step):
class FreshBranch(Step):
- def __init__(self):
- Step.__init__(self, "Create a fresh branch.")
+ MESSAGE = "Create a fresh branch."
def RunStep(self):
args = "checkout -b %s svn/bleeding_edge" % self.Config(BRANCHNAME)
@@ -74,8 +72,7 @@ class FreshBranch(Step):
class DetectLastPush(Step):
- def __init__(self):
- Step.__init__(self, "Detect commit ID of last push to trunk.")
+ MESSAGE = "Detect commit ID of last push to trunk."
def RunStep(self):
last_push = (self._options.l or
@@ -92,8 +89,7 @@ class DetectLastPush(Step):
class PrepareChangeLog(Step):
- def __init__(self):
- Step.__init__(self, "Prepare raw ChangeLog entry.")
+ MESSAGE = "Prepare raw ChangeLog entry."
def RunStep(self):
self.RestoreIfUnset("last_push")
@@ -115,9 +111,9 @@ class PrepareChangeLog(Step):
# Cache raw commit messages.
commit_messages = [
[
- self.Git("log -1 %s --format=\"%%w(80,8,8)%%s\"" % commit),
+ self.Git("log -1 %s --format=\"%%s\"" % commit),
self.Git("log -1 %s --format=\"%%B\"" % commit),
- self.Git("log -1 %s --format=\"%%w(80,8,8)(%%an)\"" % commit),
+ self.Git("log -1 %s --format=\"%%an\"" % commit),
] for commit in commits.splitlines()
]
@@ -137,8 +133,7 @@ class PrepareChangeLog(Step):
class EditChangeLog(Step):
- def __init__(self):
- Step.__init__(self, "Edit ChangeLog entry.")
+ MESSAGE = "Edit ChangeLog entry."
def RunStep(self):
print ("Please press <Return> to have your EDITOR open the ChangeLog "
@@ -152,14 +147,10 @@ class EditChangeLog(Step):
handle, new_changelog = tempfile.mkstemp()
os.close(handle)
- # (1) Strip comments, (2) eliminate tabs, (3) fix too little and (4) too
- # much indentation, and (5) eliminate trailing whitespace.
+ # Strip comments and reformat with correct indentation.
changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip()
changelog_entry = StripComments(changelog_entry)
- changelog_entry = MSub(r"\t", r" ", changelog_entry)
- changelog_entry = MSub(r"^ {1,7}([^ ])", r" \1", changelog_entry)
- changelog_entry = MSub(r"^ {9,80}([^ ])", r" \1", changelog_entry)
- changelog_entry = MSub(r" +$", r"", changelog_entry)
+ changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines()))
if changelog_entry == "":
self.Die("Empty ChangeLog entry.")
@@ -174,8 +165,7 @@ class EditChangeLog(Step):
class IncrementVersion(Step):
- def __init__(self):
- Step.__init__(self, "Increment version number.")
+ MESSAGE = "Increment version number."
def RunStep(self):
self.RestoreIfUnset("build")
@@ -197,8 +187,7 @@ class IncrementVersion(Step):
class CommitLocal(Step):
- def __init__(self):
- Step.__init__(self, "Commit to local branch.")
+ MESSAGE = "Commit to local branch."
def RunStep(self):
self.RestoreVersionIfUnset("new_")
@@ -212,8 +201,7 @@ class CommitLocal(Step):
class CommitRepository(Step):
- def __init__(self):
- Step.__init__(self, "Commit to the repository.")
+ MESSAGE = "Commit to the repository."
def RunStep(self):
self.WaitForLGTM()
@@ -227,9 +215,8 @@ class CommitRepository(Step):
class StragglerCommits(Step):
- def __init__(self):
- Step.__init__(self, "Fetch straggler commits that sneaked in since this "
- "script was started.")
+ MESSAGE = ("Fetch straggler commits that sneaked in since this script was "
+ "started.")
def RunStep(self):
if self.Git("svn fetch") is None:
@@ -242,8 +229,7 @@ class StragglerCommits(Step):
class SquashCommits(Step):
- def __init__(self):
- Step.__init__(self, "Squash commits into one.")
+ MESSAGE = "Squash commits into one."
def RunStep(self):
# Instead of relying on "git rebase -i", we'll just create a diff, because
@@ -285,8 +271,7 @@ class SquashCommits(Step):
class NewBranch(Step):
- def __init__(self):
- Step.__init__(self, "Create a new branch from trunk.")
+ MESSAGE = "Create a new branch from trunk."
def RunStep(self):
if self.Git("checkout -b %s svn/trunk" % self.Config(TRUNKBRANCH)) is None:
@@ -295,8 +280,7 @@ class NewBranch(Step):
class ApplyChanges(Step):
- def __init__(self):
- Step.__init__(self, "Apply squashed changes.")
+ MESSAGE = "Apply squashed changes."
def RunStep(self):
self.ApplyPatch(self.Config(PATCH_FILE))
@@ -304,8 +288,7 @@ class ApplyChanges(Step):
class SetVersion(Step):
- def __init__(self):
- Step.__init__(self, "Set correct version for trunk.")
+ MESSAGE = "Set correct version for trunk."
def RunStep(self):
self.RestoreVersionIfUnset()
@@ -326,8 +309,7 @@ class SetVersion(Step):
class CommitTrunk(Step):
- def __init__(self):
- Step.__init__(self, "Commit to local trunk branch.")
+ MESSAGE = "Commit to local trunk branch."
def RunStep(self):
self.Git("add \"%s\"" % self.Config(VERSION_FILE))
@@ -337,8 +319,7 @@ class CommitTrunk(Step):
class SanityCheck(Step):
- def __init__(self):
- Step.__init__(self, "Sanity check.")
+ MESSAGE = "Sanity check."
def RunStep(self):
if not self.Confirm("Please check if your local checkout is sane: Inspect "
@@ -348,8 +329,7 @@ class SanityCheck(Step):
class CommitSVN(Step):
- def __init__(self):
- Step.__init__(self, "Commit to SVN.")
+ MESSAGE = "Commit to SVN."
def RunStep(self):
result = self.Git("svn dcommit 2>&1")
@@ -374,8 +354,7 @@ class CommitSVN(Step):
class TagRevision(Step):
- def __init__(self):
- Step.__init__(self, "Tag the new revision.")
+ MESSAGE = "Tag the new revision."
def RunStep(self):
self.RestoreVersionIfUnset()
@@ -387,8 +366,7 @@ class TagRevision(Step):
class CheckChromium(Step):
- def __init__(self):
- Step.__init__(self, "Ask for chromium checkout.")
+ MESSAGE = "Ask for chromium checkout."
def Run(self):
chrome_path = self._options.c
@@ -404,8 +382,8 @@ class CheckChromium(Step):
class SwitchChromium(Step):
- def __init__(self):
- Step.__init__(self, "Switch to Chromium checkout.", requires="chrome_path")
+ MESSAGE = "Switch to Chromium checkout."
+ REQUIRES = "chrome_path"
def RunStep(self):
v8_path = os.getcwd()
@@ -421,9 +399,8 @@ class SwitchChromium(Step):
class UpdateChromiumCheckout(Step):
- def __init__(self):
- Step.__init__(self, "Update the checkout and create a new branch.",
- requires="chrome_path")
+ MESSAGE = "Update the checkout and create a new branch."
+ REQUIRES = "chrome_path"
def RunStep(self):
os.chdir(self._state["chrome_path"])
@@ -439,8 +416,8 @@ class UpdateChromiumCheckout(Step):
class UploadCL(Step):
- def __init__(self):
- Step.__init__(self, "Create and upload CL.", requires="chrome_path")
+ MESSAGE = "Create and upload CL."
+ REQUIRES = "chrome_path"
def RunStep(self):
os.chdir(self._state["chrome_path"])
@@ -474,8 +451,8 @@ class UploadCL(Step):
class SwitchV8(Step):
- def __init__(self):
- Step.__init__(self, "Returning to V8 checkout.", requires="chrome_path")
+ MESSAGE = "Returning to V8 checkout."
+ REQUIRES = "chrome_path"
def RunStep(self):
self.RestoreIfUnset("v8_path")
@@ -483,8 +460,7 @@ class SwitchV8(Step):
class CleanUp(Step):
- def __init__(self):
- Step.__init__(self, "Done!")
+ MESSAGE = "Done!"
def RunStep(self):
self.RestoreVersionIfUnset()
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698