Title: [294212] trunk/Tools
Revision
294212
Author
[email protected]
Date
2022-05-14 17:45:16 -0700 (Sat, 14 May 2022)

Log Message

[webkit-patch] Include commit messages in patches (Follow-up #2)
https://bugs.webkit.org/show_bug.cgi?id=240256
<rdar://problem/92982358>

Unreviewed follow-up fix.


* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.create_patch): Allow caller to exclude commit message, run `git diff` against HEAD by
default to include both staged and unstaged changes.
* Scripts/webkitpy/common/checkout/scm/scm.py:
(SCM.create_patch): Match function signature for git.
* Scripts/webkitpy/common/checkout/scm/scm_mock.py:
(MockSCM.create_patch): Match function signature for git.
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN.create_patch): Match function signature for git.
* Scripts/webkitpy/w3c/test_exporter.py:
(WebPlatformTestExporter._wpt_patch): Exclude commit message since we won't be able
to classify it's file.
* Scripts/webkitpy/w3c/test_exporter_unittest.py:
(TestExporterTest.MockGit.create_patch): Match function signature for git.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (294211 => 294212)


--- trunk/Tools/ChangeLog	2022-05-14 22:39:40 UTC (rev 294211)
+++ trunk/Tools/ChangeLog	2022-05-15 00:45:16 UTC (rev 294212)
@@ -1,3 +1,26 @@
+2022-05-14  Jonathan Bedard  <[email protected]>
+
+        [webkit-patch] Include commit messages in patches (Follow-up #2) 
+        https://bugs.webkit.org/show_bug.cgi?id=240256
+        <rdar://problem/92982358>
+
+        Unreviewed follow-up fix.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.create_patch): Allow caller to exclude commit message, run `git diff` against HEAD by
+        default to include both staged and unstaged changes.
+        * Scripts/webkitpy/common/checkout/scm/scm.py:
+        (SCM.create_patch): Match function signature for git.
+        * Scripts/webkitpy/common/checkout/scm/scm_mock.py:
+        (MockSCM.create_patch): Match function signature for git.
+        * Scripts/webkitpy/common/checkout/scm/svn.py:
+        (SVN.create_patch): Match function signature for git.
+        * Scripts/webkitpy/w3c/test_exporter.py:
+        (WebPlatformTestExporter._wpt_patch): Exclude commit message since we won't be able
+        to classify it's file.
+        * Scripts/webkitpy/w3c/test_exporter_unittest.py:
+        (TestExporterTest.MockGit.create_patch): Match function signature for git.
+
 2022-05-14  Tyler Wilcock  <[email protected]>
 
         AX: Remove CSSDisplayContentsAXSupportEnabled flag

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (294211 => 294212)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2022-05-14 22:39:40 UTC (rev 294211)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2022-05-15 00:45:16 UTC (rev 294212)
@@ -350,7 +350,7 @@
 
         return string_utils.encode("Subversion Revision: ") + string_utils.encode(revision) + string_utils.encode('\n') + string_utils.encode(diff)
 
-    def create_patch(self, git_commit=None, changed_files=None, git_index=False):
+    def create_patch(self, git_commit=None, changed_files=None, git_index=False, commit_message=True):
         """Returns a byte array (str()) representing the patch file.
         Patch files are effectively binary since they may contain files of multiple different encodings.
         If git_index is True, git_commit is ignored because only indexed files are handled.
@@ -358,7 +358,7 @@
 
         head = self.rev_parse('HEAD')
         merge_base = self.merge_base(git_commit)
-        if merge_base == head:
+        if not commit_message or merge_base == head:
             command = [self.executable_name, 'diff', '--binary', '--no-color', '--no-ext-diff', '--full-index', '--no-renames']
         else:
             command = [self.executable_name, 'format-patch', '--stdout', '--binary']
@@ -376,6 +376,8 @@
             command += [merge_base]
         elif merge_base != head:
             command += ['HEAD...{}'.format(merge_base)]
+        else:
+            command += ['HEAD']
 
         return self.run(command, decode_output=False, cwd=self.checkout_root)
 

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py (294211 => 294212)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py	2022-05-14 22:39:40 UTC (rev 294211)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py	2022-05-15 00:45:16 UTC (rev 294212)
@@ -172,7 +172,7 @@
     def timestamp_of_native_revision(self, path, revision):
         self._subclass_must_implement()
 
-    def create_patch(self, git_commit=None, changed_files=None):
+    def create_patch(self, git_commit=None, changed_files=None, commit_message=False):
         self._subclass_must_implement()
 
     def committer_email_for_revision(self, revision):

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py (294211 => 294212)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py	2022-05-14 22:39:40 UTC (rev 294211)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py	2022-05-15 00:45:16 UTC (rev 294212)
@@ -96,7 +96,7 @@
     def timestamp_of_native_revision(self, path, revision):
         return '2013-02-01 08:48:05 +0000'
 
-    def create_patch(self, git_commit, changed_files=None):
+    def create_patch(self, git_commit, changed_files=None, commit_message=False):
         return b"Patch1"
 
     def commit_ids_from_commitish_arguments(self, args):

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py (294211 => 294212)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py	2022-05-14 22:39:40 UTC (rev 294211)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py	2022-05-15 00:45:16 UTC (rev 294212)
@@ -308,7 +308,7 @@
         return self.timestamp_of_revision(path, revision)
 
     # FIXME: This method should be on Checkout.
-    def create_patch(self, git_commit=None, changed_files=None, git_index=None):
+    def create_patch(self, git_commit=None, changed_files=None, git_index=None, commit_message=False):
         """Returns a byte array (str()) representing the patch file.
         Patch files are effectively binary since they may contain
         files of multiple different encodings."""

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py (294211 => 294212)


--- trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py	2022-05-14 22:39:40 UTC (rev 294211)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py	2022-05-15 00:45:16 UTC (rev 294212)
@@ -147,7 +147,7 @@
     @property
     @memoized
     def _wpt_patch(self):
-        patch_data = self._host.scm().create_patch(self._options.git_commit, [WEBKIT_WPT_DIR]) or b''
+        patch_data = self._host.scm().create_patch(self._options.git_commit, [WEBKIT_WPT_DIR], commit_message=False) or b''
         patch_data = self._strip_ignored_files_from_diff(patch_data)
         if b'diff' not in patch_data:
             return ''

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py (294211 => 294212)


--- trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py	2022-05-14 22:39:40 UTC (rev 294211)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py	2022-05-15 00:45:16 UTC (rev 294212)
@@ -96,7 +96,7 @@
         def branch_ref_exists(self, name):
             return False
 
-        def create_patch(self, commit, arguments):
+        def create_patch(self, commit, arguments, commit_message=False):
             self.calls.append('create_patch ' + commit + ' ' + str(arguments))
             return self.mock_format_patch_result
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to