Rev 21: Tests. in file:///data/jelmer/bzr-rebase/trunk/

Jelmer Vernooij jelmer at samba.org
Thu Jul 12 09:22:44 BST 2007


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

------------------------------------------------------------
revno: 21
revision-id: jelmer at samba.org-20070710132401-2uwonjhe2lq38rbj
parent: jelmer at samba.org-20070709210051-8ekdsszc207gqs5u
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-07-10 14:24:01 +0100
message:
  Tests.
modified:
  maptree.py                     maptree.py-20070709163407-quin1nc7pd9bp2mo-1
  test_blackbox.py               test_blackbox.py-20070709202607-dyvt95dfu09tuv6a-1
  test_maptree.py                test_maptree.py-20070709163406-wv3n8o12iygpxf4l-1
=== modified file 'maptree.py'
--- a/maptree.py	2007-07-09 20:18:58 +0000
+++ b/maptree.py	2007-07-10 13:24:01 +0000
@@ -25,6 +25,13 @@
 
 
 def map_file_ids(repository, old_parents, new_parents):
+    """Try to determine the equivalent file ids in two sets of parents.
+
+    :param repository: Repository to use
+    :param old_parents: List of revision ids of old parents
+    :param new_parents: List of revision ids of new parents
+    """
+    assert len(old_parents) == len(new_parents)
     ret = {}
     for (oldp, newp) in zip(old_parents, new_parents):
         oldinv = repository.get_revision_inventory(oldp)
@@ -67,6 +74,7 @@
     def has_id(self, id):
         return self.oldinv.has_id(self.maptree.old_id(id))
 
+
 class MapTree:
     """Wrapper around a tree that translates file ids.
     """

=== modified file 'test_blackbox.py'
--- a/test_blackbox.py	2007-07-09 21:00:51 +0000
+++ b/test_blackbox.py	2007-07-10 13:24:01 +0000
@@ -90,4 +90,6 @@
         self.run_bzr_error('bzr: ERROR: No rebase to abort', 
                            'rebase-abort')
 
-
+    def test_todo_nothing(self):
+        self.run_bzr_error('bzr: ERROR: No rebase in progress', 
+                           'rebase-todo')

=== modified file 'test_maptree.py'
--- a/test_maptree.py	2007-07-09 20:18:58 +0000
+++ b/test_maptree.py	2007-07-10 13:24:01 +0000
@@ -18,7 +18,7 @@
 from bzrlib.tests import TestCase, TestCaseWithTransport
 from bzrlib.treebuilder import TreeBuilder
 
-from maptree import MapTree
+from maptree import MapTree, map_file_ids
 
 
 class EmptyMapTreeTests(TestCaseWithTransport):
@@ -92,3 +92,7 @@
                               self.maptree.inventory.path2id("foo")))
         self.assertFalse(self.maptree.inventory.has_id("bar"))
 
+
+class MapFileIdTests(TestCase):
+    def test_empty(self):
+        self.assertEquals({}, map_file_ids(None, [], []))




More information about the bazaar-commits mailing list