/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/_dirstate_helpers_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 19:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617190825-ktfk82li57rf2im6
It seems that fetch() no longer returns the number of revisions fetched.
It still does for *some* InterRepository fetch paths, but the generic one does not.
It is also not easy to get it to, since the Source and Sink are the ones
that would know how many keys were transmitted, and they are potentially 'remote'
objects.

This was also only tested to occur as a by-product in a random 'test_commit' test.
I assume if we really wanted the assurance, we would have a per_repo or interrepo
test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from bzrlib.dirstate import DirState
25
25
 
26
26
 
27
 
def _bisect_path_left(paths, path):
 
27
def _bisect_path_left_py(paths, path):
28
28
    """Return the index where to insert path into paths.
29
29
 
30
30
    This uses the dirblock sorting. So all children in a directory come before
63
63
        mid = (lo + hi) // 2
64
64
        # Grab the dirname for the current dirblock
65
65
        cur = paths[mid]
66
 
        if _cmp_path_by_dirblock(cur, path) < 0:
 
66
        if _cmp_path_by_dirblock_py(cur, path) < 0:
67
67
            lo = mid + 1
68
68
        else:
69
69
            hi = mid
70
70
    return lo
71
71
 
72
72
 
73
 
def _bisect_path_right(paths, path):
 
73
def _bisect_path_right_py(paths, path):
74
74
    """Return the index where to insert path into paths.
75
75
 
76
76
    This uses a path-wise comparison so we get::
94
94
        mid = (lo+hi)//2
95
95
        # Grab the dirname for the current dirblock
96
96
        cur = paths[mid]
97
 
        if _cmp_path_by_dirblock(path, cur) < 0:
 
97
        if _cmp_path_by_dirblock_py(path, cur) < 0:
98
98
            hi = mid
99
99
        else:
100
100
            lo = mid + 1
101
101
    return lo
102
102
 
103
103
 
104
 
def bisect_dirblock(dirblocks, dirname, lo=0, hi=None, cache={}):
 
104
def bisect_dirblock_py(dirblocks, dirname, lo=0, hi=None, cache={}):
105
105
    """Return the index where to insert dirname into the dirblocks.
106
106
 
107
107
    The return value idx is such that all directories blocks in dirblock[:idx]
132
132
    return lo
133
133
 
134
134
 
135
 
def cmp_by_dirs(path1, path2):
 
135
def cmp_by_dirs_py(path1, path2):
136
136
    """Compare two paths directory by directory.
137
137
 
138
138
    This is equivalent to doing::
158
158
    return cmp(path1.split('/'), path2.split('/'))
159
159
 
160
160
 
161
 
def _cmp_path_by_dirblock(path1, path2):
 
161
def _cmp_path_by_dirblock_py(path1, path2):
162
162
    """Compare two paths based on what directory they are in.
163
163
 
164
164
    This generates a sort order, such that all children of a directory are
184
184
    return cmp(key1, key2)
185
185
 
186
186
 
187
 
def _read_dirblocks(state):
 
187
def _read_dirblocks_py(state):
188
188
    """Read in the dirblocks for the given DirState object.
189
189
 
190
190
    This is tightly bound to the DirState internal representation. It should be