Rev 1737: Move mapping3 tests to separate module. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Sun Aug 31 16:31:11 BST 2008


At file:///data/jelmer/bzr-svn/trunk/

------------------------------------------------------------
revno: 1737
revision-id: jelmer at samba.org-20080831153104-hh26ung03bw0pxwu
parent: jelmer at samba.org-20080831151611-ega0b129bdtg7fq6
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sun 2008-08-31 17:31:04 +0200
message:
  Move mapping3 tests to separate module.
added:
  tests/mapping3/                mapping3-20080831152307-zvp13x6mxbvt493a-1
  tests/mapping3/__init__.py     __init__.py-20080831152358-oy04n53cpnh64aj6-1
renamed:
  tests/test_scheme.py => tests/mapping3/test_scheme.py test_scheme.py-20060621221855-va2xabhlxpmc9llx-1
modified:
  TODO                           todo-20060729211917-2kpobww0zyvvo0j2-1
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  mapping3/__init__.py           __init__.py-20080502174630-9324zh25kka98vlw-1
  tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
  tests/test_fetch.py            test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
  tests/test_mapping.py          test_mapping.py-20080201131338-0zd86eznn4bojtee-1
=== modified file 'TODO'
--- a/TODO	2008-08-31 13:41:04 +0000
+++ b/TODO	2008-08-31 15:31:04 +0000
@@ -1,8 +1,8 @@
 mappingv4:
  - implement layout functions, including command
- - integrate svn-set-revprops into svn-upgrade ?
  - add options in commit for create_root, create_prefix
   - if create_root=False: skip _check_dirs_exist
+  - create branches/ dir automatically
  - allow skipping a revision completely - to allow creating branches using "svn cp"
 
 - generate deltas rather than fulltexts when creating file id maps
@@ -20,8 +20,6 @@
 .svn working trees:
 - implement apply_inventory_delta()
 
-pushmerge:
- - create branches/ dir automatically
 
 - Needs more tests
  - parents cache

=== modified file 'mapping.py'
--- a/mapping.py	2008-08-31 15:03:10 +0000
+++ b/mapping.py	2008-08-31 15:31:04 +0000
@@ -708,7 +708,7 @@
         'Second format (bzr-svn 0.3.x)')
 mapping_registry.register_lazy('v3', 'bzrlib.plugins.svn.mapping3', 
                                'BzrSvnMappingv3FileProps', 
-                               'Default third format (bzr-svn 0.4.x)')
+                               'Third format (bzr-svn 0.4.x)')
 mapping_registry.register_lazy('v4', 'bzrlib.plugins.svn.mapping4', 
                                'BzrSvnMappingv4',
                                'Fourth format (bzr-svn 0.5.x)')

=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py	2008-08-30 03:08:49 +0000
+++ b/mapping3/__init__.py	2008-08-31 15:31:04 +0000
@@ -166,6 +166,7 @@
         else:
             self.scheme = scheme
         self.guessed_scheme = guessed_scheme
+        self.name = "v3-" + str(scheme)
 
     @classmethod
     def from_revprops(cls, revprops):
@@ -282,7 +283,6 @@
 
     def __init__(self, scheme, guessed_scheme=None):
         BzrSvnMappingv3.__init__(self, scheme, guessed_scheme)
-        self.name = "v3-" + str(scheme)
         self.revprop_map = mapping.BzrSvnMappingRevProps()
 
     def export_text_parents(self, text_parents, svn_revprops, fileprops):
@@ -305,11 +305,3 @@
         if revprops is not None:
             self.revprop_map.export_message(log, revprops, fileprops)
 
-
-class BzrSvnMappingv3RevProps(mapping.BzrSvnMappingRevProps, BzrSvnMappingv3):
-    def export_revision(self, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, parent_ids, svn_revprops, svn_fileprops):
-        mapping.BzrSvnMappingRevProps.export_revision(self, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, parent_ids, svn_revprops, svn_fileprops)
-        svn_revprops[mapping.SVN_REVPROP_BZR_MAPPING_VERSION] = "3"
-
-
-

=== modified file 'tests/__init__.py'
--- a/tests/__init__.py	2008-08-31 14:14:47 +0000
+++ b/tests/__init__.py	2008-08-31 15:31:04 +0000
@@ -342,7 +342,8 @@
             'test_versionedfiles',
             'test_wc',
             'test_workingtree',
