/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: Alexander Belchenko
  • Date: 2007-10-04 05:50:44 UTC
  • mfrom: (2881 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2884.
  • Revision ID: bialix@ukr.net-20071004055044-pb88kgkfayawro8n
merge bzr.dev

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 paths: A container (and hence not None) 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([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
 
537
554
 
538
555
 
539
556
def pumpfile(fromfile, tofile):
540
 
    """Copy contents of one file to another."""
 
557
    """Copy contents of one file to another.
 
558
    
 
559
    :return: The number of bytes copied.
 
560
    """
541
561
    BUFSIZE = 32768
 
562
    length = 0
542
563
    while True:
543
564
        b = fromfile.read(BUFSIZE)
544
565
        if not b:
545
566
            break
546
567
        tofile.write(b)
 
568
        length += len(b)
 
569
    return length
547
570
 
548
571
 
549
572
def file_iterator(input_file, readsize=32768):