- Revision
- 187357
- Author
- [email protected]
- Date
- 2015-07-24 13:22:58 -0700 (Fri, 24 Jul 2015)
Log Message
Call fixChangeLogPatch when generating patches from webkit-patch
https://bugs.webkit.org/show_bug.cgi?id=147248
Reviewed by Geoffrey Garen.
When two consecutive patches are from the same author, diff tools
create wrong-looking diffs for ChangeLog files where the apparent added
author is actually the previous patch's author line, making it awkward
to read - and things only get worse when committing a patch and a
followup fix for the same bug shortly after.
We have a perl function in VCSUtils.pm, fixChangeLogPatch, to corrects
this, which we use in perl scripts (svn-create-patch et al). But it is
not used by webkit-patch, which is a python script, and thus creates
"bad" diffs.
In the long term, we should probably port fixChangeLogPatch to python -
but in the short term, let's make webkit-patch call perl to run
fixChangeLogPatch. We are already making various external calls there
anyway.
* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.create_patch):
* Scripts/webkitpy/common/checkout/scm/scm.py:
(SCM.fix_changelog_patch):
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN.create_patch):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (187356 => 187357)
--- trunk/Tools/ChangeLog 2015-07-24 19:48:26 UTC (rev 187356)
+++ trunk/Tools/ChangeLog 2015-07-24 20:22:58 UTC (rev 187357)
@@ -1,3 +1,33 @@
+2015-07-24 Basile Clement <[email protected]>
+
+ Call fixChangeLogPatch when generating patches from webkit-patch
+ https://bugs.webkit.org/show_bug.cgi?id=147248
+
+ Reviewed by Geoffrey Garen.
+
+ When two consecutive patches are from the same author, diff tools
+ create wrong-looking diffs for ChangeLog files where the apparent added
+ author is actually the previous patch's author line, making it awkward
+ to read - and things only get worse when committing a patch and a
+ followup fix for the same bug shortly after.
+
+ We have a perl function in VCSUtils.pm, fixChangeLogPatch, to corrects
+ this, which we use in perl scripts (svn-create-patch et al). But it is
+ not used by webkit-patch, which is a python script, and thus creates
+ "bad" diffs.
+
+ In the long term, we should probably port fixChangeLogPatch to python -
+ but in the short term, let's make webkit-patch call perl to run
+ fixChangeLogPatch. We are already making various external calls there
+ anyway.
+
+ * Scripts/webkitpy/common/checkout/scm/git.py:
+ (Git.create_patch):
+ * Scripts/webkitpy/common/checkout/scm/scm.py:
+ (SCM.fix_changelog_patch):
+ * Scripts/webkitpy/common/checkout/scm/svn.py:
+ (SVN.create_patch):
+
2015-07-24 Dean Johnson <[email protected]>
commit-queue flags in webkit-patch are confusing
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (187356 => 187357)
--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py 2015-07-24 19:48:26 UTC (rev 187356)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py 2015-07-24 20:22:58 UTC (rev 187357)
@@ -321,7 +321,9 @@
command += ["--"]
if changed_files:
command += changed_files
- return self.prepend_svn_revision(self.run(command, decode_output=False, cwd=self.checkout_root))
+ return self.fix_changelog_patch(
+ self.prepend_svn_revision(
+ self.run(command, decode_output=False, cwd=self.checkout_root)))
def _run_git_svn_find_rev(self, revision_or_treeish, branch=None):
# git svn find-rev requires SVN revisions to begin with the character 'r'.
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py (187356 => 187357)
--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py 2015-07-24 19:48:26 UTC (rev 187356)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py 2015-07-24 20:22:58 UTC (rev 187357)
@@ -77,6 +77,12 @@
return_stderr=return_stderr,
decode_output=decode_output)
+ def fix_changelog_patch(self, diff):
+ return self.run(
+ ['perl', '-e', 'use VCSUtils; print(fixChangeLogPatch(join("", <STDIN>))->{"patch"});'],
+ cwd=self._filesystem.join(self.checkout_root, 'Tools', 'Scripts'),
+ input=diff, decode_output=False)
+
# SCM always returns repository relative path, but sometimes we need
# absolute paths to pass to rm, etc.
def absolute_path(self, repository_relative_path):
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py (187356 => 187357)
--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py 2015-07-24 19:48:26 UTC (rev 187356)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py 2015-07-24 20:22:58 UTC (rev 187357)
@@ -273,9 +273,10 @@
elif changed_files == None:
changed_files = []
script_path = self._filesystem.join(self.checkout_root, "Tools", "Scripts", "svn-create-patch")
- return self.run([script_path, "--no-style"] + changed_files,
- cwd=self.checkout_root, return_stderr=False,
- decode_output=False)
+ return self.fix_changelog_patch(
+ self.run([script_path, "--no-style"] + changed_files,
+ cwd=self.checkout_root, return_stderr=False,
+ decode_output=False))
def committer_email_for_revision(self, revision):
return self._run_svn(["propget", "svn:author", "--revprop", "-r", revision]).rstrip()