Rev 503: Add test for svn-import with dumpfile. Fixes #123493 in file:///data/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Thu Jul 12 09:28:31 BST 2007


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

------------------------------------------------------------
revno: 503
revision-id: jelmer at samba.org-20070702220913-jyqdbylhwszzlujy
parent: jelmer at samba.org-20070626203254-pcea47bzqxv3wkw5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Tue 2007-07-03 00:09:13 +0200
message:
  Add test for svn-import with dumpfile. Fixes #123493
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  tests/test_blackbox.py         test_blackbox.py-20070325150839-d10llf8arptpcfl6-1
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'NEWS'
--- a/NEWS	2007-06-24 18:14:04 +0000
+++ b/NEWS	2007-07-02 22:09:13 +0000
@@ -26,6 +26,8 @@
 
    * Support using custom branching schemes.
 
+   * Add blackbox test for svn-import with dumpfile. (#123493)
+
   PERFORMANCE
 
    * do_update() is now used to find the contents of a directory recursively. 

=== modified file '__init__.py'
--- a/__init__.py	2007-06-26 19:43:59 +0000
+++ b/__init__.py	2007-07-02 22:09:13 +0000
@@ -19,10 +19,11 @@
 """
 import os
 import sys
+import tempfile
 import unittest
 import bzrlib
 
-from bzrlib.trace import warning
+from bzrlib.trace import warning, mutter
 
 __version__ = '0.4.0'
 COMPATIBLE_BZR_VERSIONS = [(0, 15), (0, 16), (0, 17), (0, 18)]
@@ -135,6 +136,7 @@
             standalone = False
 
         if os.path.isfile(from_location):
+            from convert import load_dumpfile
             tmp_repos = tempfile.mkdtemp(prefix='bzr-svn-dump-')
             mutter('loading dumpfile %r to %r' % (from_location, tmp_repos))
             load_dumpfile(from_location, tmp_repos)
@@ -148,6 +150,7 @@
                 trees, all)
 
         if tmp_repos is not None:
+            from bzrlib import osutils
             osutils.rmtree(tmp_repos)
 
 

=== modified file 'tests/test_blackbox.py'
--- a/tests/test_blackbox.py	2007-05-17 16:49:47 +0000
+++ b/tests/test_blackbox.py	2007-07-02 22:09:13 +0000
@@ -15,9 +15,16 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 """Blackbox tests."""
 
+from bzrlib.repository import Repository
 from bzrlib.tests.blackbox import ExternalBase
+from bzrlib.trace import mutter
+
 from tests import TestCaseWithSubversionRepository
 
+import os
+
+from revids import generate_svn_revision_id
+
 class TestBranch(ExternalBase,TestCaseWithSubversionRepository):
     def test_branch_empty(self):
         repos_url = self.make_client('d', 'de')
@@ -26,3 +33,165 @@
     def test_log_empty(self):
         repos_url = self.make_client('d', 'de')
         self.assertEquals('', self.runbzr(['log', repos_url])[1])
+
+    def test_dumpfile(self):
+        filename = os.path.join(self.test_dir, "dumpfile")
+        uuid = "606c7b1f-987c-4826-b37d-eb456ceb87e1"
+        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
+
+
+Revision-number: 2
+Prop-content-length: 102
+Content-length: 102
+
+K 7
+svn:log
+V 2
+rm
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-26T00:05:30.775369Z
+PROPS-END
+
+Node-path: x
+Node-action: delete
+
+
+Revision-number: 3
+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: y
+Node-kind: dir
+Node-action: add
+Node-copyfrom-rev: 1
+Node-copyfrom-path: x
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+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: y
+Node-action: delete
+
+
+Revision-number: 5
+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: y
+Node-kind: dir
+Node-action: add
+Node-copyfrom-rev: 1
+Node-copyfrom-path: x
+
+
+""")
+        self.assertEquals(('', ''), 
+                          self.runbzr(['svn-import', '--scheme=none', 
+                                       filename, 'dc']))
+        newrepos = Repository.open("dc")
+        self.assertTrue(newrepos.has_revision(
+            generate_svn_revision_id(uuid, 5, "", "none")))
+        self.assertTrue(newrepos.has_revision(
+            generate_svn_revision_id(uuid, 1, "", "none")))
+        inv1 = newrepos.get_inventory(
+                generate_svn_revision_id(uuid, 1, "", "none"))
+        inv2 = newrepos.get_inventory(
+                generate_svn_revision_id(uuid, 5, "", "none"))
+        self.assertNotEqual(inv1.path2id("y"), inv2.path2id("y"))
+
+

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-06-24 23:33:40 +0000
+++ b/tests/test_repos.py	2007-07-02 22:09:13 +0000
@@ -28,7 +28,6 @@
 
 import svn.fs
 
-from convert import load_dumpfile
 from errors import InvalidPropertyValue
 from fileids import generate_svn_file_id, generate_file_id
 import format




More information about the bazaar-commits mailing list