Rev 4367: Fix failing tests. in http://people.canonical.com/~robertc/baz2.0/check

Robert Collins robertc at robertcollins.net
Wed Aug 5 03:31:12 BST 2009


At http://people.canonical.com/~robertc/baz2.0/check

------------------------------------------------------------
revno: 4367
revision-id: robertc at robertcollins.net-20090805023059-wkw6m0c9fommcwth
parent: robertc at robertcollins.net-20090805010558-60s314d1zxd9cvk7
committer: Robert Collins <robertc at robertcollins.net>
branch nick: check
timestamp: Wed 2009-08-05 12:30:59 +1000
message:
  Fix failing tests.
=== modified file 'bzrlib/check.py'
--- a/bzrlib/check.py	2009-06-16 00:53:41 +0000
+++ b/bzrlib/check.py	2009-08-05 02:30:59 +0000
@@ -402,6 +402,11 @@
 
 
 def check_dwim(path, verbose, do_branch=False, do_repo=False, do_tree=False):
+    """Check multiple objects.
+
+    If errors occur they are accumulated and reported as far as possible, and
+    an exception raised at the end of the process.
+    """
     try:
         base_tree, branch, repo, relpath = \
                         BzrDir.open_containing_tree_branch_or_repository(path)

=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2009-08-04 04:36:34 +0000
+++ b/bzrlib/inventory.py	2009-08-05 02:30:59 +0000
@@ -592,16 +592,16 @@
                  'text_id', 'parent_id', 'children', 'executable',
                  'revision', 'symlink_target', 'reference_revision']
 
-    def _check(self, checker, rev_id):
+    def _check(self, checker, tree_revision_id):
         """See InventoryEntry._check"""
         if self.text_sha1 is not None or self.text_size is not None or self.text_id is not None:
             checker._report_items.append(
                'symlink {%s} has text in revision {%s}'
-                    % (self.file_id, rev_id))
+                    % (self.file_id, tree_revision_id))
         if self.symlink_target is None:
             checker._report_items.append(
                 'symlink {%s} has no target in revision {%s}'
-                    % (self.file_id, rev_id))
+                    % (self.file_id, tree_revision_id))
         # Symlinks are stored as ''
         checker.add_pending_item(tree_revision_id,
             ('texts', self.file_id, self.revision), 'text',

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2009-08-05 01:05:58 +0000
+++ b/bzrlib/remote.py	2009-08-05 02:30:59 +0000
@@ -1470,10 +1470,10 @@
         return self._real_repository.get_revision_reconcile(revision_id)
 
     @needs_read_lock
-    def check(self, revision_ids=None, callback_refs=None):
+    def check(self, revision_ids=None, callback_refs=None, check_repo=True):
         self._ensure_real()
         return self._real_repository.check(revision_ids=revision_ids,
-            callback_refs=callback_refs)
+            callback_refs=callback_refs, check_repo=check_repo)
 
     def copy_content_into(self, destination, revision_id=None):
         self._ensure_real()

=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- a/bzrlib/tests/per_branch/test_push.py	2009-07-10 05:49:34 +0000
+++ b/bzrlib/tests/per_branch/test_push.py	2009-08-05 02:30:59 +0000
@@ -23,6 +23,7 @@
     branch,
     builtins,
     bzrdir,
+    check,
     debug,
     errors,
     push,
@@ -224,7 +225,7 @@
         # fulltext record for f-id @ rev-1, then this will fail.
         remote_branch = Branch.open(self.get_url('remote'))
         trunk.push(remote_branch)
-        remote_branch.check()
+        check.check_dwim(remote_branch.base, False, True, True)
 
     def test_no_get_parent_map_after_insert_stream(self):
         # Effort test for bug 331823

=== modified file 'bzrlib/tests/per_branch/test_stacking.py'
--- a/bzrlib/tests/per_branch/test_stacking.py	2009-07-24 03:15:56 +0000
+++ b/bzrlib/tests/per_branch/test_stacking.py	2009-08-05 02:30:59 +0000
@@ -19,6 +19,7 @@
 from bzrlib import (
     branch,
     bzrdir,
+    check,
     errors,
     )
 from bzrlib.revision import NULL_REVISION
