WebKit Bugzilla
Attachment 343360 Details for
Bug 186810
: [style] Fix --git-index option for check-webkit-style command
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
fix
186810.diff (text/plain), 4.04 KB, created by
Basuke Suzuki
on 2018-06-22 13:33:11 PDT
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Basuke Suzuki
Created:
2018-06-22 13:33:11 PDT
Size:
4.04 KB
patch
obsolete
>diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 408f6f2f2cf..936f48f2548 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2018-06-21 Basuke Suzuki <Basuke.Suzuki@sony.com> >+ >+ [style] Fix --git-index option for check-webkit-style command >+ https://bugs.webkit.org/show_bug.cgi?id=186810 >+ >+ When --git-index is specified, it should be compared with HEAD, not the origin/master. >+ >+ Reviewed by Daniel Bates. >+ >+ * Scripts/webkitpy/common/checkout/scm/git.py: >+ (Git.create_patch): >+ * Scripts/webkitpy/common/checkout/scm/scm_unittest.py: >+ (test_create_patch_with_git_index): Added. >+ > 2018-06-19 Leo Balter <leonardo.balter@gmail.com> > > [test262-runner] Reduce flakiness of unit tests for the runner >diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/Tools/Scripts/webkitpy/common/checkout/scm/git.py >index 8d30ee41eab..865d3b01583 100644 >--- a/Tools/Scripts/webkitpy/common/checkout/scm/git.py >+++ b/Tools/Scripts/webkitpy/common/checkout/scm/git.py >@@ -327,21 +327,24 @@ class Git(SCM, SVNRepository): > > 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.""" >+ 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. >+ """ > > # 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 = "" >+ order = '' > if self._filesystem.exists(order_file): >- order = "-O%s" % order_file >+ order = '-O' + 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] > if git_index: > command += ['--cached'] >- command += ["--"] >+ else: >+ command += [self.merge_base(git_commit)] >+ command += ['--'] > if changed_files: > command += changed_files > return self.prepend_svn_revision(self.run(command, decode_output=False, cwd=self.checkout_root)) >diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py >index 2fa58ba0c00..85045645b5e 100644 >--- a/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py >+++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py >@@ -1021,6 +1021,26 @@ class GitTest(SCMTest): > patch = scm.create_patch() > self.assertNotRegexpMatches(patch, r'Subversion Revision:') > >+ def test_create_patch_with_git_index(self): >+ # First change. Committed. >+ write_into_file_at_path('test_file_commit1', 'first cat') >+ run_command(['git', 'add', 'test_file_commit1']) >+ scm = self.tracking_scm >+ scm.commit_locally_with_message('message') >+ >+ # Second change. Staged but not committed. >+ write_into_file_at_path('test_file_commit1', 'second dog') >+ run_command(['git', 'add', 'test_file_commit1']) >+ >+ # Third change. Not even staged. >+ write_into_file_at_path('test_file_commit1', 'third unicorn') >+ >+ patch = scm.create_patch(None, None, True) >+ self.assertRegexpMatches(patch, r'-first cat') >+ self.assertRegexpMatches(patch, r'\+second dog') >+ self.assertNotRegexpMatches(patch, r'third') >+ self.assertNotRegexpMatches(patch, r'unicorn') >+ > def test_orderfile(self): > os.mkdir("Tools") > os.mkdir("Source")
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186810
:
343082
|
343273
|
343287
|
343300
| 343360