Changeset 56891 in webkit


Ignore:
Timestamp:
Mar 31, 2010 8:49:43 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-31 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

webkit-patch land fails if not run from the root directory
https://bugs.webkit.org/show_bug.cgi?id=35822

The root of the problem was that ChangeLog.init expects a path
relative to the current working directory, and SCM expects to
return paths relative to the SCM root. Fix it by converting from
SCM-relative to absolute paths in Checkout.modified_changelogs

  • Scripts/webkitpy/common/checkout/api.py:
  • Scripts/webkitpy/common/checkout/api_unittest.py:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r56889 r56891  
     12010-03-31  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        webkit-patch land fails if not run from the root directory
     6        https://bugs.webkit.org/show_bug.cgi?id=35822
     7
     8        The root of the problem was that ChangeLog.__init__ expects a path
     9        relative to the current working directory, and SCM expects to
     10        return paths relative to the SCM root.  Fix it by converting from
     11        SCM-relative to absolute paths in Checkout.modified_changelogs
     12
     13        * Scripts/webkitpy/common/checkout/api.py:
     14        * Scripts/webkitpy/common/checkout/api_unittest.py:
     15
    1162010-03-31  Adam Barth  <abarth@webkit.org>
    217
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/api.py

    r56888 r56891  
    8080
    8181    def modified_changelogs(self):
    82         return [path for path in self._scm.changed_files() if self._is_path_to_changelog(path)]
     82        # SCM returns paths relative to scm.checkout_root
     83        # Callers (especially those using the ChangeLog class) may
     84        # expect absolute paths, so this method returns absolute paths.
     85        changed_files = self._scm.changed_files()
     86        absolute_paths = [os.path.join(self._scm.checkout_root, path) for path in changed_files]
     87        return [path for path in absolute_paths if self._is_path_to_changelog(path)]
    8388
    8489    def commit_message_for_this_commit(self):
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/api_unittest.py

    r56889 r56891  
    157157        checkout.commit_message_for_this_commit = lambda: CommitMessage(ChangeLogEntry(_changelog1entry1).contents().splitlines())
    158158        self.assertEqual(checkout.bug_id_for_this_commit(), 36629)
     159
     160    def test_modified_changelogs(self):
     161        scm = Mock()
     162        scm.checkout_root = "/foo/bar"
     163        scm.changed_files = lambda:["file1", "ChangeLog", "relative/path/ChangeLog"]
     164        checkout = Checkout(scm)
     165        expected_changlogs = ["/foo/bar/ChangeLog", "/foo/bar/relative/path/ChangeLog"]
     166        self.assertEqual(checkout.modified_changelogs(), expected_changlogs)
Note: See TracChangeset for help on using the changeset viewer.