Origin: commit, revision id: jelmer@samba.org-20120208115255-fwy28b8s3wr4v7bg
Author: Jelmer Vernooij <jelmer@samba.org>
Last-Update: 2012-02-08
Applied-Upstream: no
X-Bzr-Revision-Id: jelmer@samba.org-20120208115255-fwy28b8s3wr4v7bg

=== modified file 'cvsps/importer.py'
--- old/cvsps/importer.py	2011-05-27 01:43:05 +0000
+++ new/cvsps/importer.py	2012-02-08 11:52:55 +0000
@@ -39,6 +39,7 @@
     transport,
     ui,
     workingtree,
+    version_info as bzrlib_version,
     )
 
 import cvsps_errors
@@ -341,7 +342,7 @@
             # kind, size, executable, sha
             if file_id is None:
                 file_id = self._inventory.path2id(path)
-            if file_id not in self._base_inventory:
+            if not self._base_inventory.has_id(file_id):
                 # Should only happen for the root
                 ie = self._inventory[file_id]
             else:
@@ -417,21 +418,10 @@
             parents = [self._revision_id]
             parent_invs = [self._base_inventory]
 
-        # We explicitly use a config of None, because we want to make sure to
-        # supply everything manually, and not have it guessed by the commit
-        # builder.
-        config = None
-
         revprops = {}
         revprops['branch-nick'] = branch_name
 
