Rev 633: Start working on generic tests for mappings. in file:///data/jelmer/bzr-svn/revprops/
Jelmer Vernooij
jelmer at samba.org
Sat Feb 2 22:55:29 GMT 2008
At file:///data/jelmer/bzr-svn/revprops/
------------------------------------------------------------
revno: 633
revision-id:jelmer at samba.org-20080202225528-732o641jnqyt351f
parent: jelmer at samba.org-20080202211730-t9yivhfx1z8q7k3a
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: revprops
timestamp: Sat 2008-02-02 23:55:28 +0100
message:
Start working on generic tests for mappings.
modified:
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
specs/revprops.txt revprops.txt-20080119124702-mrqj3lll8cpkpywc-1
tests/test_mapping.py test_mapping.py-20080201131338-0zd86eznn4bojtee-1
=== modified file 'mapping.py'
--- a/mapping.py 2008-02-02 21:17:30 +0000
+++ b/mapping.py 2008-02-02 22:55:28 +0000
@@ -361,6 +361,10 @@
assert revnum >= 0
return (uuid, branch_path, revnum, None)
+ @staticmethod
+ def generate_revision_id(uuid, revnum, path, scheme):
+ return "svn-v1:%d@%s-%s" % (revnum, uuid, escape_svn_path(path))
+
class BzrSvnMappingv2(BzrSvnMapping):
"""The second version of the mappings as used in the 0.3.x series.
@@ -378,6 +382,10 @@
assert revnum >= 0
return (uuid, branch_path, revnum, None)
+ @staticmethod
+ def generate_revision_id(uuid, revnum, path, scheme):
+ return "svn-v2:%d@%s-%s" % (revnum, uuid, escape_svn_path(path))
+
def parse_fileid_property(text):
ret = {}
=== modified file 'specs/revprops.txt'
--- a/specs/revprops.txt 2008-02-02 14:54:33 +0000
+++ b/specs/revprops.txt 2008-02-02 22:55:28 +0000
@@ -66,10 +66,6 @@
last revision with revprops set and set matching revision properties for each
revision with file props.
-Less caching
-~~~~~~~~~~~~
-
-
New settings
~~~~~~~~~~~~
A new per-Subversion-repository setting `support_legacy` will be added. This
=== modified file 'tests/test_mapping.py'
--- a/tests/test_mapping.py 2008-02-01 13:56:12 +0000
+++ b/tests/test_mapping.py 2008-02-02 22:55:28 +0000
@@ -17,8 +17,9 @@
from errors import InvalidPropertyValue
from mapping import (generate_revision_metadata, parse_revision_metadata,
- parse_revid_property, parse_merge_property)
-from bzrlib.tests import TestCase
+ parse_revid_property, parse_merge_property, BzrSvnMappingv1, BzrSvnMappingv2,
+ BzrSvnMappingv3, BzrSvnMappingv4, BzrSvnMappingHybrid)
+from bzrlib.tests import (TestCase, adapt_tests)
from bzrlib.revision import Revision
from bzrlib.trace import mutter
@@ -112,3 +113,35 @@
def test_parse_merge_simple(self):
self.assertEqual(["bla", "bloe"], parse_merge_property("bla\tbloe"))
+
+
+class MappingTestAdapter:
+ def test_roundtrip_revision(self):
+ revid = self.mapping.generate_revision_id("myuuid", 42, "path", "somescheme")
+ (uuid, path, revnum, scheme) = self.mapping.parse_revision_id(revid)
+ self.assertEquals(uuid, "myuuid")
+ self.assertEquals(revnum, 42)
+ self.assertEquals(path, "path")
+ if scheme is not None:
+ self.assertEquals(scheme, "somescheme")
+
+
+class Mappingv1TestAdapter(MappingTestAdapter,TestCase):
+ def setUp(self):
+ self.mapping = BzrSvnMappingv1
+
+
+class Mappingv2TestAdapter(MappingTestAdapter,TestCase):
+ def setUp(self):
+ self.mapping = BzrSvnMappingv2
+
+
+class Mappingv3TestAdapter(MappingTestAdapter,TestCase):
+ def setUp(self):
+ self.mapping = BzrSvnMappingv3
+
+
+#class Mappingv4TestAdapter(MappingTestAdapter,TestCase):
+# def setUp(self):
+# self.mapping = BzrSvnMappingv4
+
More information about the bazaar-commits
mailing list