Rev 290: Add test case demonstrating a weird bug in the file id generation code. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Mon Dec 25 04:44:39 GMT 2006
------------------------------------------------------------
revno: 290
revision-id: jelmer at samba.org-20061225044345-kh5byasjooobc1fs
parent: jelmer at samba.org-20061225023249-qpfksqt0p29ev0lz
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Mon 2006-12-25 05:43:45 +0100
message:
Add test case demonstrating a weird bug in the file id generation code.
modified:
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'fetch.py'
--- a/fetch.py 2006-12-25 02:32:49 +0000
+++ b/fetch.py 2006-12-25 04:43:45 +0000
@@ -119,8 +119,7 @@
self.dir_baserev[file_id] = []
ie = self.inventory.add_path(path, 'directory', file_id)
- if ie:
- ie.revision = revision_id
+ ie.revision = revision_id
return file_id
=== modified file 'fileids.py'
--- a/fileids.py 2006-12-25 00:21:58 +0000
+++ b/fileids.py 2006-12-25 04:43:45 +0000
@@ -176,6 +176,10 @@
sorted_paths.sort()
for p in sorted_paths:
data = changes[p]
+
+ # FIXME: If this was actually a replace from the same path earlier,
+ # change data[0] to 'M'
+
if data[0] in ('D', 'R'):
assert map.has_key(p), "No map entry %s to delete/replace" % p
del map[p]
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2006-12-23 21:38:26 +0000
+++ b/tests/test_repos.py 2006-12-25 04:43:45 +0000
@@ -17,6 +17,7 @@
from bzrlib.bzrdir import BzrDir
from bzrlib.errors import NoSuchRevision
from bzrlib.inventory import Inventory
+import bzrlib.osutils as osutils
from bzrlib.repository import Repository
from bzrlib.revision import NULL_REVISION
from bzrlib.tests import TestCase
@@ -26,6 +27,7 @@
import svn.fs
+from convert import load_dumpfile
import format
from scheme import TrunkBranchingScheme
from transport import SvnRaTransport
@@ -407,6 +409,152 @@
"svn-v%d:2@%s-" % (MAPPING_VERSION, oldrepos.uuid))
self.assertNotEqual(inv1.path2id("bla"), inv2.path2id("bla"))
+ def test_fetch_replace_self(self):
+ filename = os.path.join(self.test_dir, "dumpfile")
+ open(filename, 'w').write("""SVN-fs-dump-format-version: 2
+
+UUID: 6dcc86fc-ac21-4df7-a3a3-87616123c853
+
+Revision-number: 0
+Prop-content-length: 56
+Content-length: 56
+
+K 8
+svn:date
+V 27
+2006-12-25T04:27:54.633666Z
+PROPS-END
+
+Revision-number: 1
+Prop-content-length: 108
+Content-length: 108
+
+K 7
+svn:log
+V 8
+Add dir
+
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-25T04:28:17.503039Z
+PROPS-END
+
+Node-path: bla
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Revision-number: 2
+Prop-content-length: 117
+Content-length: 117
+
+K 7
+svn:log
+V 16
+Add another dir
+
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-25T04:28:30.160663Z
+PROPS-END
+
+Node-path: blie
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Revision-number: 3
+Prop-content-length: 105
+Content-length: 105
+
+K 7
+svn:log
+V 5
+Copy
+
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-25T04:28:44.996894Z
+PROPS-END
+
+Node-path: bloe
+Node-kind: dir
+Node-action: add
+Node-copyfrom-rev: 1
+Node-copyfrom-path: bla
+
+
+Revision-number: 4
+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: bla
+Node-action: delete
+
+
+Node-path: bla
+Node-kind: dir
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: bla
+
+
+""")
+ 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))
+ self.assertNotEqual(inv1.path2id("bla"), inv2.path2id("bla"))
+
# FIXME
def notest_fetch_all(self):
repos_url = self.make_client('d', 'dc')
More information about the bazaar-commits
mailing list