Rev 2406: Handle specific_files natively for WorkingTreeFormat4._iter_changes. in sftp://bazaar.launchpad.net/%7Ebzr/bzr/dirstate/
Robert Collins
robertc at robertcollins.net
Mon Feb 26 01:33:38 GMT 2007
At sftp://bazaar.launchpad.net/%7Ebzr/bzr/dirstate/
------------------------------------------------------------
revno: 2406
revision-id: robertc at robertcollins.net-20070226013238-w7sjnnn1d7uvcpg5
parent: robertc at robertcollins.net-20070226011304-8m29bgwjl3iey0g9
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Mon 2007-02-26 12:32:38 +1100
message:
Handle specific_files natively for WorkingTreeFormat4._iter_changes.
modified:
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py 2007-02-26 01:06:36 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py 2007-02-26 01:32:38 +0000
@@ -33,6 +33,11 @@
# TODO: test items are only emitted once when a specific_files list names a dir
# whose parent is now a child.
# TODO: test require_versioned
+# TODO: explicitly test specific_files listing a non-dir, and listing a symlink
+# (it should not follow the link)
+# TODO: test specific_files when the target tree has a file and the source a
+# dir with children, same id and same path.
+# TODO: test specific_files with a new unversioned path.
class TestCompare(TestCaseWithTwoTrees):
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-02-26 01:13:04 +0000
+++ b/bzrlib/workingtree_4.py 2007-02-26 01:32:38 +0000
@@ -1640,18 +1640,16 @@
root_stat = os.lstat(root_abspath)
except OSError, e:
if e.errno == errno.ENOENT:
- # TODO: this directory does not exist in target. Should we
- # consider it missing and diff, or should we just skip? For
- # now, skip.
- continue
+ # the path does not exist: let _process_entry know that.
+ root_dir_info = None
else:
# some other random error: hand it up.
raise
- root_dir_info = ('', current_root,
- osutils.file_kind_from_stat_mode(root_stat.st_mode), root_stat,
- root_abspath)
- #
- if not root_entries:
+ else:
+ root_dir_info = ('', current_root,
+ osutils.file_kind_from_stat_mode(root_stat.st_mode), root_stat,
+ root_abspath)
+ if not root_entries and not root_dir_info:
# this specified path is not present at all, skip it.
continue
for entry in root_entries:
@@ -1668,17 +1666,27 @@
# we have processed the total root already, but because the
# initial key matched it we sould skip it here.
block_index +=1
- current_dir_info = dir_iterator.next()
- if current_dir_info[0][0] == '':
- # remove .bzr from iteration
- bzr_index = bisect_left(current_dir_info[1], ('.bzr',))
- assert current_dir_info[1][bzr_index][0] == '.bzr'
- del current_dir_info[1][bzr_index]
- # convert the unicode relpaths in the dir index to uf8 for
- # comparison with dirstate data.
- # TODO: keep the utf8 version around for giving to the caller.
- current_dir_info = ((current_dir_info[0][0].encode('utf8'), current_dir_info[0][1]),
- [(line[0].encode('utf8'), line[1].encode('utf8')) + line[2:] for line in current_dir_info[1]])
+ try:
+ current_dir_info = dir_iterator.next()
+ except OSError, e:
+ if e.errno in (errno.ENOENT, errno.ENOTDIR):
+ # there may be directories in the inventory even though
+ # this path is not a file on disk: so mark it as end of
+ # iterator
+ current_dir_info = None
+ else:
+ raise
+ else:
+ if current_dir_info[0][0] == '':
+ # remove .bzr from iteration
+ bzr_index = bisect_left(current_dir_info[1], ('.bzr',))
+ assert current_dir_info[1][bzr_index][0] == '.bzr'
+ del current_dir_info[1][bzr_index]
+ # convert the unicode relpaths in the dir index to uf8 for
+ # comparison with dirstate data.
+ # TODO: keep the utf8 version around for giving to the caller.
+ current_dir_info = ((current_dir_info[0][0].encode('utf8'), current_dir_info[0][1]),
+ [(line[0].encode('utf8'), line[1].encode('utf8')) + line[2:] for line in current_dir_info[1]])
# walk until both the directory listing and the versioned metadata
# are exhausted. TODO: reevaluate this, perhaps we should stop when
# the versioned data runs out.
More information about the bazaar-commits
mailing list