Rev 516: Fix some tests. in file:///home/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Thu Jul 5 17:28:33 BST 2007


------------------------------------------------------------
revno: 516
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Thu 2007-07-05 18:28:11 +0200
message:
  Fix some tests.
modified:
  logwalker.py
  repository.py
  tests/test_repos.py
  tests/test_upgrade.py
=== modified file 'logwalker.py'
--- a/logwalker.py	2007-07-03 00:31:08 +0000
+++ b/logwalker.py	2007-07-05 16:28:11 +0000
@@ -252,8 +252,11 @@
     def find_children(self, path, revnum):
         """Find all children of path in revnum."""
         path = path.strip("/")
-        if self.transport.check_path(path, revnum) == svn.core.svn_node_file:
+        ft = self.transport.check_path(path, revnum)
+        if ft == svn.core.svn_node_file:
             return []
+        assert ft == svn.core.svn_node_dir
+
         class TreeLister(svn.delta.Editor):
             def __init__(self, base):
                 self.files = []
@@ -296,12 +299,16 @@
         pool = Pool()
         editor = TreeLister(path)
         edit, baton = svn.delta.make_editor(editor, pool)
-        root_repos = self.transport.get_repos_root()
-        self.transport.reparent(os.path.join(root_repos, path))
-        reporter = self.transport.do_update(
-                        revnum, "", True, edit, baton, pool)
-        reporter.set_path("", revnum, True, None, pool)
-        reporter.finish_report(pool)
+        old_base = self.transport.base
+        try:
+            root_repos = self.transport.get_repos_root()
+            self.transport.reparent(os.path.join(root_repos, path))
+            reporter = self.transport.do_update(
+                            revnum, "", True, edit, baton, pool)
+            reporter.set_path("", revnum, True, None, pool)
+            reporter.finish_report(pool)
+        finally:
+            self.transport.reparent(old_base)
         return editor.files
 
     def get_previous(self, path, revnum):

=== modified file 'repository.py'
--- a/repository.py	2007-07-04 21:33:40 +0000
+++ b/repository.py	2007-07-05 16:28:11 +0000
@@ -291,11 +291,18 @@
             return True
 
         try:
-            self.lookup_revision_id(revision_id)
-            return True
+            (path, revnum, scheme) = self.lookup_revision_id(revision_id)
         except NoSuchRevision:
             return False
 
+        try:
+            return (svn.core.svn_node_dir == self.transport.check_path(path, revnum))
+        except SubversionException, (_, num):
+            if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
+                return False
+            raise
+
+
     def revision_trees(self, revids):
         """See Repository.revision_trees()."""
         for revid in revids:

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-07-03 16:42:54 +0000
+++ b/tests/test_repos.py	2007-07-05 16:28:11 +0000
@@ -369,6 +369,12 @@
         repository = bzrdir.find_repository()
         self.assertTrue(repository.has_revision(None))
 
+    def test_has_revision_future(self):
+        bzrdir = self.make_client_and_bzrdir('d', 'dc')
+        repository = bzrdir.find_repository()
+        self.assertFalse(repository.has_revision(
+            generate_svn_revision_id(repository.uuid, 5, "", "none")))
+
     def test_revision_parents(self):
         repos_url = self.make_client('d', 'dc')
         self.build_tree({'dc/foo': "data"})

=== modified file 'tests/test_upgrade.py'
--- a/tests/test_upgrade.py	2007-07-04 21:23:52 +0000
+++ b/tests/test_upgrade.py	2007-07-05 16:28:11 +0000
@@ -250,7 +250,7 @@
         file("f/a", 'w').write("blackfield")
         wt.commit(message='fix it again', rev_id="anotherrev")
 
-        upgrade_branch(b, oldrepos, allow_change=True)
+        upgrade_branch(b, oldrepos, allow_changes=True)
         self.assertEqual([oldrepos.generate_revision_id(0, "", "none"),
                           oldrepos.generate_revision_id(1, "", "none"),
                           "customrev-svn%d-upgrade" % MAPPING_VERSION,




More information about the bazaar-commits mailing list