~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Vincent Ladeuil
  • Date: 2011-12-16 16:38:33 UTC
  • mto: This revision was merged to the branch mainline in revision 6387.
  • Revision ID: v.ladeuil+lp@free.fr-20111216163833-4igwmwi1dmxbbebw
Migrate add.maximum_file_size to the new config scheme

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
# But those depend on its position within a particular inventory, and
24
24
# it would be nice not to need to hold the backpointer here.
25
25
 
26
 
from __future__ import absolute_import
27
 
 
28
26
# This should really be an id randomly assigned when the tree is
29
27
# created, but it's not for now.
30
28
ROOT_ID = "TREE_ROOT"
850
848
            descend(self.root, u'')
851
849
        return accum
852
850
 
 
851
    def directories(self):
 
852
        """Return (path, entry) pairs for all directories, including the root.
 
853
        """
 
854
        accum = []
 
855
        def descend(parent_ie, parent_path):
 
856
            accum.append((parent_path, parent_ie))
 
857
 
 
858
            kids = [(ie.name, ie) for ie in parent_ie.children.itervalues() if ie.kind == 'directory']
 
859
            kids.sort()
 
860
 
 
861
            for name, child_ie in kids:
 
862
                child_path = osutils.pathjoin(parent_path, name)
 
863
                descend(child_ie, child_path)
 
864
        descend(self.root, u'')
 
865
        return accum
 
866
 
853
867
    def path2id(self, relpath):
854
868
        """Walk down through directories to return entry of last component.
855
869