~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-03-01 15:54:18 UTC
  • mto: (2255.11.3 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: john@arbash-meinel.com-20070301155418-ocyly7icb2tyhvvu
Don't decode the path entry until we've actually decided to return the tuple.
This saves somewhere between 500 - 1000ms on the Moz tree.
It will be more noticable when we don't do the extra directory walking
(where we have to decode all of the path names again).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1575
1575
            :param path_info: top_relpath, basename, kind, lstat, abspath for
1576
1576
                the path of entry. If None, then the path is considered absent.
1577
1577
                (Perhaps we should pass in a concrete entry for this ?)
 
1578
                Basename is returned as a utf8 string because we expect this
 
1579
                tuple will be ignored, and don't want to take the time to
 
1580
                decode.
1578
1581
            """
1579
1582
            # TODO: when a parent has been renamed, dont emit path renames for children,
1580
1583
            if source_index is None:
1686
1689
                        last_target_parent[2] = target_parent_entry
1687
1690
 
1688
1691
                source_exec = source_details[3]
1689
 
                path_unicode = utf8_decode(path)[0]
1690
 
                return ((entry[0][2], path_unicode, content_change,
 
1692
                #path_unicode = utf8_decode(path)[0]
 
1693
                return ((entry[0][2], path, content_change,
1691
1694
                        (True, True),
1692
1695
                        (source_parent_id, target_parent_id),
1693
1696
                        (old_basename, entry[0][1]),
1706
1709
                    new_executable = bool(
1707
1710
                        stat.S_ISREG(path_info[3].st_mode)
1708
1711
                        and stat.S_IEXEC & path_info[3].st_mode)
1709
 
                    path_unicode = utf8_decode(path)[0]
1710
 
                    return ((entry[0][2], path_unicode, True,
 
1712
                    #path_unicode = utf8_decode(path)[0]
 
1713
                    return ((entry[0][2], path, True,
1711
1714
                            (False, True),
1712
1715
                            (None, parent_id),
1713
1716
                            (None, entry[0][1]),
1727
1730
                parent_id = state._get_entry(source_index, path_utf8=entry[0][0])[0][2]
1728
1731
                if parent_id == entry[0][2]:
1729
1732
                    parent_id = None
1730
 
                old_path_unicode = utf8_decode(old_path)[0]
1731
 
                return ((entry[0][2], old_path_unicode, True,
 
1733
                #old_path_unicode = utf8_decode(old_path)[0]
 
1734
                return ((entry[0][2], old_path, True,
1732
1735
                        (True, False),
1733
1736
                        (parent_id, None),
1734
1737
                        (entry[0][1], None),
1787
1790
                        or result[6][0] != result[6][1] # kind
1788
1791
                        or result[7][0] != result[7][1] # executable
1789
1792
                        ):
 
1793
                        result = (result[0],
 
1794
                                  _utf8_decode(result[1])[0]) + result[2:]
1790
1795
                        yield result
1791
1796
            dir_iterator = osutils._walkdirs_utf8(root_abspath, prefix=current_root)
1792
1797
            initial_key = (current_root, '', '')
1862
1867
                                    or result[6][0] != result[6][1] # kind
1863
1868
                                    or result[7][0] != result[7][1] # executable
1864
1869
                                    ):
 
1870
                                    result = (result[0],
 
1871
                                              _utf8_decode(result[1])[0]) + result[2:]
1865
1872
                                    yield result
1866
1873
                        block_index +=1
1867
1874
                        if (block_index < len(state._dirblocks) and
1915
1922
                                or result[6][0] != result[6][1] # kind
1916
1923
                                or result[7][0] != result[7][1] # executable
1917
1924
                                ):
 
1925
                                result = (result[0],
 
1926
                                          _utf8_decode(result[1])[0]) + result[2:]
1918
1927
                                yield result
1919
1928
                    elif current_entry[0][1] != current_path_info[1]:
1920
1929
                        if current_path_info[1] < current_entry[0][1]:
1938
1947
                                    or result[6][0] != result[6][1] # kind
1939
1948
                                    or result[7][0] != result[7][1] # executable
1940
1949
                                    ):
 
1950
                                    result = (result[0],
 
1951
                                              _utf8_decode(result[1])[0]) + result[2:]
1941
1952
                                    yield result
1942
1953
                            advance_path = False
1943
1954
                    else:
1953
1964
                                or result[6][0] != result[6][1] # kind
1954
1965
                                or result[7][0] != result[7][1] # executable
1955
1966
                                ):
 
1967
                                result = (result[0],
 
1968
                                          _utf8_decode(result[1])[0]) + result[2:]
1956
1969
                                yield result
1957
1970
                    if advance_entry and current_entry is not None:
1958
1971
                        entry_index += 1