Rev 4658: Do not add the root directory entry to the list of expected keys during check in non rich-root repositories. (#416732) in http://bazaar.launchpad.net/~lifeless/bzr/bug-416732
Robert Collins
robertc at robertcollins.net
Fri Aug 28 03:13:32 BST 2009
At http://bazaar.launchpad.net/~lifeless/bzr/bug-416732
------------------------------------------------------------
revno: 4658
revision-id: robertc at robertcollins.net-20090828021324-exm7iu79ja9kdmgh
parent: pqm at pqm.ubuntu.com-20090827022719-bl2yoqhpj3fcfczu
committer: Robert Collins <robertc at robertcollins.net>
branch nick: bug-416732
timestamp: Fri 2009-08-28 12:13:24 +1000
message:
Do not add the root directory entry to the list of expected keys during check in non rich-root repositories. (#416732)
=== modified file 'NEWS'
--- a/NEWS 2009-08-27 00:53:27 +0000
+++ b/NEWS 2009-08-28 02:13:24 +0000
@@ -32,6 +32,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)
+
* Fix a pycurl related test failure on karmic by recognizing an error
raised by newer versions of pycurl.
(Vincent Ladeuil, #306264)
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2009-08-25 19:29:41 +0000
+++ b/bzrlib/inventory.py 2009-08-28 02:13:24 +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 (sha1sum('')).
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-25 22:28:19 +0000
+++ b/bzrlib/repository.py 2009-08-28 02:13:24 +0000
@@ -1219,7 +1219,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-28 02:13:24 +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