Merge lp:~vila/bzr/533547-dsrt-kind into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~vila/bzr/533547-dsrt-kind
Merge into: lp:bzr
Diff against target: 148 lines (+73/-13)
4 files modified
NEWS (+4/-0)
bzrlib/tests/per_tree/test_revision_tree.py (+9/-6)
bzrlib/tests/per_workingtree/test_revision_tree.py (+57/-6)
bzrlib/workingtree_4.py (+3/-1)
To merge this branch: bzr merge lp:~vila/bzr/533547-dsrt-kind
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+21030@code.launchpad.net

Description of the change

Drive-by fix encountered while working on bug #531967.

That revealed a hole in our test coverage that I won't investigate further than the added test.

The consequences of this bug are unclear as we usually use only the basis tree
(which explain why the bug remained unnoticed).

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr/533547-dsrt-kind into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> #533547 OOPS-ID-1526appserver102557
> https://bugs.launchpad.net/bugs/533547
>
>
> Drive-by fix encountered while working on bug #531967.
>
> That revealed a hole in our test coverage that I won't investigate further than the added test.
>
> The consequences of this bug are unclear as we usually use only the basis tree
> (which explain why the bug remained unnoticed).
>

 merge: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuX4xsACgkQJdeBCYSNAANTmQCeIYKNANyufwbTBcE190hU29L0