@@ -360,7 +361,7 @@
             self.build_tree_contents([('stacked/a', ''.join(text_lines))])
             stacked_tree.commit('commit %d' % i)
         stacked_tree.branch.repository.pack()
-        stacked_tree.branch.check()
+        check.check_dwim(stacked_tree.branch.base, False, True, True)
 
     def test_pull_delta_when_stacked(self):
         if not self.branch_format.supports_stacking():
@@ -384,7 +385,7 @@
         # bug 252821 caused a RevisionNotPresent here...
         stacked_tree.pull(other_tree.branch)
         stacked_tree.branch.repository.pack()
-        stacked_tree.branch.check()
+        check.check_dwim(stacked_tree.branch.base, False, True, True)
         self.check_lines_added_or_present(stacked_tree.branch, stacked_revid)
 
     def test_fetch_revisions_with_file_changes(self):

=== modified file 'bzrlib/tests/per_interbranch/test_push.py'
--- a/bzrlib/tests/per_interbranch/test_push.py	2009-07-10 05:49:34 +0000
+++ b/bzrlib/tests/per_interbranch/test_push.py	2009-08-05 02:30:59 +0000
@@ -23,6 +23,7 @@
     branch,
     builtins,
     bzrdir,
+    check,
     debug,
     errors,
     push,
@@ -230,7 +231,7 @@
         # fulltext record for f-id @ rev-1, then this will fail.
         remote_branch = Branch.open(self.get_url('remote'))
         trunk.push(remote_branch)
-        remote_branch.check()
+        check.check_dwim(remote_branch.base, False, True, True)
 
     def test_no_get_parent_map_after_insert_stream(self):
         # Effort test for bug 331823

=== modified file 'bzrlib/tests/test_commit_merge.py'
--- a/bzrlib/tests/test_commit_merge.py	2009-06-17 19:08:25 +0000
+++ b/bzrlib/tests/test_commit_merge.py	2009-08-05 02:30:59 +0000
@@ -18,14 +18,14 @@
 import os
 import shutil
 
+from bzrlib import check, osutils
+from bzrlib.branch import Branch
+from bzrlib.errors import PointlessCommit, BzrError
 from bzrlib.tests import (
     SymlinkFeature,
     TestCaseWithTransport,
     )
-from bzrlib.branch import Branch
-from bzrlib.errors import PointlessCommit, BzrError
 from bzrlib.tests.test_revision import make_branches
-from bzrlib import osutils
 
 
 class TestCommitMerge(TestCaseWithTransport):
@@ -96,10 +96,8 @@
         self.assertEquals(inv['ecks-id'].revision, 'x at u-0-1')
         self.assertEquals(inv['why-id'].revision, 'y at u-0-1')
 
-        bx.check()
-        by.check()
-        bx.repository.check([bx.last_revision()])
-        by.repository.check([by.last_revision()])
+        check.check_dwim(bx.base, False, True, True)
+        check.check_dwim(by.base, False, True, True)
 
     def test_merge_with_symlink(self):
         self.requireFeature(SymlinkFeature)

=== modified file 'bzrlib/tests/test_upgrade_stacked.py'
--- a/bzrlib/tests/test_upgrade_stacked.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_upgrade_stacked.py	2009-08-05 02:30:59 +0000
@@ -19,6 +19,7 @@
 
 from bzrlib import (
     bzrdir,
+    check,
     errors,
     tests,
     )
@@ -56,13 +57,14 @@
             self.assertRaises(errors.IncompatibleRepositories,
                 stacked.open_branch)
         else:
-            stacked.open_branch().check()
+            check.check_dwim('stacked', False, True, True)
         stacked = bzrdir.BzrDir.open('stacked')
         # but we can upgrade the stacked repository
         upgrade('stacked', new_format)
-        # and now it's ok
+        # and now it opens ok
         stacked = bzrdir.BzrDir.open('stacked')
-        stacked.open_branch().check()
+        # And passes check.
+        check.check_dwim('stacked', False, True, True)
 
 
 def load_tests(basic_tests, module, loader):




More information about the bazaar-commits mailing list