~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Jelmer Vernooij
  • Date: 2012-03-05 17:29:08 UTC
  • mto: This revision was merged to the branch mainline in revision 6495.
  • Revision ID: jelmer@samba.org-20120305172908-diwejxq31xmy3sbl
Accept path element list as argument to Tree.path2id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2111
2111
    def path2id(self, relpath):
2112
2112
        """See CommonInventory.path2id()."""
2113
2113
        # TODO: perhaps support negative hits?
 
2114
        if isinstance(relpath, basestring):
 
2115
            names = osutils.splitpath(relpath)
 
2116
        else:
 
2117
            names = relpath
 
2118
            if relpath == []:
 
2119
                relpath = [""]
 
2120
            relpath = osutils.pathjoin(*relpath)
2114
2121
        result = self._path_to_fileid_cache.get(relpath, None)
2115
2122
        if result is not None:
2116
2123
            return result
2117
 
        if isinstance(relpath, basestring):
2118
 
            names = osutils.splitpath(relpath)
2119
 
        else:
2120
 
            names = relpath
2121
2124
        current_id = self.root_id
2122
2125
        if current_id is None:
2123
2126
            return None