DBUAoKrpMCxKCDMcuf6/cBlGnkMnwPif
=fj9/
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2010-03-10 06:38:27 +0000
+++ NEWS 2010-03-10 09:37:14 +0000
@@ -92,6 +92,10 @@
92 ftp servers while trying to take a lock.92 ftp servers while trying to take a lock.
93 (Martin Pool, #528722)93 (Martin Pool, #528722)
9494
95* DirStateRevisionTree.kind() was returning wrong result when 'kind'
96 changes occured between the workingtree and one of its parents.
97 (Vincent Ladeuil, #533437)
98
95* Network transfer amounts and rates are now displayed in SI units according99* Network transfer amounts and rates are now displayed in SI units according
96 to the Ubuntu Units Policy <https://wiki.ubuntu.com/UnitsPolicy>.100 to the Ubuntu Units Policy <https://wiki.ubuntu.com/UnitsPolicy>.
97 (Gordon Tyler, #514399)101 (Gordon Tyler, #514399)
98102
=== modified file 'bzrlib/tests/per_tree/test_revision_tree.py'
--- bzrlib/tests/per_tree/test_revision_tree.py 2009-07-10 07:14:02 +0000
+++ bzrlib/tests/per_tree/test_revision_tree.py 2010-03-10 09:37:14 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2006 Canonical Ltd1# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -16,11 +16,14 @@
1616
17"""Tests for Tree.revision_tree."""17"""Tests for Tree.revision_tree."""
1818
19from bzrlib import errors19from bzrlib import (
20from bzrlib.tests.per_tree import TestCaseWithTree20 errors,
2121 tests,
2222 )
23class TestRevisionTree(TestCaseWithTree):23from bzrlib.tests import per_tree
24
25
26class TestRevisionTree(per_tree.TestCaseWithTree):
2427
25 def create_tree_no_parents_no_content(self):28 def create_tree_no_parents_no_content(self):
26 tree = self.make_branch_and_tree('.')29 tree = self.make_branch_and_tree('.')
2730
=== modified file 'bzrlib/tests/per_workingtree/test_revision_tree.py'
--- bzrlib/tests/per_workingtree/test_revision_tree.py 2009-07-10 07:14:02 +0000
+++ bzrlib/tests/per_workingtree/test_revision_tree.py 2010-03-10 09:37:14 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2006 Canonical Ltd1# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -23,11 +23,15 @@
23so these tests are testing that when there is a cache, it performs correctly.23so these tests are testing that when there is a cache, it performs correctly.
24"""24"""
2525
26from bzrlib import errors26from bzrlib import (
27from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree27 branchbuilder,
2828 errors,
2929 tests,
30class TestRevisionTree(TestCaseWithWorkingTree):30 )
31from bzrlib.tests import per_workingtree
32
33
34class TestRevisionTree(per_workingtree.TestCaseWithWorkingTree):
3135
32 def test_get_zeroth_basis_tree_via_revision_tree(self):36 def test_get_zeroth_basis_tree_via_revision_tree(self):
33 tree = self.make_branch_and_tree('.')37 tree = self.make_branch_and_tree('.')
@@ -83,3 +87,50 @@
83 return87 return
84 repository_revision_tree = tree.branch.repository.revision_tree(rev1)88 repository_revision_tree = tree.branch.repository.revision_tree(rev1)
85 self.assertTreesEqual(repository_revision_tree, cached_revision_tree)89 self.assertTreesEqual(repository_revision_tree, cached_revision_tree)
90
91
92class TestRevisionTreeKind(per_workingtree.TestCaseWithWorkingTree):
93
94 def make_branch_with_merged_deletions(self, relpath='tree'):
95 tree = self.make_branch_and_tree(relpath)
96 files = ['a', 'b/', 'b/c']
97 self.build_tree(files, line_endings='binary',
98 transport=tree.bzrdir.root_transport)
99 tree.set_root_id('root-id')
100 tree.add(files, ['a-id', 'b-id', 'c-id'])
101 tree.commit('a, b and b/c', rev_id='base')
102 tree2 = tree.bzrdir.sprout(relpath + '2').open_workingtree()
103 # Delete 'a' in tree
104 tree.remove('a', keep_files=False)
105 tree.commit('remove a', rev_id='this')
106 # Delete 'c' in tree2
107 tree2.remove('b/c', keep_files=False)
108 tree2.remove('b', keep_files=False)
109 tree2.commit('remove b/c', rev_id='other')
110 # Merge tree2 into tree
111 tree.merge_from_branch(tree2.branch)
112 return tree
113
114 def test_kind_parent_tree(self):
115 tree = self.make_branch_with_merged_deletions()
116 tree.lock_read()
117 self.addCleanup(tree.unlock)
118 parents = tree.get_parent_ids()
119 self.assertEqual(['this', 'other'], parents)
120 basis = tree.revision_tree(parents[0])
121 basis.lock_read()
122 self.addCleanup(basis.unlock)
123 self.assertRaises(errors.NoSuchId, basis.kind, 'a-id')
124 self.assertEqual(['directory', 'file'],
125 [basis.kind('b-id'), basis.kind('c-id')])
126 try:
127 other = tree.revision_tree(parents[1])
128 except errors.NoSuchRevisionInTree:
129 raise tests.TestNotApplicable(
130 'Tree type %s caches only the basis revision tree.'
131 % type(tree))
132 other.lock_read()
133 self.addCleanup(other.unlock)
134 self.assertRaises(errors.NoSuchId, other.kind, 'b-id')
135 self.assertRaises(errors.NoSuchId, other.kind, 'c-id')
136 self.assertEqual('file', other.kind('a-id'))
86137
=== modified file 'bzrlib/workingtree_4.py'
--- bzrlib/workingtree_4.py 2010-02-17 17:11:16 +0000
+++ bzrlib/workingtree_4.py 2010-03-10 09:37:14 +0000
@@ -1372,6 +1372,7 @@
13721372
13731373
1374class DirStateWorkingTreeFormat(WorkingTreeFormat3):1374class DirStateWorkingTreeFormat(WorkingTreeFormat3):
1375
1375 def initialize(self, a_bzrdir, revision_id=None, from_branch=None,1376 def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
1376 accelerator_tree=None, hardlink=False):1377 accelerator_tree=None, hardlink=False):
1377 """See WorkingTreeFormat.initialize().1378 """See WorkingTreeFormat.initialize().
@@ -1832,7 +1833,8 @@
1832 entry = self._get_entry(file_id=file_id)[1]1833 entry = self._get_entry(file_id=file_id)[1]
1833 if entry is None:1834 if entry is None:
1834 raise errors.NoSuchId(tree=self, file_id=file_id)1835 raise errors.NoSuchId(tree=self, file_id=file_id)
1835 return dirstate.DirState._minikind_to_kind[entry[1][0]]1836 parent_index = self._get_parent_index()
1837 return dirstate.DirState._minikind_to_kind[entry[parent_index][0]]
18361838
1837 def stored_kind(self, file_id):1839 def stored_kind(self, file_id):
1838 """See Tree.stored_kind"""1840 """See Tree.stored_kind"""