~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-15 22:35:35 UTC
  • mto: This revision was merged to the branch mainline in revision 2363.
  • Revision ID: john@arbash-meinel.com-20070315223535-d3d4964oe1hc8zhg
Add an overzealous test, for Unicode support of _iter_changes.
For both knowns and unknowns.
And include a basic, if suboptimal, fix.
I would rather defer the decoding until we've determined that we are going to return the tuple.
There is still something broken with added files, but I'll get to that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1913
1913
                return ((entry[0][2], (old_path, path), content_change,
1914
1914
                        (True, True),
1915
1915
                        (source_parent_id, target_parent_id),
1916
 
                        (old_basename, entry[0][1]),
 
1916
                        (utf8_decode(old_basename)[0], utf8_decode(entry[0][1])[0]),
1917
1917
                        (_minikind_to_kind[source_minikind], target_kind),
1918
1918
                        (source_exec, target_exec)),)
1919
1919
            elif source_minikind in 'a' and target_minikind in 'fdlt':
1938
1938
                            (False, True),
1939
1939
                            (None, parent_id),
1940
1940
                            (None, entry[0][1]),
1941
 
                            (None, path_info[2]),
 
1941
                            (None, utf8_decode(path_info[2])[0]),
1942
1942
                            (None, target_exec)),)
1943
1943
                else:
1944
1944
                    # but its not on disk: we deliberately treat this as just
1957
1957
                return ((entry[0][2], (old_path, None), True,
1958
1958
                        (True, False),
1959
1959
                        (parent_id, None),
1960
 
                        (entry[0][1], None),
 
1960
                        (utf8_decode(entry[0][1])[0], None),
1961
1961
                        (_minikind_to_kind[source_minikind], None),
1962
1962
                        (source_details[3], None)),)
1963
1963
            elif source_minikind in 'fdlt' and target_minikind in 'r':
1983
1983
            # TODO: the pending list should be lexically sorted?  the
1984
1984
            # interface doesn't require it.
1985
1985
            current_root = search_specific_files.pop()
 
1986
            current_root_unicode = current_root.decode('utf8')
1986
1987
            searched_specific_files.add(current_root)
1987
1988
            # process the entries for this containing directory: the rest will be
1988
1989
            # found by their parents recursively.
1989
1990
            root_entries = _entries_for_path(current_root)
1990
 
            root_abspath = self.target.abspath(current_root)
 
1991
            root_abspath = self.target.abspath(current_root_unicode)
1991
1992
            try:
1992
1993
                root_stat = os.lstat(root_abspath)
1993
1994
            except OSError, e:
2029
2030
                            ((utf8_decode(result[1][0])[0]),
2030
2031
                             utf8_decode(result[1][1])[0]),) + result[2:]
2031
2032
                        yield result
2032
 
            if want_unversioned and not path_handled:
 
2033
            if want_unversioned and not path_handled and root_dir_info:
2033
2034
                new_executable = bool(
2034
2035
                    stat.S_ISREG(root_dir_info[3].st_mode)
2035
2036
                    and stat.S_IEXEC & root_dir_info[3].st_mode)
2036
 
                yield (None, (None, current_root), True, (False, False),
 
2037
                yield (None, (None, current_root_unicode), True, (False, False),
2037
2038
                    (None, None),
2038
 
                    (None, splitpath(current_root)[-1]),
 
2039
                    (None, splitpath(current_root_unicode)[-1]),
2039
2040
                    (None, root_dir_info[2]), (None, new_executable))
2040
2041
            initial_key = (current_root, '', '')
2041
2042
            block_index, _ = state._find_block_index_from_key(initial_key)
2225
2226
                                    stat.S_ISREG(current_path_info[3].st_mode)
2226
2227
                                    and stat.S_IEXEC & current_path_info[3].st_mode)
2227
2228
                                if want_unversioned:
2228
 
                                    yield (None, (None, current_path_info[0]),
 
2229
                                    yield (None,
 
2230
                                        (None, utf8_decode(current_path_info[0])[0]),
2229
2231
                                        True,
2230
2232
                                        (False, False),
2231
2233
                                        (None, None),
2232
 
                                        (None, current_path_info[1]),
 
2234
                                        (None, utf8_decode(current_path_info[1])[0]),
2233
2235
                                        (None, current_path_info[2]),
2234
2236
                                        (None, new_executable))
2235
2237
                            # dont descend into this unversioned path if it is