~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-20 12:40:02 UTC
  • mfrom: (6468.2.8 bzr)
  • Revision ID: pqm@pqm.ubuntu.com-20120220124002-0wte938ee8s7k0pm
(jelmer) Avoid direct access of tree inventories in a couple more places.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
850
850
            descend(self.root, u'')
851
851
        return accum
852
852
 
853
 
    def directories(self):
854
 
        """Return (path, entry) pairs for all directories, including the root.
855
 
        """
856
 
        accum = []
857
 
        def descend(parent_ie, parent_path):
858
 
            accum.append((parent_path, parent_ie))
859
 
 
860
 
            kids = [(ie.name, ie) for ie in parent_ie.children.itervalues() if ie.kind == 'directory']
861
 
            kids.sort()
862
 
 
863
 
            for name, child_ie in kids:
864
 
                child_path = osutils.pathjoin(parent_path, name)
865
 
                descend(child_ie, child_path)
866
 
        descend(self.root, u'')
867
 
        return accum
868
 
 
869
853
    def path2id(self, relpath):
870
854
        """Walk down through directories to return entry of last component.
871
855