1640
1640
root_stat = os.lstat(root_abspath)
1641
1641
except OSError, e:
1642
1642
if e.errno == errno.ENOENT:
1643
# TODO: this directory does not exist in target. Should we
1644
# consider it missing and diff, or should we just skip? For
1643
# the path does not exist: let _process_entry know that.
1644
root_dir_info = None
1648
1646
# some other random error: hand it up.
1650
root_dir_info = ('', current_root,
1651
osutils.file_kind_from_stat_mode(root_stat.st_mode), root_stat,
1654
if not root_entries:
1649
root_dir_info = ('', current_root,
1650
osutils.file_kind_from_stat_mode(root_stat.st_mode), root_stat,
1652
if not root_entries and not root_dir_info:
1655
1653
# this specified path is not present at all, skip it.
1657
1655
for entry in root_entries:
1668
1666
# we have processed the total root already, but because the
1669
1667
# initial key matched it we sould skip it here.
1670
1668
block_index +=1
1671
current_dir_info = dir_iterator.next()
1672
if current_dir_info[0][0] == '':
1673
# remove .bzr from iteration
1674
bzr_index = bisect_left(current_dir_info[1], ('.bzr',))
1675
assert current_dir_info[1][bzr_index][0] == '.bzr'
1676
del current_dir_info[1][bzr_index]
1677
# convert the unicode relpaths in the dir index to uf8 for
1678
# comparison with dirstate data.
1679
# TODO: keep the utf8 version around for giving to the caller.
1680
current_dir_info = ((current_dir_info[0][0].encode('utf8'), current_dir_info[0][1]),
1681
[(line[0].encode('utf8'), line[1].encode('utf8')) + line[2:] for line in current_dir_info[1]])
1670
current_dir_info = dir_iterator.next()
1672
if e.errno in (errno.ENOENT, errno.ENOTDIR):
1673
# there may be directories in the inventory even though
1674
# this path is not a file on disk: so mark it as end of
1676
current_dir_info = None
1680
if current_dir_info[0][0] == '':
1681
# remove .bzr from iteration
1682
bzr_index = bisect_left(current_dir_info[1], ('.bzr',))
1683
assert current_dir_info[1][bzr_index][0] == '.bzr'
1684
del current_dir_info[1][bzr_index]
1685
# convert the unicode relpaths in the dir index to uf8 for
1686
# comparison with dirstate data.
1687
# TODO: keep the utf8 version around for giving to the caller.
1688
current_dir_info = ((current_dir_info[0][0].encode('utf8'), current_dir_info[0][1]),
1689
[(line[0].encode('utf8'), line[1].encode('utf8')) + line[2:] for line in current_dir_info[1]])
1682
1690
# walk until both the directory listing and the versioned metadata
1683
1691
# are exhausted. TODO: reevaluate this, perhaps we should stop when
1684
1692
# the versioned data runs out.