-            'test_blackbox']
+            'test_blackbox',
+            'mapping3']
     suite.addTest(loader.loadTestsFromModuleNames(["%s.%s" % (__name__, i) for i in testmod_names]))
     suite.addTest(loader.loadTestsFromModuleNames(["bzrlib.plugins.svn.foreign.test_versionedfiles"]))
 

=== added directory 'tests/mapping3'
=== added file 'tests/mapping3/__init__.py'
--- a/tests/mapping3/__init__.py	1970-01-01 00:00:00 +0000
+++ b/tests/mapping3/__init__.py	2008-08-31 15:31:04 +0000
@@ -0,0 +1,86 @@
+# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer at samba.org>
+ 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from bzrlib.tests import TestCase
+
+from bzrlib.plugins.svn.mapping3 import BzrSvnMappingv3FileProps
+from bzrlib.plugins.svn.mapping3.scheme import NoBranchingScheme
+from bzrlib.plugins.svn.tests.test_mapping import MappingTestAdapter
+
+class Mappingv3FilePropTests(MappingTestAdapter, TestCase):
+    def setUp(self):
+        self.mapping = BzrSvnMappingv3FileProps(NoBranchingScheme())
+
+    def test_generate_revid(self):
+        self.assertEqual("svn-v3-undefined:myuuid:branch:5", 
+                         BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, "branch", "undefined"))
+
+    def test_generate_revid_nested(self):
+        self.assertEqual("svn-v3-undefined:myuuid:branch%2Fpath:5", 
+                  BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, "branch/path", "undefined"))
+
+    def test_generate_revid_special_char(self):
+        self.assertEqual("svn-v3-undefined:myuuid:branch%2C:5", 
+             BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, "branch\x2c", "undefined"))
+
+    def test_generate_revid_nordic(self):
+        self.assertEqual("svn-v3-undefined:myuuid:branch%C3%A6:5", 
+             BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, u"branch\xe6".encode("utf-8"), "undefined"))
+
+    def test_parse_revid_simple(self):
+        self.assertEqual(("uuid", "", 4, "undefined"),
+                         BzrSvnMappingv3FileProps._parse_revision_id(
+                             "svn-v3-undefined:uuid::4"))
+
+    def test_parse_revid_nested(self):
+        self.assertEqual(("uuid", "bp/data", 4, "undefined"),
+                         BzrSvnMappingv3FileProps._parse_revision_id(
+                     "svn-v3-undefined:uuid:bp%2Fdata:4"))
+
+    def test_generate_file_id_root(self):
+        self.assertEqual("2 at uuid:bp:", self.mapping.generate_file_id("uuid", 2, "bp", u""))
+
+    def test_generate_file_id_path(self):
+        self.assertEqual("2 at uuid:bp:mypath", 
+                self.mapping.generate_file_id("uuid", 2, "bp", u"mypath"))
+
+    def test_generate_file_id_long(self):
+        dir = "this/is/a" + ("/very"*40) + "/long/path/"
+        self.assertEqual("2 at uuid:bp;" + sha1(dir+"filename"), 
+                self.mapping.generate_file_id("uuid", 2, "bp", dir+u"filename"))
+
+    def test_generate_file_id_long_nordic(self):
+        dir = "this/is/a" + ("/very"*40) + "/long/path/"
+        self.assertEqual("2 at uuid:bp;" + sha1((dir+u"filename\x2c\x8a").encode('utf-8')), 
+                self.mapping.generate_file_id("uuid", 2, "bp", dir+u"filename\x2c\x8a"))
+
+    def test_generate_file_id_special_char(self):
+        self.assertEqual("2 at uuid:bp:mypath%2C%C2%8A",
+                         self.mapping.generate_file_id("uuid", 2, "bp", u"mypath\x2c\x8a"))
+
+    def test_generate_file_id_spaces(self):
+        self.assertFalse(" " in self.mapping.generate_file_id("uuid", 1, "b p", u"my path"))
+
+    def test_generate_svn_file_id(self):
+        self.assertEqual("2 at uuid:bp:path", 
+                self.mapping.generate_file_id("uuid", 2, "bp", u"path"))
+
+    def test_generate_svn_file_id_nordic(self):
+        self.assertEqual("2 at uuid:bp:%C3%A6%C3%B8%C3%A5", 
+                self.mapping.generate_file_id("uuid", 2, "bp", u"\xe6\xf8\xe5"))
+
+    def test_generate_svn_file_id_nordic_branch(self):
+        self.assertEqual("2 at uuid:%C3%A6:%C3%A6%C3%B8%C3%A5", 
+                self.mapping.generate_file_id("uuid", 2, u"\xe6".encode('utf-8'), u"\xe6\xf8\xe5"))

