Rev 314: Fix nested replace bug. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Wed Dec 27 03:06:06 GMT 2006
------------------------------------------------------------
revno: 314
revision-id: jelmer at samba.org-20061227030523-zbw1bndpbqprkd3e
parent: jelmer at samba.org-20061227002159-777owqcr37aji4kv
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Wed 2006-12-27 04:05:23 +0100
message:
Fix nested replace bug.
modified:
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'fetch.py'
--- a/fetch.py 2006-12-26 21:08:52 +0000
+++ b/fetch.py 2006-12-27 03:05:23 +0000
@@ -124,13 +124,13 @@
ie = self.inventory[file_id]
else:
# Replace if original was inside this branch
- # change id of base_file_id to file_id
- ie = self.inventory[base_file_id]
- for name in ie.children:
- ie.children[name].parent_id = file_id
- del self.inventory[base_file_id]
- ie.file_id = file_id
- self.inventory.add(ie)
+ # change id of base_file_id to file_id
+ ie = self.inventory[base_file_id]
+ for name in ie.children:
+ ie.children[name].parent_id = file_id
+ del self.inventory[base_file_id]
+ ie.file_id = file_id
+ self.inventory.add(ie)
self.dir_baserev[file_id] = []
ie.revision = revision_id
return file_id
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2006-12-27 00:21:59 +0000
+++ b/tests/test_repos.py 2006-12-27 03:05:23 +0000
@@ -548,6 +548,149 @@
"svn-v%d:2@%s-" % (MAPPING_VERSION, oldrepos.uuid))
self.assertNotEqual(inv1.path2id("bla"), inv2.path2id("bla"))
+ def test_fetch_replace_with_subreplace(self):
+ filename = os.path.join(self.test_dir, "dumpfile")
+ open(filename, 'w').write("""SVN-fs-dump-format-version: 2
+
+UUID: 606c7b1f-987c-4826-b37d-eb456ceb87e1
+
+Revision-number: 0
+Prop-content-length: 56
+Content-length: 56
+
+K 8
+svn:date
+V 27
+2006-12-26T00:04:55.850520Z
+PROPS-END
+
+Revision-number: 1
+Prop-content-length: 103
+Content-length: 103
+
+K 7
+svn:log
+V 3
+add
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-26T00:05:15.504335Z
+PROPS-END
+
+Node-path: x
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+Node-path: x/t
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+Node-path: u
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+Revision-number: 2
+Prop-content-length: 105
+Content-length: 105
+
+K 7
+svn:log
+V 5
+readd
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-26T00:05:43.584249Z
+PROPS-END
+
+Node-path: x
+Node-action: delete
+
+Node-path: x
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Revision-number: 3
+Prop-content-length: 108
+Content-length: 108
+
+K 7
+svn:log
+V 8
+Replace
+
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-25T04:30:06.383777Z
+PROPS-END
+
+Node-path: x
+Node-action: delete
+
+Node-path: y
+Node-kind: dir
+Node-action: add
+Node-copyfrom-rev: 1
+Node-copyfrom-path: x
+
+Node-path: y/t
+Node-action: delete
+
+Node-path: y/t
+Node-kind: dir
+Node-action: add
+Node-copyfrom-rev: 1
+Node-copyfrom-path: u
+
+
+""")
+ os.mkdir("old")
+
+ load_dumpfile("dumpfile", "old")
+ oldrepos = Repository.open("old")
+ dir = BzrDir.create("f")
+ newrepos = dir.create_repository()
+ oldrepos.copy_content_into(newrepos)
+ self.assertTrue(newrepos.has_revision(
+ "svn-v%d:1@%s-" % (MAPPING_VERSION, oldrepos.uuid)))
+ self.assertTrue(newrepos.has_revision(
+ "svn-v%d:3@%s-" % (MAPPING_VERSION, oldrepos.uuid)))
+ inv1 = newrepos.get_inventory(
+ "svn-v%d:1@%s-" % (MAPPING_VERSION, oldrepos.uuid))
+ inv2 = newrepos.get_inventory(
+ "svn-v%d:3@%s-" % (MAPPING_VERSION, oldrepos.uuid))
+
def test_fetch_replace_self(self):
filename = os.path.join(self.test_dir, "dumpfile")
open(filename, 'w').write("""SVN-fs-dump-format-version: 2
More information about the bazaar-commits
mailing list