~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Robert Collins
  • Date: 2005-10-05 05:29:27 UTC
  • mfrom: (1393.1.51)
  • Revision ID: robertc@robertcollins.net-20051005052926-03d3a49e1dbcb670
mergeĀ fromĀ martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
915
915
 
916
916
 
917
917
    def id2path(self, file_id):
918
 
        """Return as a list the path to file_id."""
919
 
 
 
918
        """Return as a list the path to file_id.
 
919
        
 
920
        >>> i = Inventory()
 
921
        >>> e = i.add(InventoryDirectory('src-id', 'src', ROOT_ID))
 
922
        >>> e = i.add(InventoryFile('foo-id', 'foo.c', parent_id='src-id'))
 
923
        >>> print i.id2path('foo-id').replace(os.sep, '/')
 
924
        src/foo.c
 
925
        """
920
926
        # get all names, skipping root
921
927
        p = [self._byid[fid].name for fid in self.get_idpath(file_id)[1:]]
922
928
        return os.sep.join(p)