~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-05-18 22:41:44 UTC
  • mfrom: (4371.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090518224144-3izdthppda5ievhg
(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: