<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167926] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167926">167926</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-04-29 03:19:37 -0700 (Tue, 29 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>check-webkit-style should understand --git-index
https://bugs.webkit.org/show_bug.cgi?id=125364

Patch by Jozsef Berta &lt;jberta.u-szeged@partner.samsung.com&gt; on 2014-04-29
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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpycommoncheckoutscmgitpy">trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py</a></li>
<li><a href="#trunkToolsScriptswebkitpystylemainpy">trunk/Tools/Scripts/webkitpy/style/main.py</a></li>
<li><a href="#trunkToolsScriptswebkitpystyleoptparserpy">trunk/Tools/Scripts/webkitpy/style/optparser.py</a></li>
<li><a href="#trunkToolsScriptswebkitpystyleoptparser_unittestpy">trunk/Tools/Scripts/webkitpy/style/optparser_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (167925 => 167926)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-04-29 09:34:31 UTC (rev 167925)
+++ trunk/Tools/ChangeLog        2014-04-29 10:19:37 UTC (rev 167926)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-04-29  Jozsef Berta  &lt;jberta.u-szeged@partner.samsung.com&gt;
+
+        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):
+
</ins><span class="cx"> 2014-04-28  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Crash in platform/mac/accessibility/table-visible-rows.html
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommoncheckoutscmgitpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (167925 => 167926)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -280,7 +280,7 @@
</span><span class="cx"> 
</span><span class="cx">         return &quot;Subversion Revision: &quot; + revision + '\n' + diff
</span><span class="cx"> 
</span><del>-    def create_patch(self, git_commit=None, changed_files=None):
</del><ins>+    def create_patch(self, git_commit=None, changed_files=None, git_index=False):
</ins><span class="cx">         &quot;&quot;&quot;Returns a byte array (str()) representing the patch file.
</span><span class="cx">         Patch files are effectively binary since they may contain
</span><span class="cx">         files of multiple different encodings.&quot;&quot;&quot;
</span><span class="lines">@@ -293,7 +293,10 @@
</span><span class="cx">         if self._filesystem.exists(order_file):
</span><span class="cx">             order = &quot;-O%s&quot; % order_file
</span><span class="cx"> 
</span><del>-        command = [self.executable_name, 'diff', '--binary', '--no-color', &quot;--no-ext-diff&quot;, &quot;--full-index&quot;, &quot;--no-renames&quot;, order, self.merge_base(git_commit), &quot;--&quot;]
</del><ins>+        command = [self.executable_name, 'diff', '--binary', '--no-color', &quot;--no-ext-diff&quot;, &quot;--full-index&quot;, &quot;--no-renames&quot;, order, self.merge_base(git_commit)]
+        if git_index:
+            command += ['--cached']
+        command += [&quot;--&quot;]
</ins><span class="cx">         if changed_files:
</span><span class="cx">             command += changed_files
</span><span class="cx">         return self.prepend_svn_revision(self.run(command, decode_output=False, cwd=self.checkout_root))
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpystylemainpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/style/main.py (167925 => 167926)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx">             file_reader.process_paths(paths)
</span><span class="cx">         else:
</span><span class="cx">             changed_files = paths if options.diff_files else None
</span><del>-            patch = host.scm().create_patch(options.git_commit, changed_files=changed_files)
</del><ins>+            patch = host.scm().create_patch(options.git_commit, changed_files=changed_files, git_index=options.git_index)
</ins><span class="cx">             patch_checker = PatchReader(file_reader)
</span><span class="cx">             patch_checker.check(patch)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpystyleoptparserpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/style/optparser.py (167925 => 167926)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -149,7 +149,8 @@
</span><span class="cx">                  is_verbose=False,
</span><span class="cx">                  min_confidence=1,
</span><span class="cx">                  output_format=&quot;emacs&quot;,
</span><del>-                 commit_queue=False):
</del><ins>+                 commit_queue=False,
+                 git_index=False):
</ins><span class="cx">         if filter_rules is None:
</span><span class="cx">             filter_rules = []
</span><span class="cx"> 
</span><span class="lines">@@ -170,6 +171,7 @@
</span><span class="cx">         self.min_confidence = min_confidence
</span><span class="cx">         self.output_format = output_format
</span><span class="cx">         self.commit_queue = commit_queue
</span><ins>+        self.git_index = git_index
</ins><span class="cx"> 
</span><span class="cx">     # Useful for unit testing.
</span><span class="cx">     def __eq__(self, other):
</span><span class="lines">@@ -186,6 +188,8 @@
</span><span class="cx">             return False
</span><span class="cx">         if self.output_format != other.output_format:
</span><span class="cx">             return False
</span><ins>+        if self.git_index != other.git_index:
+            return False
</ins><span class="cx"> 
</span><span class="cx">         return True
</span><span class="cx"> 
</span><span class="lines">@@ -341,6 +345,7 @@
</span><span class="cx"> 
</span><span class="cx">         commit_queue_help = &quot;force commit queue to check contributors.json change&quot;
</span><span class="cx">         parser.add_option(&quot;--commit-queue&quot;, action=&quot;store_true&quot;, dest=&quot;commit_queue&quot;, default=False, help=commit_queue_help)
</span><ins>+        parser.add_option(&quot;--git-index&quot;, action=&quot;store_true&quot;, dest=&quot;git_index&quot;, default=False, help=&quot;Scan staged files only&quot;)
</ins><span class="cx"> 
</span><span class="cx">         # Override OptionParser's error() method so that option help will
</span><span class="cx">         # also display when an error occurs.  Normally, just the usage
</span><span class="lines">@@ -428,6 +433,7 @@
</span><span class="cx">         min_confidence = options.min_confidence
</span><span class="cx">         output_format = options.output_format
</span><span class="cx">         commit_queue = options.commit_queue
</span><ins>+        git_index = options.git_index
</ins><span class="cx"> 
</span><span class="cx">         if filter_value is not None and not filter_value:
</span><span class="cx">             # Then the user explicitly passed no filter, for
</span><span class="lines">@@ -458,7 +464,8 @@
</span><span class="cx">                                       is_verbose=is_verbose,
</span><span class="cx">                                       min_confidence=min_confidence,
</span><span class="cx">                                       output_format=output_format,
</span><del>-                                      commit_queue=commit_queue)
</del><ins>+                                      commit_queue=commit_queue,
+                                      git_index=git_index)
</ins><span class="cx"> 
</span><span class="cx">         return (paths, options)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpystyleoptparser_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/style/optparser_unittest.py (167925 => 167926)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -204,6 +204,7 @@
</span><span class="cx">         self.assertFalse(options.is_verbose)
</span><span class="cx">         self.assertEqual(options.min_confidence, 1)
</span><span class="cx">         self.assertEqual(options.output_format, &quot;emacs&quot;)
</span><ins>+        self.assertFalse(options.git_index)
</ins><span class="cx"> 
</span><span class="cx">         # Check argument validation.
</span><span class="cx">         self.assertRaises(ValueError, ProcessorOptions, output_format=&quot;bad&quot;)
</span><span class="lines">@@ -219,12 +220,14 @@
</span><span class="cx">                                    git_commit=&quot;commit&quot;,
</span><span class="cx">                                    is_verbose=True,
</span><span class="cx">                                    min_confidence=3,
</span><del>-                                   output_format=&quot;vs7&quot;)
</del><ins>+                                   output_format=&quot;vs7&quot;,
+                                   git_index=True)
</ins><span class="cx">         self.assertEqual(options.filter_rules, [&quot;+&quot;])
</span><span class="cx">         self.assertEqual(options.git_commit, &quot;commit&quot;)
</span><span class="cx">         self.assertTrue(options.is_verbose)
</span><span class="cx">         self.assertEqual(options.min_confidence, 3)
</span><span class="cx">         self.assertEqual(options.output_format, &quot;vs7&quot;)
</span><ins>+        self.assertTrue(options.git_index)
</ins><span class="cx"> 
</span><span class="cx">     def test_eq(self):
</span><span class="cx">         &quot;&quot;&quot;Test __eq__ equality function.&quot;&quot;&quot;
</span><span class="lines">@@ -239,7 +242,8 @@
</span><span class="cx">                                    git_commit=None,
</span><span class="cx">                                    is_verbose=False,
</span><span class="cx">                                    min_confidence=1,
</span><del>-                                   output_format=&quot;emacs&quot;)
</del><ins>+                                   output_format=&quot;emacs&quot;,
+                                   git_index=False)
</ins><span class="cx">         # Verify that we created options correctly.
</span><span class="cx">         self.assertTrue(options.__eq__(ProcessorOptions()))
</span><span class="cx"> 
</span><span class="lines">@@ -248,6 +252,7 @@
</span><span class="cx">         self.assertFalse(options.__eq__(ProcessorOptions(is_verbose=True)))
</span><span class="cx">         self.assertFalse(options.__eq__(ProcessorOptions(min_confidence=2)))
</span><span class="cx">         self.assertFalse(options.__eq__(ProcessorOptions(output_format=&quot;vs7&quot;)))
</span><ins>+        self.assertFalse(options.__eq__(ProcessorOptions(git_index=True)))
</ins><span class="cx"> 
</span><span class="cx">     def test_ne(self):
</span><span class="cx">         &quot;&quot;&quot;Test __ne__ inequality function.&quot;&quot;&quot;
</span></span></pre>
</div>
</div>

</body>
</html>