~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-23 16:48:41 UTC
  • mto: (6437.41.3 rmbranch-active)
  • mto: This revision was merged to the branch mainline in revision 6481.
  • Revision ID: jelmer@samba.org-20120223164841-eyy9xljbpblkchba
Support colocated branches in 'bzr rmbranch'.

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