Fix bug entry and quotation marks in merge-to-branch.
authormachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 3 Apr 2014 13:01:22 +0000 (13:01 +0000)
committermachenbach@chromium.org <machenbach@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 3 Apr 2014 13:01:22 +0000 (13:01 +0000)
This fixes usage of quotation marks inside titles of merged patches.
This also fixes aggregation of empty or "none" BUG entries.

BUG=
R=jarin@chromium.org

Review URL: https://codereview.chromium.org/223463003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20483 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/push-to-trunk/git_recipes.py
tools/push-to-trunk/merge_to_branch.py
tools/push-to-trunk/test_scripts.py

index 8e84d45..c0f0afb 100644 (file)
@@ -85,7 +85,7 @@ class GitRecipesMixin(object):
     if format:
       args.append("--format=%s" % format)
     if grep:
-      args.append("--grep=\"%s\"" % grep)
+      args.append("--grep=\"%s\"" % grep.replace("\"", "\\\""))
     if reverse:
       args.append("--reverse")
     if git_hash:
index 7137689..ac02b54 100755 (executable)
@@ -147,7 +147,7 @@ class FindGitRevisions(Step):
       for bug in re.findall(r"^[ \t]*BUG[ \t]*=[ \t]*(.*?)[ \t]*$", msg,
                             re.M):
         bugs.extend(map(lambda s: s.strip(), bug.split(",")))
-    bug_aggregate = ",".join(sorted(bugs))
+    bug_aggregate = ",".join(sorted(filter(lambda s: s and s != "none", bugs)))
     if bug_aggregate:
       self["new_commit_msg"] += "BUG=%s\nLOG=N\n" % bug_aggregate
 
index b7f6e8b..6fd30c7 100644 (file)
@@ -995,7 +995,7 @@ Title3
 
 Title1
 
-Title5
+Revert "Something"
 
 BUG=123,234,345,456,567,v8:123
 LOG=N
@@ -1043,12 +1043,12 @@ LOG=N
       Git("log -1 --format=%s hash2", "Title2"),
       Git("log -1 --format=%s hash3", "Title3"),
       Git("log -1 --format=%s hash1", "Title1"),
-      Git("log -1 --format=%s hash5", "Title5"),
+      Git("log -1 --format=%s hash5", "Revert \"Something\""),
       Git("log -1 hash4", "Title4\nBUG=123\nBUG=234"),
       Git("log -1 hash2", "Title2\n BUG = v8:123,345"),
       Git("log -1 hash3", "Title3\nLOG=n\nBUG=567, 456"),
-      Git("log -1 hash1", "Title1"),
-      Git("log -1 hash5", "Title5"),
+      Git("log -1 hash1", "Title1\nBUG="),
+      Git("log -1 hash5", "Revert \"Something\"\nBUG=none"),
       Git("log -1 -p hash4", "patch4"),
       Git("apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE],
           "", cb=VerifyPatch("patch4")),
@@ -1071,7 +1071,8 @@ LOG=N
       Git("cl presubmit", "Presubmit successfull\n"),
       Git("cl dcommit -f --bypass-hooks", "Closing issue\n", cb=VerifySVNCommit),
       Git("svn fetch", ""),
-      Git("log -1 --format=%%H --grep=\"%s\" svn/trunk" % msg, "hash6"),
+      Git(("log -1 --format=%%H --grep=\"%s\" svn/trunk"
+           % msg.replace("\"", "\\\"")), "hash6"),
       Git("svn find-rev hash6", "1324"),
       Git(("copy -r 1324 https://v8.googlecode.com/svn/trunk "
            "https://v8.googlecode.com/svn/tags/3.22.5.1 -m "