Rev 5875: Some more direct tests. Fix some bugs in the create_entry code. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941
John Arbash Meinel
john at arbash-meinel.com
Thu May 19 11:27:25 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941
------------------------------------------------------------
revno: 5875
revision-id: john at arbash-meinel.com-20110519112716-cgk61q0iwa104bc2
parent: john at arbash-meinel.com-20110519111942-cz9mhf58vow11f28
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Thu 2011-05-19 13:27:16 +0200
message:
Some more direct tests. Fix some bugs in the create_entry code.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py 2011-05-19 11:19:42 +0000
+++ b/bzrlib/tests/test_dirstate.py 2011-05-19 11:27:16 +0000
@@ -2447,14 +2447,14 @@
def path_to_ie(self, path, file_id, rev_id, dir_ids):
if path.endswith('/'):
is_dir = True
- path = path[:1]
+ path = path[:-1]
else:
is_dir = False
dirname, basename = osutils.split(path)
try:
dir_id = dir_ids[dirname]
except KeyError:
- dir_id = 'missing_parent_id'
+ dir_id = osutils.basename(dirname) + '-id'
if is_dir:
ie = inventory.InventoryDirectory(file_id, basename, dir_id)
dir_ids[path] = dir_id
@@ -2488,7 +2488,7 @@
if old_path is not None and old_path.endswith('/'):
# Don't have to actually do anything for this, because only
# new_path creates InventoryEntries
- old_path = old_path[:1]
+ old_path = old_path[:-1]
if new_path is None: # Delete
inv_delta.append((old_path, None, file_id, None))
continue
@@ -2701,4 +2701,16 @@
active=[],
basis= [],
delta=[(None, 'path/path2', 'file-id')])
+ # Note: we force the active tree to have the directory, by knowing how
+ # path_to_ie handles entries with missing parents
+ state = self.assertBadDelta(
+ active=[('path/', 'path-id')],
+ basis =[],
+ delta=[(None, 'path/path2', 'file-id')])
+ state = self.assertBadDelta(
+ active=[('path/', 'path-id'),
+ ('path/path2', 'file-id')],
+ basis =[],
+ delta=[(None, 'path/path2', 'file-id')])
+
# TODO: Test stuff like renaming a directory, and renaming contents therein
More information about the bazaar-commits
mailing list