~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • 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:
555
555
                    first_path = first_fields[1] + '/' + first_fields[2]
556
556
                else:
557
557
                    first_path = first_fields[2]
558
 
                first_loc = bisect_path_left(cur_files, first_path)
 
558
                first_loc = _bisect_path_left(cur_files, first_path)
559
559
 
560
560
                # These exist before the current location
561
561
                pre = cur_files[:first_loc]
582
582
                    last_path = last_fields[1] + '/' + last_fields[2]
583
583
                else:
584
584
                    last_path = last_fields[2]
585
 
                last_loc = bisect_path_right(post, last_path)
 
585
                last_loc = _bisect_path_right(post, last_path)
586
586
 
587
587
                middle_files = post[:last_loc]
588
588
                post = post[last_loc:]
2282
2282
    from bzrlib._dirstate_helpers_c import (
2283
2283
        _read_dirblocks_c as _read_dirblocks,
2284
2284
        bisect_dirblock_c as bisect_dirblock,
2285
 
        bisect_path_left_c as bisect_path_left,
2286
 
        bisect_path_right_c as bisect_path_right,
 
2285
        _bisect_path_left_c as _bisect_path_left,
 
2286
        _bisect_path_right_c as _bisect_path_right,
2287
2287
        cmp_by_dirs_c as cmp_by_dirs,
2288
2288
        )
2289
2289
except ImportError:
2290
2290
    from bzrlib._dirstate_helpers_py import (
2291
2291
        _read_dirblocks_py as _read_dirblocks,
2292
2292
        bisect_dirblock_py as bisect_dirblock,
2293
 
        bisect_path_left_py as bisect_path_left,
2294
 
        bisect_path_right_py as bisect_path_right,
 
2293
        _bisect_path_left_py as _bisect_path_left,
 
2294
        _bisect_path_right_py as _bisect_path_right,
2295
2295
        cmp_by_dirs_py as cmp_by_dirs,
2296
2296
        )