~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: John Arbash Meinel
  • Date: 2007-02-28 19:22:44 UTC
  • mto: (2255.11.3 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: john@arbash-meinel.com-20070228192244-uknltx7urh1mur2o
shave about 10% of the time by switching to _walkdirs_utf8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1715
1715
                        or result[7][0] != result[7][1] # executable
1716
1716
                        ):
1717
1717
                        yield result
1718
 
            dir_iterator = osutils.walkdirs(root_abspath, prefix=current_root)
 
1718
            dir_iterator = osutils._walkdirs_utf8(root_abspath, prefix=current_root)
1719
1719
            initial_key = (current_root, '', '')
1720
1720
            block_index, _ = state._find_block_index_from_key(initial_key)
1721
1721
            if block_index == 0:
1738
1738
                    bzr_index = bisect_left(current_dir_info[1], ('.bzr',))
1739
1739
                    assert current_dir_info[1][bzr_index][0] == '.bzr'
1740
1740
                    del current_dir_info[1][bzr_index]
1741
 
                # convert the unicode relpaths in the dir index to uf8 for
1742
 
                # comparison with dirstate data.
1743
 
                # TODO: keep the utf8 version around for giving to the caller.
1744
 
                current_dir_info = ((current_dir_info[0][0].encode('utf8'), current_dir_info[0][1]),
1745
 
                    [(line[0].encode('utf8'), line[1].encode('utf8')) + line[2:] for line in current_dir_info[1]])
1746
1741
            # walk until both the directory listing and the versioned metadata
1747
1742
            # are exhausted. TODO: reevaluate this, perhaps we should stop when
1748
1743
            # the versioned data runs out.
1770
1765
                        # advance the iterator and loop - we dont need to emit it.
1771
1766
                        try:
1772
1767
                            current_dir_info = dir_iterator.next()
1773
 
                            # convert the unicode relpaths in the dir index to uf8 for
1774
 
                            # comparison with dirstate data.
1775
 
                            # TODO: keep the utf8 version around for giving to the caller.
1776
 
                            current_dir_info = ((current_dir_info[0][0].encode('utf8'), current_dir_info[0][1]),
1777
 
                                [(line[0].encode('utf8'), line[1].encode('utf8')) + line[2:] for line in current_dir_info[1]])
1778
1768
                        except StopIteration:
1779
1769
                            current_dir_info = None
1780
1770
                    continue
1877
1867
                if current_dir_info is not None:
1878
1868
                    try:
1879
1869
                        current_dir_info = dir_iterator.next()
1880
 
                        # convert the unicode relpaths in the dir index to utf8 for
1881
 
                        # comparison with dirstate data.
1882
 
                        # TODO: keep the unicode version around for giving to the caller.
1883
 
                        #       We could also use cached_utf8.encode() which
1884
 
                        #       maintains utf8=>unicode and unicode=>utf8 maps.
1885
 
                        # TODO: change this to a plain tuple assignment rather
1886
 
                        #       than doing slicing, since it should be faster.
1887
 
                        #       (unless the size of the line is dynamic)
1888
 
                        utf8_relpath = current_dir_info[0][0].encode('utf8')
1889
 
                        current_dir_info = ((utf8_relpath, current_dir_info[0][1]),
1890
 
                            [(line[0].encode('utf8'), line[1].encode('utf8'))
1891
 
                              + line[2:] for line in current_dir_info[1]])
1892
1870
                    except StopIteration:
1893
1871
                        current_dir_info = None
1894
1872