Rev 2518: Use cmp_by_dirs in _iter_changes, it saves a bit of time. in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex

John Arbash Meinel john at arbash-meinel.com
Mon May 7 19:32:10 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex

------------------------------------------------------------
revno: 2518
revision-id: john at arbash-meinel.com-20070507183155-fzs5z1516gyf5lth
parent: john at arbash-meinel.com-20070507182449-mm860vvdw9keyfx5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Mon 2007-05-07 13:31:55 -0500
message:
  Use cmp_by_dirs in _iter_changes, it saves a bit of time.
  When I initially wrote it, I thought they wouldn't be called often,
  but I realize now they are evaluated when we have unknown/ignored files
  on disk.
modified:
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-04-30 17:45:10 +0000
+++ b/bzrlib/workingtree_4.py	2007-05-07 18:31:55 +0000
@@ -1668,6 +1668,7 @@
         """
         utf8_decode_or_none = cache_utf8._utf8_decode_with_None
         _minikind_to_kind = dirstate.DirState._minikind_to_kind
+        cmp_by_dirs = dirstate.cmp_by_dirs
         # NB: show_status depends on being able to pass in non-versioned files
         # and report them as unknown
         # TODO: handle extra trees in the dirstate.
@@ -2122,7 +2123,7 @@
                    current_block is not None):
                 if (current_dir_info and current_block
                     and current_dir_info[0][0] != current_block[0]):
-                    if current_dir_info[0][0].split('/') < current_block[0].split('/'):
+                    if cmp_by_dirs(current_dir_info[0][0], current_block[0]) < 0:
                         # filesystem data refers to paths not covered by the dirblock.
                         # this has two possibilities:
                         # A) it is versioned but empty, so there is no block for it
@@ -2263,7 +2264,7 @@
                         # the file on disk is not present at all in the
                         # dirblock. Either way, report about the dirblock
                         # entry, and let other code handle the filesystem one.
-                        if current_path_info[1].split('/') < current_entry[0][1].split('/'):
+                        if cmp_by_dirs(current_path_info[1], current_entry[0][1]) < 0:
                             # extra file on disk: pass for now, but only
                             # increment the path, not the entry
                             advance_entry = False



More information about the bazaar-commits mailing list