Changeset 92609 in webkit


Ignore:
Timestamp:
Aug 8, 2011 11:02:59 AM (13 years ago)
Author:
jochen@chromium.org
Message:

webkit-patch doesn't get along with renamed files
https://bugs.webkit.org/show_bug.cgi?id=48075

Possibly a bit heavy handed - I removed all instances of -C and
changed every instance of -M with '--no-renames' in git.py. This
forces git to not try to tell us about renames at all, which is
ultimately the behaviour we want. The old file is shown deleted,
then the new file is shown added, followed by any changes that
occurred. Also gets rid of the problem where deleting one file
and adding another file which has similar content would
unexpectedly show up as a rename, and fall out of a diff.

Based on a patch by Wyatt Carss.

Reviewed by Eric Seidel.

  • Scripts/webkitpy/common/checkout/scm/git.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r92571 r92609  
     12011-08-08  Jochen Eisinger  <jochen@chromium.org>
     2
     3        webkit-patch doesn't get along with renamed files
     4        https://bugs.webkit.org/show_bug.cgi?id=48075
     5
     6        Possibly a bit heavy handed - I removed all instances of -C and
     7        changed every instance of -M with '--no-renames' in git.py. This
     8        forces git to not try to tell us about renames at all, which is
     9        ultimately the behaviour we want. The old file is shown deleted,
     10        then the new file is shown added, followed by any changes that
     11        occurred. Also gets rid of the problem where deleting one file
     12        and adding another file which has similar content would
     13        unexpectedly show up as a rename, and fall out of a diff.
     14
     15        Based on a patch by Wyatt Carss.
     16
     17        Reviewed by Eric Seidel.
     18
     19        * Scripts/webkitpy/common/checkout/scm/git.py:
     20
    1212011-08-07  Sam White  <samuel.white@rochester.edu>
    222
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py

    r92440 r92609  
    145145
    146146    def working_directory_is_clean(self):
    147         return self.run(['git', 'diff', 'HEAD', '--name-only'], cwd=self.checkout_root) == ""
     147        return self.run(['git', 'diff', 'HEAD', '--no-renames', '--name-only'], cwd=self.checkout_root) == ""
    148148
    149149    def clean_working_directory(self):
     
    158158        # git status returns non-zero when there are changes, so we use git diff name --name-status HEAD instead.
    159159        # No file contents printed, thus utf-8 autodecoding in self.run is fine.
    160         return ["git", "diff", "--name-status", "HEAD"]
     160        return ["git", "diff", "--name-status", "--no-renames", "HEAD"]
    161161
    162162    def _status_regexp(self, expected_types):
     
    187187    def changed_files(self, git_commit=None):
    188188        # FIXME: --diff-filter could be used to avoid the "extract_filenames" step.
    189         status_command = ['git', 'diff', '-r', '--name-status', '-C', '-M', "--no-ext-diff", "--full-index", self.merge_base(git_commit)]
     189        status_command = ['git', 'diff', '-r', '--name-status', "--no-renames", "--no-ext-diff", "--full-index", self.merge_base(git_commit)]
    190190        # FIXME: I'm not sure we're returning the same set of files that SVN.changed_files is.
    191191        # Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)
     
    210210        # We do not need to pass decode_output for this diff command
    211211        # as we're passing --name-status which does not output any data.
    212         status_command = ['git', 'diff', '--name-status', '-C', '-M', '--diff-filter=U']
     212        status_command = ['git', 'diff', '--name-status', '--no-renames', '--diff-filter=U']
    213213        return self.run_status_and_extract_filenames(status_command, self._status_regexp("U"))
    214214
     
    245245        Patch files are effectively binary since they may contain
    246246        files of multiple different encodings."""
    247         command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "-M", self.merge_base(git_commit), "--"]
     247        command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "--no-renames", self.merge_base(git_commit), "--"]
    248248        if changed_files:
    249249            command += changed_files
     
    283283
    284284    def diff_for_file(self, path, log=None):
    285         return self.run(['git', 'diff', 'HEAD', '--', path], cwd=self.checkout_root)
     285        return self.run(['git', 'diff', 'HEAD', '--no-renames', '--', path], cwd=self.checkout_root)
    286286
    287287    def show_head(self, path):
     
    463463
    464464    def files_changed_summary_for_commit(self, commit_id):
    465         return self.run(['git', 'diff-tree', '--shortstat', '--no-commit-id', commit_id])
     465        return self.run(['git', 'diff-tree', '--shortstat', '--no-renames', '--no-commit-id', commit_id])
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py

    r91210 r92609  
    963963        self.assertEqual(scm.head_svn_revision(), '')
    964964
     965    def test_rename_files(self):
     966        scm = self.tracking_scm
     967
     968        run_command(['git', 'mv', 'foo_file', 'bar_file'])
     969        scm.commit_locally_with_message('message')
     970
     971        patch = scm.create_patch()
     972        self.assertFalse(re.search(r'rename from ', patch))
     973        self.assertFalse(re.search(r'rename to ', patch))
     974
     975
    965976class GitSVNTest(SCMTest):
    966977
Note: See TracChangeset for help on using the changeset viewer.