~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Patch Queue Manager
  • Date: 2012-03-12 13:38:09 UTC
  • mfrom: (6478.2.1 path2id-list)
  • Revision ID: pqm@pqm.ubuntu.com-20120312133809-q6xr6ujz40gpucun
(jelmer) Reintroduce support for passing lists to Tree.path2id(). (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
894
894
    @needs_read_lock
895
895
    def path2id(self, path):
896
896
        """Return the id for path in this tree."""
 
897
        if isinstance(path, list):
 
898
            if path == []:
 
899
                path = [""]
 
900
            path = osutils.pathjoin(*path)
897
901
        path = path.strip('/')
898
902
        entry = self._get_entry(path=path)
899
903
        if entry == (None, None):
1777
1781
        if path is not None:
1778
1782
            path = path.encode('utf8')
1779
1783
        parent_index = self._get_parent_index()
1780
 
        return self._dirstate._get_entry(parent_index, fileid_utf8=file_id, path_utf8=path)
 
1784
        return self._dirstate._get_entry(parent_index, fileid_utf8=file_id,
 
1785
            path_utf8=path)
1781
1786
 
1782
1787
    def _generate_inventory(self):
1783
1788
        """Create and set self.inventory from the dirstate object.
2029
2034
    def path2id(self, path):
2030
2035
        """Return the id for path in this tree."""
2031
2036
        # lookup by path: faster than splitting and walking the ivnentory.
 
2037
        if isinstance(path, list):
 
2038
            if path == []:
 
2039
                path = [""]
 
2040
            path = osutils.pathjoin(*path)
2032
2041
        entry = self._get_entry(path=path)
2033
2042
        if entry == (None, None):
2034
2043
            return None