~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_pyx.pyx

  • Committer: Vincent Ladeuil
  • Date: 2009-06-22 14:32:48 UTC
  • mto: (4471.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4472.
  • Revision ID: v.ladeuil+lp@free.fr-20090622143248-pe4av866hxgzn60e
Use the same method or function names for _dirstate_helpers in pyrex and
python modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
    return 0
238
238
 
239
239
 
240
 
def cmp_by_dirs_c(path1, path2):
 
240
def cmp_by_dirs(path1, path2):
241
241
    """Compare two paths directory by directory.
242
242
 
243
243
    This is equivalent to doing::
266
266
                        PyString_Size(path2))
267
267
 
268
268
 
269
 
def _cmp_path_by_dirblock_c(path1, path2):
 
269
def _cmp_path_by_dirblock(path1, path2):
270
270
    """Compare two paths based on what directory they are in.
271
271
 
272
272
    This generates a sort order, such that all children of a directory are
288
288
    if not PyString_CheckExact(path2):
289
289
        raise TypeError("'path2' must be a plain string, not %s: %r"
290
290
                        % (type(path2), path2))
291
 
    return _cmp_path_by_dirblock(PyString_AsString(path1),
 
291
    return __cmp_path_by_dirblock(PyString_AsString(path1),
292
292
                                 PyString_Size(path1),
293
293
                                 PyString_AsString(path2),
294
294
                                 PyString_Size(path2))
295
295
 
296
296
 
297
 
cdef int _cmp_path_by_dirblock(char *path1, int path1_len,
 
297
cdef int __cmp_path_by_dirblock(char *path1, int path1_len,
298
298
                               char *path2, int path2_len):
299
299
    """Compare two paths by what directory they are in.
300
300
 
301
 
    see ``_cmp_path_by_dirblock_c`` for details.
 
301
    see ``_cmp_path_by_dirblock`` for details.
302
302
    """
303
303
    cdef char *dirname1
304
304
    cdef int dirname1_len
368
368
    return 1
369
369
 
370
370
 
371
 
def _bisect_path_left_c(paths, path):
 
371
def _bisect_path_left(paths, path):
372
372
    """Return the index where to insert path into paths.
373
373
 
374
374
    This uses a path-wise comparison so we get::
413
413
        cur = PyList_GetItem_object_void(paths, _mid)
414
414
        cur_cstr = PyString_AS_STRING_void(cur)
415
415
        cur_size = PyString_GET_SIZE_void(cur)
416
 
        if _cmp_path_by_dirblock(cur_cstr, cur_size, path_cstr, path_size) < 0:
 
416
        if __cmp_path_by_dirblock(cur_cstr, cur_size, path_cstr, path_size) < 0:
417
417
            _lo = _mid + 1
418
418
        else:
419
419
            _hi = _mid
420
420
    return _lo
421
421
 
422
422
 
423
 
def _bisect_path_right_c(paths, path):
 
423
def _bisect_path_right(paths, path):
424
424
    """Return the index where to insert path into paths.
425
425
 
426
426
    This uses a path-wise comparison so we get::
465
465
        cur = PyList_GetItem_object_void(paths, _mid)
466
466
        cur_cstr = PyString_AS_STRING_void(cur)
467
467
        cur_size = PyString_GET_SIZE_void(cur)
468
 
        if _cmp_path_by_dirblock(path_cstr, path_size, cur_cstr, cur_size) < 0:
 
468
        if __cmp_path_by_dirblock(path_cstr, path_size, cur_cstr, cur_size) < 0:
469
469
            _hi = _mid
470
470
        else:
471
471
            _lo = _mid + 1
472
472
    return _lo
473
473
 
474
474
 
475
 
def bisect_dirblock_c(dirblocks, dirname, lo=0, hi=None, cache=None):
 
475
def bisect_dirblock(dirblocks, dirname, lo=0, hi=None, cache=None):
476
476
    """Return the index where to insert dirname into the dirblocks.
477
477
 
478
478
    The return value idx is such that all directories blocks in dirblock[:idx]
744
744
        self.state._split_root_dirblock_into_contents()
745
745
 
746
746
 
747
 
def _read_dirblocks_c(state):
 
747
def _read_dirblocks(state):
748
748
    """Read in the dirblocks for the given DirState object.
749
749
 
750
750
    This is tightly bound to the DirState internal representation. It should be