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)