Rev 4665: (robertc) Fix bug 416732 by not adding root directories to expected in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Aug 31 01:27:41 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4665 [merge]
revision-id: pqm at pqm.ubuntu.com-20090831002739-vd6487doda1b2k9h
parent: pqm at pqm.ubuntu.com-20090830221530-cyl2ubhnn49s05m2
parent: robertc at robertcollins.net-20090830235110-s0lzzqf65zfsxp7m
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-08-31 01:27:39 +0100
message:
  (robertc) Fix bug 416732 by not adding root directories to expected
  	items when checking non rich root repositories. (Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/per_repository/test_check.py test_check.py-20070824124512-38g4d135gcqxo4zb-1
=== modified file 'NEWS'
--- a/NEWS	2009-08-30 21:34:42 +0000
+++ b/NEWS	2009-08-30 23:51:10 +0000
@@ -18,6 +18,10 @@
 Bug Fixes
 *********
 
+* ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no
+  longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
+  (Robert Collins, #416732)
+
 * Don't restrict the command name used to run the test suite.
   (Vincent Ladeuil, #419950)
 
@@ -57,6 +61,10 @@
 Bug Fixes
 *********
 
+* ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no
+  longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
+  (Robert Collins, #416732)
+
 * ``bzr log stacked-branch`` shows the full log including
   revisions that are in the fallback repository. (Regressed in 2.0rc1).
   (John Arbash Meinel, #419241)

=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2009-08-28 05:00:33 +0000
+++ b/bzrlib/inventory.py	2009-08-30 23:51:10 +0000
@@ -437,7 +437,13 @@
             self.text_id is not None):
             checker._report_items.append('directory {%s} has text in revision {%s}'
                                 % (self.file_id, rev_id))
-        # Directories are stored as ''.
+        # In non rich root repositories we do not expect a file graph for the
+        # root.
+        if self.name == '' and not checker.rich_roots:
+            return
+        # Directories are stored as an empty file, but the file should exist
+        # to provide a per-fileid log. The hash of every directory content is
+        # "da..." below (the sha1sum of '').
         checker.add_pending_item(rev_id,
             ('texts', self.file_id, self.revision), 'text',
              'da39a3ee5e6b4b0d3255bfef95601890afd80709')

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-08-28 05:00:33 +0000
+++ b/bzrlib/repository.py	2009-08-30 23:51:10 +0000
@@ -1222,7 +1222,7 @@
                     for record in getattr(self, kind).check(keys=keys[kind]):
                         if record.storage_kind == 'absent':
                             checker._report_items.append(
-                                'Missing inventory {%s}' % (record.key,))
+                                'Missing %s {%s}' % (kind, record.key,))
                         else:
                             last_object = self._check_record(kind, record,
                                 checker, last_object, current_keys[(kind,) + record.key])

=== modified file 'bzrlib/tests/per_repository/test_check.py'
--- a/bzrlib/tests/per_repository/test_check.py	2009-05-12 05:34:15 +0000
+++ b/bzrlib/tests/per_repository/test_check.py	2009-08-30 23:51:10 +0000
@@ -17,9 +17,13 @@
 
 """Test operations that check the repository for corruption"""
 
+import os
 
 from bzrlib import (
+    check,
+    config as _mod_config,
     errors,
+    inventory,
     revision as _mod_revision,
     )
 from bzrlib.tests import TestNotApplicable
@@ -125,3 +129,23 @@
     def branch_callback(self, refs):
         self.callbacks.append(('branch', refs))
         return self.branch_check(refs)
+
+
+class TestCleanRepository(TestCaseWithRepository):
+
+    def test_new_repo(self):
+        repo = self.make_repository('foo')
+        repo.lock_write()
+        self.addCleanup(repo.unlock)
+        config = _mod_config.Config()
+        os.environ['BZR_EMAIL'] = 'foo at sample.com'
+        builder = repo.get_commit_builder(None, [], config)
+        list(builder.record_iter_changes(None, _mod_revision.NULL_REVISION, [
+            ('TREE_ROOT', (None, ''), True, (False, True), (None, None),
+            (None, ''), (None, 'directory'), (None, False))]))
+        builder.finish_inventory()
+        rev_id = builder.commit('first post')
+        result = repo.check(None, check_repo=True)
+        result.report_results(True)
+        log = self._get_log(keep_log_file=True)
+        self.assertFalse('Missing' in log, "Something was missing in %r" % log)




More information about the bazaar-commits mailing list