~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_c.pyx

  • Committer: John Arbash Meinel
  • Date: 2007-07-12 16:34:02 UTC
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070712163402-lp91q157w5etslrj
Some restructuring.
Move bisect_path_* to private functions
Move cmp_path_by_dirblock to a private function,
since it is only used by the bisect_path functions.
Add tests that the compiled versions are actually used.
This catches cases when the import fails for the wrong reason.
Move some code around to make it closer to sorted by name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
178
178
                        PyString_Size(path2))
179
179
 
180
180
 
181
 
def cmp_path_by_dirblock_c(path1, path2):
 
181
def _cmp_path_by_dirblock_c(path1, path2):
182
182
    """Compare two paths based on what directory they are in.
183
183
 
184
184
    This generates a sort order, such that all children of a directory are
185
185
    sorted together, and grandchildren are in the same order as the
186
186
    children appear. But all grandchildren come after all children.
187
187
 
 
188
    In other words, all entries in a directory are sorted together, and
 
189
    directorys are sorted in cmp_by_dirs order.
 
190
 
188
191
    :param path1: first path
189
192
    :param path2: the second path
190
193
    :return: positive number if ``path1`` comes first,
274
277
        return PyString_FromStringAndSize(s, length)
275
278
 
276
279
 
277
 
def bisect_path_left_c(paths, path):
 
280
def _bisect_path_left_c(paths, path):
278
281
    """Return the index where to insert path into paths.
279
282
 
280
283
    This uses a path-wise comparison so we get::
324
327
    return _lo
325
328
 
326
329
 
327
 
def bisect_path_right_c(paths, path):
 
330
def _bisect_path_right_c(paths, path):
328
331
    """Return the index where to insert path into paths.
329
332
 
330
333
    This uses a path-wise comparison so we get::