Merge lp:~lifeless/bzr/bug-416732 into lp:~bzr/bzr/trunk-old

Proposed by Robert Collins
Status: Merged
Approved by: Andrew Bennetts
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~lifeless/bzr/bug-416732
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 98 lines (has conflicts)
Text conflict in NEWS
To merge this branch: bzr merge lp:~lifeless/bzr/bug-416732
Reviewer Review Type Date Requested Status
Martin Pool Approve
Vincent Ladeuil Approve
Andrew Bennetts Approve
Review via email: mp+10828@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Do not add the root directory entry to the list of expected keys during
check in non rich-root repositories. (#416732)

Basically a very shallow bug - read inventory.py in the diff :)

-Rob

Revision history for this message
Andrew Bennetts (spiv) wrote :

Makes sense to me.

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

One-liner indeed, but the comment says: 'is da... below' if that's not a typo for 'is as... below',
I fail to understand it.

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

This should actually be merged into 2.0.

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

I'll send this to pqm for 2.0.

vila, the 'da...' means the hex number starting with da.

Revision history for this message
Martin Pool (mbp) wrote :

2009/8/28 Martin Pool <email address hidden>:
> I'll send this to pqm for 2.0.

OK, this can't actually be directly merged because it's based off
trunk not 2.0. I'll leave it for Robert to cherrypick it out, to
avoid errors.

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
Robert Collins (lifeless) wrote :

On Fri, 2009-08-28 at 07:18 +0000, Martin Pool wrote:
> 2009/8/28 Martin Pool <email address hidden>:
> > I'll send this to pqm for 2.0.
>
> OK, this can't actually be directly merged because it's based off
> trunk not 2.0. I'll leave it for Robert to cherrypick it out, to
> avoid errors.

Just merge -c should work fine; the 'da' typo should indeed be 'is as',
and the start_series typo will need to be start_server.

I'll correct and land first thing Monday if noone beats me to it.

-Rob

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-08-28 22:24:40 +0000
3+++ NEWS 2009-08-29 03:35:20 +0000
4@@ -101,6 +101,7 @@
5 Bug Fixes
6 *********
7
8+<<<<<<< TREE
9 * Further tweaks to handling of ``bzr add`` messages about ignored files.
10 (Jason Spashett, #76616)
11
12@@ -110,6 +111,12 @@
13 recombining to work, switching to 'unordered' fetches avoids the
14 fragmentation. (John Arbash Meinel, #402645)
15
16+=======
17+* ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no
18+ longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
19+ (Robert Collins, #416732)
20+
21+>>>>>>> MERGE-SOURCE
22 * Fix a pycurl related test failure on karmic by recognizing an error
23 raised by newer versions of pycurl.
24 (Vincent Ladeuil, #306264)
25
26=== modified file 'bzrlib/inventory.py'
27--- bzrlib/inventory.py 2009-08-28 05:00:33 +0000
28+++ bzrlib/inventory.py 2009-08-29 03:35:20 +0000
29@@ -437,7 +437,13 @@
30 self.text_id is not None):
31 checker._report_items.append('directory {%s} has text in revision {%s}'
32 % (self.file_id, rev_id))
33- # Directories are stored as ''.
34+ # In non rich root repositories we do not expect a file graph for the
35+ # root.
36+ if self.name == '' and not checker.rich_roots:
37+ return
38+ # Directories are stored as an empty file, but the file should exist
39+ # to provide a per-fileid log. The hash of every directory content is
40+ # da... below (sha1sum('')).
41 checker.add_pending_item(rev_id,
42 ('texts', self.file_id, self.revision), 'text',
43 'da39a3ee5e6b4b0d3255bfef95601890afd80709')
44
45=== modified file 'bzrlib/repository.py'
46--- bzrlib/repository.py 2009-08-28 05:00:33 +0000
47+++ bzrlib/repository.py 2009-08-29 03:35:20 +0000
48@@ -1222,7 +1222,7 @@
49 for record in getattr(self, kind).check(keys=keys[kind]):
50 if record.storage_kind == 'absent':
51 checker._report_items.append(
52- 'Missing inventory {%s}' % (record.key,))
53+ 'Missing %s {%s}' % (kind, record.key,))
54 else:
55 last_object = self._check_record(kind, record,
56 checker, last_object, current_keys[(kind,) + record.key])
57
58=== modified file 'bzrlib/tests/per_repository/test_check.py'
59--- bzrlib/tests/per_repository/test_check.py 2009-05-12 05:34:15 +0000
60+++ bzrlib/tests/per_repository/test_check.py 2009-08-29 03:35:20 +0000
61@@ -17,9 +17,13 @@
62
63 """Test operations that check the repository for corruption"""
64
65+import os
66
67 from bzrlib import (
68+ check,
69+ config as _mod_config,
70 errors,
71+ inventory,
72 revision as _mod_revision,
73 )
74 from bzrlib.tests import TestNotApplicable
75@@ -125,3 +129,23 @@
76 def branch_callback(self, refs):
77 self.callbacks.append(('branch', refs))
78 return self.branch_check(refs)
79+
80+
81+class TestCleanRepository(TestCaseWithRepository):
82+
83+ def test_new_repo(self):
84+ repo = self.make_repository('foo')
85+ repo.lock_write()
86+ self.addCleanup(repo.unlock)
87+ config = _mod_config.Config()
88+ os.environ['BZR_EMAIL'] = 'foo@sample.com'
89+ builder = repo.get_commit_builder(None, [], config)
90+ list(builder.record_iter_changes(None, _mod_revision.NULL_REVISION, [
91+ ('TREE_ROOT', (None, ''), True, (False, True), (None, None),
92+ (None, ''), (None, 'directory'), (None, False))]))
93+ builder.finish_inventory()
94+ rev_id = builder.commit('first post')
95+ result = repo.check(None, check_repo=True)
96+ result.report_results(True)
97+ log = self._get_log(keep_log_file=True)
98+ self.assertFalse('Missing' in log, "Something was missing in %r" % log)