Rev 3273: (jam) Fix moving directories to root nodes. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Mar 13 21:55:48 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3273
revision-id:pqm at pqm.ubuntu.com-20080313215539-7i5xowiaaw6pzwta
parent: pqm at pqm.ubuntu.com-20080313082937-sc9ovcwq3r10sjqd
parent: john at arbash-meinel.com-20080306182143-y7sqcm5fiyc6y6py
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-03-13 21:55:39 +0000
message:
(jam) Fix moving directories to root nodes.
modified:
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
------------------------------------------------------------
revno: 3253.2.1
revision-id:john at arbash-meinel.com-20080306182143-y7sqcm5fiyc6y6py
parent: pqm at pqm.ubuntu.com-20080306120728-w54bzmmrr0ri1xfu
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: fix_update_to_root
timestamp: Thu 2008-03-06 18:21:43 +0000
message:
Fix moving directories to root nodes.
modified:
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2008-02-28 01:33:35 +0000
+++ b/bzrlib/dirstate.py 2008-03-06 18:21:43 +0000
@@ -1312,7 +1312,12 @@
source_path = entry[0][0] + '/' + entry[0][1]
else:
source_path = entry[0][1]
- target_path = new_path_utf8 + source_path[len(old_path):]
+ if new_path_utf8:
+ target_path = new_path_utf8 + source_path[len(old_path):]
+ else:
+ assert len(old_path) > 0, ("cannot rename directory to"
+ " itself")
+ target_path = source_path[len(old_path) + 1:]
adds.append((None, target_path, entry[0][2], entry[1][1], False))
deletes.append(
(source_path, target_path, entry[0][2], None, False))
=== modified file 'bzrlib/tests/workingtree_implementations/test_parents.py'
--- a/bzrlib/tests/workingtree_implementations/test_parents.py 2007-10-24 05:47:39 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_parents.py 2008-03-06 18:21:43 +0000
@@ -249,7 +249,7 @@
self.assertConsistentParents([first_revision, 'second'], tree)
-class UpdateToOneParentViaDeltaTests(TestParents):
+class UpdateToOneParentViaDeltaTests(TestCaseWithWorkingTree):
"""Tests for the update_basis_by_delta call.
This is intuitively defined as 'apply an inventory delta to the basis and
@@ -514,6 +514,36 @@
self.assertTransitionFromBasisToShape(basis_shape, old_revid,
new_shape, new_revid)
+ def test_parent_deleted_child_renamed(self):
+ # test a A->None and A/B->A.
+ old_revid = 'old-parent'
+ basis_shape = Inventory(root_id=None)
+ self.add_dir(basis_shape, old_revid, 'root-id', None, '')
+ self.add_dir(basis_shape, old_revid, 'dir-id-A', 'root-id', 'A')
+ self.add_dir(basis_shape, old_revid, 'dir-id-B', 'dir-id-A', 'B')
+ self.add_link(basis_shape, old_revid, 'link-id-C', 'dir-id-B', 'C', 'C')
+ new_revid = 'new-parent'
+ new_shape = Inventory(root_id=None)
+ self.add_new_root(new_shape, old_revid, new_revid)
+ self.add_dir(new_shape, new_revid, 'dir-id-B', 'root-id', 'A')
+ self.add_link(new_shape, old_revid, 'link-id-C', 'dir-id-B', 'C', 'C')
+ self.assertTransitionFromBasisToShape(basis_shape, old_revid,
+ new_shape, new_revid)
+
+ def test_dir_to_root(self):
+ # test a A->''.
+ old_revid = 'old-parent'
+ basis_shape = Inventory(root_id=None)
+ self.add_dir(basis_shape, old_revid, 'root-id', None, '')
+ self.add_dir(basis_shape, old_revid, 'dir-id-A', 'root-id', 'A')
+ self.add_link(basis_shape, old_revid, 'link-id-B', 'dir-id-A', 'B', 'B')
+ new_revid = 'new-parent'
+ new_shape = Inventory(root_id=None)
+ self.add_dir(new_shape, new_revid, 'dir-id-A', None, '')
+ self.add_link(new_shape, old_revid, 'link-id-B', 'dir-id-A', 'B', 'B')
+ self.assertTransitionFromBasisToShape(basis_shape, old_revid,
+ new_shape, new_revid)
+
def test_path_swap(self):
# test a A->B and B->A path swap.
old_revid = 'old-parent'
More information about the bazaar-commits
mailing list