Reviewers: tandrii(chromium), Hablich,

Message:
PTAL

Description:
Make automated branch creation gnumbd-save.

This makes now the same simplification as the chromium
release scripts do. For creating branch B from a gnumbd'ed
(aka real) commit X do:
1. Branch Y off the real X
2. Set refs/pending/heads/B to Y
3. Set refs/pending-tags/B to X
4. Set refs/heads/B to X

The old algorithm tried to branch off the pending
correspondent of X. That commit was determined by comparing
tree objects of the real X and commits on pending.
Unfortunately, multiple commits on one branch can refer to
the same tree object, e.g., for commits P, Q, R with R being
the revert of Q, P and R refer to the same tree object.

Please review this at https://codereview.chromium.org/979243004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+7, -24 lines):
  M tools/release/create_release.py
  M tools/release/test_scripts.py


Index: tools/release/create_release.py
diff --git a/tools/release/create_release.py b/tools/release/create_release.py index 44c10d9b304367f6053a48ff9b2118afbe5701e2..3bbb50e491aa5bc175d747f3af996a8c4236226d 100755
--- a/tools/release/create_release.py
+++ b/tools/release/create_release.py
@@ -30,23 +30,10 @@ class PrepareBranchRevision(Step):
   MESSAGE = "Check from which revision to branch off."

   def RunStep(self):
-    if self._options.revision:
-      self["push_hash"], tree_object = self.GitLog(
- n=1, format="\"%H %T\"", git_hash=self._options.revision).split(" ")
-    else:
-      self["push_hash"], tree_object = self.GitLog(
-          n=1, format="\"%H %T\"", branch="origin/master").split(" ")
-    print "Release revision %s" % self["push_hash"]
+    self["push_hash"] = (self._options.revision or
+ self.GitLog(n=1, format="%H", branch="origin/master"))
     assert self["push_hash"]
-
-    pending_tuples = self.GitLog(
-        n=200, format="\"%H %T\"", branch="refs/pending/heads/master")
- for hsh, tree in map(lambda s: s.split(" "), pending_tuples.splitlines()):
-      if tree == tree_object:
-        self["pending_hash"] = hsh
-        break
-    print "Pending release revision %s" % self["pending_hash"]
-    assert self["pending_hash"]
+    print "Release revision %s" % self["push_hash"]


 class IncrementVersion(Step):
@@ -174,7 +161,7 @@ class MakeBranch(Step):

   def RunStep(self):
     self.Git("reset --hard origin/master")
-    self.Git("checkout -b work-branch %s" % self["pending_hash"])
+    self.Git("checkout -b work-branch %s" % self["push_hash"])
     self.GitCheckoutFile(CHANGELOG_FILE, self["latest_version"])
     self.GitCheckoutFile(VERSION_FILE, self["latest_version"])

@@ -229,8 +216,7 @@ class PushBranch(Step):
   def RunStep(self):
     pushspecs = [
       "refs/heads/work-branch:refs/pending/heads/%s" % self["version"],
-      "%s:refs/pending-tags/heads/%s" %
-      (self["pending_hash"], self["version"]),
+ "%s:refs/pending-tags/heads/%s" % (self["push_hash"], self["version"]),
       "%s:refs/heads/%s" % (self["push_hash"], self["version"]),
     ]
     cmd = "push origin %s" % " ".join(pushspecs)
Index: tools/release/test_scripts.py
diff --git a/tools/release/test_scripts.py b/tools/release/test_scripts.py
index aeb9c20ab7cb1c2666fdec26700cba67bf79bef1..77d66b6bfb08d001621b578f4f37cfe6f10da850 100644
--- a/tools/release/test_scripts.py
+++ b/tools/release/test_scripts.py
@@ -917,9 +917,6 @@ Performance and stability improvements on all platforms."""
           "+refs/pending-tags/*:refs/pending-tags/*", ""),
       Cmd("git checkout -f origin/master", ""),
       Cmd("git branch", ""),
- Cmd("git log -1 --format=\"%H %T\" push_hash", "push_hash tree_hash"),
-      Cmd("git log -200 --format=\"%H %T\" refs/pending/heads/master",
-          "not_right wrong\npending_hash tree_hash\nsome other\n"),
       Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
       Cmd("git tag", self.TAGS),
       Cmd("git checkout -f origin/master -- include/v8-version.h",
@@ -932,7 +929,7 @@ Performance and stability improvements on all platforms.""" Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
       Cmd("git log -1 --format=%an rev1", "[email protected]\n"),
       Cmd("git reset --hard origin/master", ""),
-      Cmd("git checkout -b work-branch pending_hash", ""),
+      Cmd("git checkout -b work-branch push_hash", ""),
       Cmd("git checkout -f 3.22.4 -- ChangeLog", "", cb=ResetChangeLog),
       Cmd("git checkout -f 3.22.4 -- include/v8-version.h", "",
           cb=self.WriteFakeVersionFile),
@@ -940,7 +937,7 @@ Performance and stability improvements on all platforms."""
           cb=CheckVersionCommit),
       Cmd("git push origin "
           "refs/heads/work-branch:refs/pending/heads/3.22.5 "
-          "pending_hash:refs/pending-tags/heads/3.22.5 "
+          "push_hash:refs/pending-tags/heads/3.22.5 "
           "push_hash:refs/heads/3.22.5", ""),
       Cmd("git fetch", ""),
       Cmd("git log -1 --format=%H --grep="


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to