Diff
Modified: trunk/Tools/ChangeLog (167925 => 167926)
--- trunk/Tools/ChangeLog 2014-04-29 09:34:31 UTC (rev 167925)
+++ trunk/Tools/ChangeLog 2014-04-29 10:19:37 UTC (rev 167926)
@@ -1,3 +1,23 @@
+2014-04-29 Jozsef Berta <jberta.u-sze...@partner.samsung.com>
+
+ check-webkit-style should understand --git-index
+ https://bugs.webkit.org/show_bug.cgi?id=125364
+
+ Reviewed by Csaba Osztrogonác.
+
+ * Scripts/webkitpy/common/checkout/scm/git.py:
+ (Git.create_patch): The command now supports the --cached option.
+ * Scripts/webkitpy/style/main.py:
+ (CheckWebKitStyle.main): Passing the --git-index option.
+ * Scripts/webkitpy/style/optparser.py:
+ (CommandOptionValues.__init__): The git-index option is switched off by default.
+ (CommandOptionValues.__eq__): Equality check for the new option.
+ (ArgumentParser._create_option_parser):Adding the --git-index option
+ (ArgumentParser.parse):
+ * Scripts/webkitpy/style/optparser_unittest.py: New tests for the --git-index option
+ (CommandOptionValuesTest.test_init):
+ (CommandOptionValuesTest.test_eq):
+
2014-04-28 Michael Saboff <msab...@apple.com>
Crash in platform/mac/accessibility/table-visible-rows.html
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (167925 => 167926)
--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py 2014-04-29 09:34:31 UTC (rev 167925)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py 2014-04-29 10:19:37 UTC (rev 167926)
@@ -280,7 +280,7 @@
return "Subversion Revision: " + revision + '\n' + diff
- def create_patch(self, git_commit=None, changed_files=None):
+ def create_patch(self, git_commit=None, changed_files=None, git_index=False):
"""Returns a byte array (str()) representing the patch file.
Patch files are effectively binary since they may contain
files of multiple different encodings."""
@@ -293,7 +293,10 @@
if self._filesystem.exists(order_file):
order = "-O%s" % order_file
- command = [self.executable_name, 'diff', '--binary', '--no-color', "--no-ext-diff", "--full-index", "--no-renames", order, self.merge_base(git_commit), "--"]
+ command = [self.executable_name, 'diff', '--binary', '--no-color', "--no-ext-diff", "--full-index", "--no-renames", order, self.merge_base(git_commit)]
+ if git_index:
+ command += ['--cached']
+ command += ["--"]
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/style/main.py (167925 => 167926)
--- trunk/Tools/Scripts/webkitpy/style/main.py 2014-04-29 09:34:31 UTC (rev 167925)
+++ trunk/Tools/Scripts/webkitpy/style/main.py 2014-04-29 10:19:37 UTC (rev 167926)
@@ -149,7 +149,7 @@
file_reader.process_paths(paths)
else:
changed_files = paths if options.diff_files else None
- patch = host.scm().create_patch(options.git_commit, changed_files=changed_files)
+ patch = host.scm().create_patch(options.git_commit, changed_files=changed_files, git_index=options.git_index)
patch_checker = PatchReader(file_reader)
patch_checker.check(patch)
Modified: trunk/Tools/Scripts/webkitpy/style/optparser.py (167925 => 167926)
--- trunk/Tools/Scripts/webkitpy/style/optparser.py 2014-04-29 09:34:31 UTC (rev 167925)
+++ trunk/Tools/Scripts/webkitpy/style/optparser.py 2014-04-29 10:19:37 UTC (rev 167926)
@@ -149,7 +149,8 @@
is_verbose=False,
min_confidence=1,
output_format="emacs",
- commit_queue=False):
+ commit_queue=False,
+ git_index=False):
if filter_rules is None:
filter_rules = []
@@ -170,6 +171,7 @@
self.min_confidence = min_confidence
self.output_format = output_format
self.commit_queue = commit_queue
+ self.git_index = git_index
# Useful for unit testing.
def __eq__(self, other):
@@ -186,6 +188,8 @@
return False
if self.output_format != other.output_format:
return False
+ if self.git_index != other.git_index:
+ return False
return True
@@ -341,6 +345,7 @@
commit_queue_help = "force commit queue to check contributors.json change"
parser.add_option("--commit-queue", action="" dest="commit_queue", default=False, help=commit_queue_help)
+ parser.add_option("--git-index", action="" dest="git_index", default=False, help="Scan staged files only")
# Override OptionParser's error() method so that option help will
# also display when an error occurs. Normally, just the usage
@@ -428,6 +433,7 @@
min_confidence = options.min_confidence
output_format = options.output_format
commit_queue = options.commit_queue
+ git_index = options.git_index
if filter_value is not None and not filter_value:
# Then the user explicitly passed no filter, for
@@ -458,7 +464,8 @@
is_verbose=is_verbose,
min_confidence=min_confidence,
output_format=output_format,
- commit_queue=commit_queue)
+ commit_queue=commit_queue,
+ git_index=git_index)
return (paths, options)
Modified: trunk/Tools/Scripts/webkitpy/style/optparser_unittest.py (167925 => 167926)
--- trunk/Tools/Scripts/webkitpy/style/optparser_unittest.py 2014-04-29 09:34:31 UTC (rev 167925)
+++ trunk/Tools/Scripts/webkitpy/style/optparser_unittest.py 2014-04-29 10:19:37 UTC (rev 167926)
@@ -204,6 +204,7 @@
self.assertFalse(options.is_verbose)
self.assertEqual(options.min_confidence, 1)
self.assertEqual(options.output_format, "emacs")
+ self.assertFalse(options.git_index)
# Check argument validation.
self.assertRaises(ValueError, ProcessorOptions, output_format="bad")
@@ -219,12 +220,14 @@
git_commit="commit",
is_verbose=True,
min_confidence=3,
- output_format="vs7")
+ output_format="vs7",
+ git_index=True)
self.assertEqual(options.filter_rules, ["+"])
self.assertEqual(options.git_commit, "commit")
self.assertTrue(options.is_verbose)
self.assertEqual(options.min_confidence, 3)
self.assertEqual(options.output_format, "vs7")
+ self.assertTrue(options.git_index)
def test_eq(self):
"""Test __eq__ equality function."""
@@ -239,7 +242,8 @@
git_commit=None,
is_verbose=False,
min_confidence=1,
- output_format="emacs")
+ output_format="emacs",
+ git_index=False)
# Verify that we created options correctly.
self.assertTrue(options.__eq__(ProcessorOptions()))
@@ -248,6 +252,7 @@
self.assertFalse(options.__eq__(ProcessorOptions(is_verbose=True)))
self.assertFalse(options.__eq__(ProcessorOptions(min_confidence=2)))
self.assertFalse(options.__eq__(ProcessorOptions(output_format="vs7")))
+ self.assertFalse(options.__eq__(ProcessorOptions(git_index=True)))
def test_ne(self):
"""Test __ne__ inequality function."""