/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Robert Collins
  • Date: 2007-09-20 07:03:33 UTC
  • mto: (2843.1.1 ianc-integration2)
  • mto: This revision was merged to the branch mainline in revision 2844.
  • Revision ID: robertc@robertcollins.net-20070920070333-eedxrxidkignx4i1
* Partial commits are now approximately 40% faster by walking over the
  unselected current tree more efficiently. (Robert Collins)

* New method ``bzrlib.osutils.minimum_path_selection`` useful for removing
  duplication from user input, when a user mentions both a path and an item
  contained within that path. (Robert Collins)

* New parameter yield_parents on ``Inventory.iter_entries_by_dir`` which
  causes the parents of a selected id to be returned recursively, so all the
  paths from the root down to each element of selected_file_ids are
  returned. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
        os.chmod(filename, mod)
88
88
 
89
89
 
 
90
def minimum_path_selection(paths):
 
91
    """Return the smallset subset of paths which are outside paths.
 
92
 
 
93
    :param: A container of paths.
 
94
    :return: A set of paths sufficient to include everything in paths via
 
95
        is_inside_any, drawn from the paths parameter.
 
96
    """
 
97
    search_paths = set()
 
98
    paths = set(paths)
 
99
    for path in paths:
 
100
        other_paths = paths.difference(set([path]))
 
101
        if not is_inside_any(other_paths, path):
 
102
            # this is a top level path, we must check it.
 
103
            search_paths.add(path)
 
104
    return search_paths
 
105
 
 
106
 
90
107
_QUOTE_RE = None
91
108
 
92
109