=== renamed file 'tests/test_scheme.py' => 'tests/mapping3/test_scheme.py'
=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py	2008-08-30 23:45:11 +0000
+++ b/tests/test_fetch.py	2008-08-31 15:31:04 +0000
@@ -438,7 +438,7 @@
         tmp.add_dir("branches/tmp/abranch", "trunk/mydir")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme())
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
@@ -1491,7 +1491,7 @@
         branches.add_dir("branches/foobranch", "trunk")
         dc.close()
 
-        repos = remote.SvnRemoteAccess(SvnRaTransport("svn+"+repos_url), format.SvnRemoteFormat()).find_repository()
+        repos = remote.SvnRemoteAccess(SvnRaTransport(repos_url), format.SvnRemoteFormat()).find_repository()
         set_branching_scheme(repos, TrunkBranchingScheme())
 
         mapping = repos.get_mapping()
@@ -1550,7 +1550,7 @@
         f.change_prop("svn:executable", "*")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir1 = BzrDir.create("f", format.get_rich_root_format())
         dir2 = BzrDir.create("g", format.get_rich_root_format())
         newrepos1 = dir1.create_repository()
@@ -1576,7 +1576,7 @@
         blie.change_prop("svn:executable", "")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1601,7 +1601,7 @@
         dc.open_file("bla").modify("data2")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1625,7 +1625,7 @@
         l.change_prop("svn:special", "*")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1650,7 +1650,7 @@
         l.change_prop("svn:special", "*")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1693,7 +1693,7 @@
         dc = self.get_commit_editor(repos_url)
         dc.open_file("mylink").change_prop("svn:special", "*")
         dc.close()
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1719,7 +1719,7 @@
         dc.open_file("bla").change_prop("svn:executable", "*")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1743,7 +1743,7 @@
         dc.change_prop("bzr:ancestry:v3-none", "aghost\n")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1766,7 +1766,7 @@
         foo.open_file("branches/foo/bla").modify("more data")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
 
         dc = self.get_commit_editor(repos_url)
         dc.open_dir("trunk").change_prop("svk:merge", 
@@ -1791,7 +1791,7 @@
         dc.change_prop("bzr:ancestry:v3-none", "a ghost\n")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1820,7 +1820,7 @@
         dc.change_prop("some:property", "some data4\n")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
@@ -1855,7 +1855,7 @@
         trunk.change_prop("some:property", "some data3\n")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme())
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()
@@ -1899,7 +1899,7 @@
         stationary.add_file("branches/abranch/bdir/stationary/traveller").modify("data")
         dc.close()
 
-        oldrepos = Repository.open("svn+"+repos_url)
+        oldrepos = Repository.open(repos_url)
         set_branching_scheme(oldrepos, TrunkBranchingScheme())
         dir = BzrDir.create("f", format.get_rich_root_format())
         newrepos = dir.create_repository()

=== modified file 'tests/test_mapping.py'
--- a/tests/test_mapping.py	2008-08-30 22:14:26 +0000
+++ b/tests/test_mapping.py	2008-08-31 15:31:04 +0000
@@ -26,9 +26,8 @@
                      parse_revid_property, parse_merge_property, parse_text_parents_property,
                      generate_text_parents_property, BzrSvnMappingv1, BzrSvnMappingv2, 
                      parse_revision_id, escape_svn_path, unescape_svn_path)
-from bzrlib.plugins.svn.mapping3 import (BzrSvnMappingv3FileProps, BzrSvnMappingv3RevProps)
+from bzrlib.plugins.svn.mapping3 import BzrSvnMappingv3FileProps
 from bzrlib.plugins.svn.mapping4 import BzrSvnMappingv4
-from bzrlib.plugins.svn.mapping3.scheme import NoBranchingScheme
 
 
 class MetadataMarshallerTests(TestCase):
@@ -239,76 +238,6 @@
     return sha.new(text).hexdigest()
 
 