-        # We go directly to the branch.repository.get_commit_builder, because
-        # Branch.get_commit_builder() always overrides the fact that 'config'
-        # is None, by building its own Config object. Which turns out to take
-        # quite a bit of time.
-        builder = branch.repository.get_commit_builder(branch,
-                    parents=parents,
-                    config=config,
+        builder = branch.get_commit_builder(parents=parents,
                     timestamp=timestamp, timezone=timezone,
                     committer=committer, revprops=revprops,
                     revision_id=revision_id)

=== modified file 'test_cvsps_import.py'
--- old/test_cvsps_import.py	2007-09-26 16:46:11 +0000
+++ new/test_cvsps_import.py	2012-02-08 11:52:09 +0000
@@ -48,7 +48,7 @@
         """Create a cvs repo for use with the test."""
         self.cvs_root = osutils.abspath('cvs_root')
         self.cvs('init')
-        self.failUnlessExists('cvs_root/CVSROOT')
+        self.assertPathExists('cvs_root/CVSROOT')
 
     def run_command(self, cmd, working_dir=None, stdin='', returncode=0):
         """Run a generic command.
@@ -213,7 +213,7 @@
         self.build_tree(['checkout/a'])
         self.cvs('add', 'a')
         self.cvs('commit', '-m', 'init')
-        self.failUnlessExists(osutils.pathjoin(self.cvs_root, 'a,v'))
+        self.assertPathExists(osutils.pathjoin(self.cvs_root, 'a,v'))
 
         # Test that we can run 'cvsps'
         out = self.cvsps()
@@ -666,7 +666,7 @@
         self.assertEqual({}, min_tree._executable)
 
         # And the branch itself should be updated
-        self.assertEqual(['rev-1', 'rev-2'], tree.branch.revision_history())
+        self.assertEqual((2, 'rev-2'), tree.branch.last_revision_info())
         rev_tree = tree.branch.repository.revision_tree('rev-2')
         self.assertInvEqual(['', 'a', 'b', 'd', 'b/c'], rev_tree.inventory)
 
@@ -762,23 +762,23 @@
         self.setup_basic_tree()
         a_control = osutils.pathjoin(self.cvs_root, 'a,v')
         a_attic_control = osutils.pathjoin(self.cvs_root, 'Attic', 'a,v')
-        self.failUnlessExists(a_control)
-        self.failIfExists(a_attic_control)
+        self.assertPathExists(a_control)
+        self.assertPathDoesNotExist(a_attic_control)
 
         b_control = osutils.pathjoin(self.cvs_root, 'sub', 'b,v')
         b_attic_control = osutils.pathjoin(self.cvs_root, 'sub', 'Attic', 'b,v')
-        self.failUnlessExists(b_control)
-        self.failIfExists(b_attic_control)
+        self.assertPathExists(b_control)
+        self.assertPathDoesNotExist(b_attic_control)
 
         c_control = osutils.pathjoin(self.cvs_root, 'c,v')
         c_attic_control = osutils.pathjoin(self.cvs_root, 'Attic', 'c,v')
-        self.failIfExists(c_control)
-        self.failUnlessExists(c_attic_control)
+        self.assertPathDoesNotExist(c_control)
+        self.assertPathExists(c_attic_control)
 
         d_control = osutils.pathjoin(self.cvs_root, 'sub', 'd,v')
         d_attic_control = osutils.pathjoin(self.cvs_root, 'sub', 'Attic', 'd,v')
-        self.failIfExists(d_control)
-        self.failUnlessExists(d_attic_control)
+        self.assertPathDoesNotExist(d_control)
+        self.assertPathExists(d_attic_control)
 
         updater = cvsps.importer.CVSUpdater(self.cvs_root, '.')
         
@@ -808,14 +808,14 @@
         # For 'c' and 'd' the files have been deleted in the main branch
         self.assertEqual(([], ['c']),
                          updater.update_file('test_out', 'c', '1.1(DEAD)'))
-        self.failIfExists('test_out/c')
+        self.assertPathDoesNotExist('test_out/c')
 
         # If the subdir is empty, it will be removed
         os.remove('test_out/sub/b')
         self.assertEqual(([], ['sub/d', 'sub']),
                          updater.update_file('test_out', 'sub/d', '1.1(DEAD)'))
-        self.failIfExists('test_out/sub/d')
-        self.failIfExists('test_out/sub')
+        self.assertPathDoesNotExist('test_out/sub/d')
+        self.assertPathDoesNotExist('test_out/sub')
 
     def test__is_executable(self):
         if not osutils.supports_executable():
@@ -850,21 +850,21 @@
         # containing directories
         self.build_tree(['file', 'dir/', 'dir/file1', 'dir/file2'])
         self.assertEqual(['file'], updater._remove_file('.', 'file'))
-        self.failIfExists('file')
+        self.assertPathDoesNotExist('file')
 
         self.assertEqual(['dir/file2'], updater._remove_file('.', 'dir/file2'))
-        self.failIfExists('dir/file2')
+        self.assertPathDoesNotExist('dir/file2')
 
         self.assertEqual(['dir/file1', 'dir'],
                          updater._remove_file('.', 'dir/file1'))
-        self.failIfExists('dir/file1')
-        self.failIfExists('dir')
+        self.assertPathDoesNotExist('dir/file1')
+        self.assertPathDoesNotExist('dir')
 
         # But if we only supply the path, it shouldn't remove the dir
         self.build_tree(['dir/', 'dir/file'])
         self.assertEqual(['file'], updater._remove_file('dir', 'file'))
-        self.failIfExists('dir/file')
-        self.failUnlessExists('dir')
+        self.assertPathDoesNotExist('dir/file')
+        self.assertPathExists('dir')
 
     def test__prepare_target(self):
         updater = cvsps.importer.CVSUpdater('.', '.')
@@ -873,12 +873,12 @@
 
         self.assertEqual(('./dir1/file1', ['dir1']),
                          updater._prepare_target('.', 'dir1/file1'))
-        self.failUnlessExists('dir1')
+        self.assertPathExists('dir1')
 
         self.assertEqual(('./dir2/subdir1/file1', ['dir2', 'dir2/subdir1']),
                          updater._prepare_target('.', 'dir2/subdir1/file1'))
-        self.failUnlessExists('dir2')
-        self.failUnlessExists('dir2/subdir1')
+        self.assertPathExists('dir2')
+        self.assertPathExists('dir2/subdir1')
 
         # And it should only operate in relative paths
         self.assertEqual(('dir2/subdir1/file2', []),
@@ -886,4 +886,4 @@
 
         self.assertEqual(('dir2/subdir2/file1', ['subdir2']),
                          updater._prepare_target('dir2', 'subdir2/file1'))
-        self.failUnlessExists('dir2/subdir2')
+        self.assertPathExists('dir2/subdir2')

