~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

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
 
853
869
    def path2id(self, relpath):
854
870
        """Walk down through directories to return entry of last component.
855
871