~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Johan Walles
  • Date: 2009-05-07 04:58:58 UTC
  • mto: This revision was merged to the branch mainline in revision 4343.
  • Revision ID: johan.walles@gmail.com-20090507045858-kbpp96c2qtqj0l8v
Style fixes for minimum_path_selection().

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
    :return: A set of paths sufficient to include everything in paths via
100
100
        is_inside, drawn from the paths parameter.
101
101
    """
102
 
    search_paths = []
 
102
    if len(paths) < 2:
 
103
        return set(paths)
103
104
 
104
105
    def sort_key(path):
105
106
        return path.split('/')
106
107
    sorted_paths = sorted(list(paths), key=sort_key)
107
108
 
108
 
    for path in sorted_paths:
109
 
        if len(search_paths) == 0:
110
 
            # Result is empty, add first path
111
 
            search_paths.append(path)
112
 
            continue
 
109
    search_paths = [sorted_paths[0]]
 
110
    for path in sorted_paths[1:]:
113
111
        if not is_inside(search_paths[-1], path):
114
112
            # This path is unique, add it
115
113
            search_paths.append(path)
116
 
            continue
 
114
 
117
115
    return set(search_paths)
118
116
 
119
117