Title: [97561] trunk/Tools
Revision
97561
Author
[email protected]
Date
2011-10-15 12:14:37 -0700 (Sat, 15 Oct 2011)

Log Message

[webkit-patch] Put Source/Tools changes at the top of patches, LayoutTests at the bottom
https://bugs.webkit.org/show_bug.cgi?id=70056

Reviewed by Adam Barth.

The preferred file-order for patches is LayoutTests at the end and
ChangeLogs before everything else in a subdirectory. Specify this in a git 'orderfile' and use
it when creating patches for review and landing.

* Scripts/webkitpy/common/checkout/scm/git.py:
* Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
* Scripts/webkitpy/common/config/orderfile: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (97560 => 97561)


--- trunk/Tools/ChangeLog	2011-10-15 16:17:29 UTC (rev 97560)
+++ trunk/Tools/ChangeLog	2011-10-15 19:14:37 UTC (rev 97561)
@@ -1,3 +1,18 @@
+2011-10-15  Robert Hogan  <[email protected]>
+
+        [webkit-patch] Put Source/Tools changes at the top of patches, LayoutTests at the bottom
+        https://bugs.webkit.org/show_bug.cgi?id=70056
+
+        Reviewed by Adam Barth.
+
+        The preferred file-order for patches is LayoutTests at the end and
+        ChangeLogs before everything else in a subdirectory. Specify this in a git 'orderfile' and use 
+        it when creating patches for review and landing.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
+        * Scripts/webkitpy/common/config/orderfile: Added.
+
 2011-10-15  Laszlo Gombos  <[email protected]>
 
         [Qt] [Symbian] Remove support for the Symbian platform for the QtWebKit port

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


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2011-10-15 16:17:29 UTC (rev 97560)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2011-10-15 19:14:37 UTC (rev 97561)
@@ -248,7 +248,16 @@
         """Returns a byte array (str()) representing the patch file.
         Patch files are effectively binary since they may contain
         files of multiple different encodings."""
-        command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "--no-renames", self.merge_base(git_commit), "--"]
+
+        # Put code changes at the top of the patch and layout tests
+        # at the bottom, this makes for easier reviewing.
+        config_path = self._filesystem.dirname(self._filesystem.path_to_module('webkitpy.common.config'))
+        order_file = self._filesystem.join(config_path, 'orderfile')
+        order = ""
+        if self._filesystem.exists(order_file):
+            order = "-O%s" % order_file
+
+        command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "--no-renames", order, self.merge_base(git_commit), "--"]
         if changed_files:
             command += changed_files
         return self.prepend_svn_revision(self.run(command, decode_output=False, cwd=self.checkout_root))

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py (97560 => 97561)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2011-10-15 16:17:29 UTC (rev 97560)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2011-10-15 19:14:37 UTC (rev 97561)
@@ -1000,6 +1000,60 @@
         patch = scm.create_patch()
         self.assertFalse(re.search(r'Subversion Revision:', patch))
 
+    def test_orderfile(self):
+        os.mkdir("Tools")
+        os.mkdir("Source")
+        os.mkdir("LayoutTests")
+        os.mkdir("Websites")
+
+        # Slash should always be the right path separator since we use cygwin on Windows.
+        Tools_ChangeLog = "Tools/ChangeLog"
+        write_into_file_at_path(Tools_ChangeLog, "contents")
+        Source_ChangeLog = "Source/ChangeLog"
+        write_into_file_at_path(Source_ChangeLog, "contents")
+        LayoutTests_ChangeLog = "LayoutTests/ChangeLog"
+        write_into_file_at_path(LayoutTests_ChangeLog, "contents")
+        Websites_ChangeLog = "Websites/ChangeLog"
+        write_into_file_at_path(Websites_ChangeLog, "contents")
+
+        Tools_ChangeFile = "Tools/ChangeFile"
+        write_into_file_at_path(Tools_ChangeFile, "contents")
+        Source_ChangeFile = "Source/ChangeFile"
+        write_into_file_at_path(Source_ChangeFile, "contents")
+        LayoutTests_ChangeFile = "LayoutTests/ChangeFile"
+        write_into_file_at_path(LayoutTests_ChangeFile, "contents")
+        Websites_ChangeFile = "Websites/ChangeFile"
+        write_into_file_at_path(Websites_ChangeFile, "contents")
+
+        run_command(['git', 'add', 'Tools/ChangeLog'])
+        run_command(['git', 'add', 'LayoutTests/ChangeLog'])
+        run_command(['git', 'add', 'Source/ChangeLog'])
+        run_command(['git', 'add', 'Websites/ChangeLog'])
+        run_command(['git', 'add', 'Tools/ChangeFile'])
+        run_command(['git', 'add', 'LayoutTests/ChangeFile'])
+        run_command(['git', 'add', 'Source/ChangeFile'])
+        run_command(['git', 'add', 'Websites/ChangeFile'])
+        scm = self.tracking_scm
+        scm.commit_locally_with_message('message')
+
+        patch = scm.create_patch()
+        self.assertTrue(re.search(r'Tools/ChangeLog', patch).start() < re.search(r'Tools/ChangeFile', patch).start())
+        self.assertTrue(re.search(r'Websites/ChangeLog', patch).start() < re.search(r'Websites/ChangeFile', patch).start())
+        self.assertTrue(re.search(r'Source/ChangeLog', patch).start() < re.search(r'Source/ChangeFile', patch).start())
+        self.assertTrue(re.search(r'LayoutTests/ChangeLog', patch).start() < re.search(r'LayoutTests/ChangeFile', patch).start())
+
+        self.assertTrue(re.search(r'Source/ChangeLog', patch).start() < re.search(r'LayoutTests/ChangeLog', patch).start())
+        self.assertTrue(re.search(r'Tools/ChangeLog', patch).start() < re.search(r'LayoutTests/ChangeLog', patch).start())
+        self.assertTrue(re.search(r'Websites/ChangeLog', patch).start() < re.search(r'LayoutTests/ChangeLog', patch).start())
+
+        self.assertTrue(re.search(r'Source/ChangeFile', patch).start() < re.search(r'LayoutTests/ChangeLog', patch).start())
+        self.assertTrue(re.search(r'Tools/ChangeFile', patch).start() < re.search(r'LayoutTests/ChangeLog', patch).start())
+        self.assertTrue(re.search(r'Websites/ChangeFile', patch).start() < re.search(r'LayoutTests/ChangeLog', patch).start())
+
+        self.assertTrue(re.search(r'Source/ChangeFile', patch).start() < re.search(r'LayoutTests/ChangeFile', patch).start())
+        self.assertTrue(re.search(r'Tools/ChangeFile', patch).start() < re.search(r'LayoutTests/ChangeFile', patch).start())
+        self.assertTrue(re.search(r'Websites/ChangeFile', patch).start() < re.search(r'LayoutTests/ChangeFile', patch).start())
+
     def test_exists(self):
         scm = self.untracking_scm
         self._shared_test_exists(scm, scm.commit_locally_with_message)

Added: trunk/Tools/Scripts/webkitpy/common/config/orderfile (0 => 97561)


--- trunk/Tools/Scripts/webkitpy/common/config/orderfile	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/common/config/orderfile	2011-10-15 19:14:37 UTC (rev 97561)
@@ -0,0 +1,8 @@
+Source*ChangeLog
+Source*
+Tools*ChangeLog
+Tools*
+Websites*ChangeLog
+Websites*
+LayoutTests*ChangeLog
+LayoutTests*
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to