-class Mappingv3FilePropTests(MappingTestAdapter, TestCase):
-    def setUp(self):
-        self.mapping = BzrSvnMappingv3FileProps(NoBranchingScheme())
-
-    def test_generate_revid(self):
-        self.assertEqual("svn-v3-undefined:myuuid:branch:5", 
-                         BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, "branch", "undefined"))
-
-    def test_generate_revid_nested(self):
-        self.assertEqual("svn-v3-undefined:myuuid:branch%2Fpath:5", 
-                  BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, "branch/path", "undefined"))
-
-    def test_generate_revid_special_char(self):
-        self.assertEqual("svn-v3-undefined:myuuid:branch%2C:5", 
-             BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, "branch\x2c", "undefined"))
-
-    def test_generate_revid_nordic(self):
-        self.assertEqual("svn-v3-undefined:myuuid:branch%C3%A6:5", 
-             BzrSvnMappingv3FileProps._generate_revision_id("myuuid", 5, u"branch\xe6".encode("utf-8"), "undefined"))
-
-    def test_parse_revid_simple(self):
-        self.assertEqual(("uuid", "", 4, "undefined"),
-                         BzrSvnMappingv3FileProps._parse_revision_id(
-                             "svn-v3-undefined:uuid::4"))
-
-    def test_parse_revid_nested(self):
-        self.assertEqual(("uuid", "bp/data", 4, "undefined"),
-                         BzrSvnMappingv3FileProps._parse_revision_id(
-                     "svn-v3-undefined:uuid:bp%2Fdata:4"))
-
-    def test_generate_file_id_root(self):
-        self.assertEqual("2 at uuid:bp:", self.mapping.generate_file_id("uuid", 2, "bp", u""))
-
-    def test_generate_file_id_path(self):
-        self.assertEqual("2 at uuid:bp:mypath", 
-                self.mapping.generate_file_id("uuid", 2, "bp", u"mypath"))
-
-    def test_generate_file_id_long(self):
-        dir = "this/is/a" + ("/very"*40) + "/long/path/"
-        self.assertEqual("2 at uuid:bp;" + sha1(dir+"filename"), 
-                self.mapping.generate_file_id("uuid", 2, "bp", dir+u"filename"))
-
-    def test_generate_file_id_long_nordic(self):
-        dir = "this/is/a" + ("/very"*40) + "/long/path/"
-        self.assertEqual("2 at uuid:bp;" + sha1((dir+u"filename\x2c\x8a").encode('utf-8')), 
-                self.mapping.generate_file_id("uuid", 2, "bp", dir+u"filename\x2c\x8a"))
-
-    def test_generate_file_id_special_char(self):
-        self.assertEqual("2 at uuid:bp:mypath%2C%C2%8A",
-                         self.mapping.generate_file_id("uuid", 2, "bp", u"mypath\x2c\x8a"))
-
-    def test_generate_file_id_spaces(self):
-        self.assertFalse(" " in self.mapping.generate_file_id("uuid", 1, "b p", u"my path"))
-
-    def test_generate_svn_file_id(self):
-        self.assertEqual("2 at uuid:bp:path", 
-                self.mapping.generate_file_id("uuid", 2, "bp", u"path"))
-
-    def test_generate_svn_file_id_nordic(self):
-        self.assertEqual("2 at uuid:bp:%C3%A6%C3%B8%C3%A5", 
-                self.mapping.generate_file_id("uuid", 2, "bp", u"\xe6\xf8\xe5"))
-
-    def test_generate_svn_file_id_nordic_branch(self):
-        self.assertEqual("2 at uuid:%C3%A6:%C3%A6%C3%B8%C3%A5", 
-                self.mapping.generate_file_id("uuid", 2, u"\xe6".encode('utf-8'), u"\xe6\xf8\xe5"))
-
-
-class Mappingv3RevPropTests(MappingTestAdapter, TestCase):
-    def setUp(self):
-        self.mapping = BzrSvnMappingv3RevProps(NoBranchingScheme())
 
 
 class Mappingv4TestAdapter(MappingTestAdapter, TestCase):
@@ -372,6 +301,3 @@
 
     def test_escape_svn_path_nordic(self):
         self.assertEqual("foobar%C3%A6", escape_svn_path(u"foobar\xe6".encode("utf-8")))
-
-
-




More information about the bazaar-commits mailing list