From: machenbach@chromium.org Date: Wed, 26 Feb 2014 16:12:32 +0000 (+0000) Subject: Fix patch creation in merge-to-branch script. X-Git-Tag: upstream/4.7.83~10556 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f09b3db78cad424bc8f7f9d031b12444f84a0493;p=platform%2Fupstream%2Fv8.git Fix patch creation in merge-to-branch script. Patch white space got stripped, which lead to failures when applying the patch. - Refine test to reveal the problem - Create a separate method for retrieving the patch that doesn't strip white space R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/181603002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19566 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/tools/push-to-trunk/git_recipes.py b/tools/push-to-trunk/git_recipes.py index f5a2315..088ba53 100644 --- a/tools/push-to-trunk/git_recipes.py +++ b/tools/push-to-trunk/git_recipes.py @@ -72,7 +72,7 @@ class GitRecipesMixin(object): @Strip def GitLog(self, n=0, format="", grep="", git_hash="", parent_hash="", - branch="", reverse=False, patch=False): + branch="", reverse=False): assert not (git_hash and parent_hash) args = ["log"] if n > 0: @@ -83,8 +83,6 @@ class GitRecipesMixin(object): args.append("--grep=\"%s\"" % grep) if reverse: args.append("--reverse") - if patch: - args.append("-p") if git_hash: args.append(git_hash) if parent_hash: @@ -92,6 +90,10 @@ class GitRecipesMixin(object): args.append(branch) return self.Git(MakeArgs(args)) + def GitGetPatch(self, git_hash): + assert git_hash + return self.Git(MakeArgs(["log", "-1", "-p", git_hash])) + def GitAdd(self, name): assert name self.Git(MakeArgs(["add", Quoted(name)])) diff --git a/tools/push-to-trunk/merge_to_branch.py b/tools/push-to-trunk/merge_to_branch.py index 5f2e573..7e0e51f 100755 --- a/tools/push-to-trunk/merge_to_branch.py +++ b/tools/push-to-trunk/merge_to_branch.py @@ -182,7 +182,7 @@ class ApplyPatches(Step): for commit_hash in self["patch_commit_hashes"]: print("Applying patch for %s to %s..." % (commit_hash, self["merge_to_branch"])) - patch = self.GitLog(n=1, patch=True, git_hash=commit_hash) + patch = self.GitGetPatch(commit_hash) TextToFile(patch, self.Config(TEMPORARY_PATCH_FILE)) self.ApplyPatch(self.Config(TEMPORARY_PATCH_FILE), self._options.revert) if self._options.patch: diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py index 8e47d46..2cc08ba 100644 --- a/tools/push-to-trunk/test_scripts.py +++ b/tools/push-to-trunk/test_scripts.py @@ -950,9 +950,9 @@ LOG=N ["log -1 -p hash1", "patch1"], ["apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE], "", VerifyPatch("patch1")], - ["log -1 -p hash5", "patch5"], + ["log -1 -p hash5", "patch5\n"], ["apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE], - "", VerifyPatch("patch5")], + "", VerifyPatch("patch5\n")], ["apply --index --reject \"%s\"" % extra_patch, ""], ["commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], ""], ["cl upload --send-mail -r \"reviewer@chromium.org\"", ""],