~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Ian Clatworthy
  • Date: 2009-05-18 21:48:44 UTC
  • mfrom: (4370.1.1 parent-directories)
  • mto: This revision was merged to the branch mainline in revision 4372.
  • Revision ID: ian.clatworthy@canonical.com-20090518214844-r8drldt0v3kt7ue6
(igc) added osutils.parent_directories() (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
867
867
    return pathjoin(*p)
868
868
 
869
869
 
 
870
def parent_directories(filename):
 
871
    """Return the list of parent directories, deepest first.
 
872
    
 
873
    For example, parent_directories("a/b/c") -> ["a/b", "a"].
 
874
    """
 
875
    parents = []
 
876
    parts = splitpath(dirname(filename))
 
877
    while parts:
 
878
        parents.append(joinpath(parts))
 
879
        parts.pop()
 
880
    return parents
 
881
 
 
882
 
870
883
try:
871
884
    from bzrlib._chunks_to_lines_pyx import chunks_to_lines
872
885
except ImportError: