~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_identitymap.py

Fix #531967 by creating helpers for PathConflicts when a deletion
is involved.

* bzrlib/tests/test_conflicts.py:
(TestParametrizedResolveConflicts.mirror_scenarios): Renamed from
multiply_scenarios to make the intent clearer. Turned into a
classmethod too for the same reason.
(TestParametrizedResolveConflicts.scenarios): Now a classmethod.

* bzrlib/merge.py:
(Merge3Merger._merge_names): 'name conflict' and 'parent conflict'
can (and must) be handled in the same way. If a deletion is
involved we create an unversioned copy of the rejected item so the
user can restore that easily.
(Merge3Merger.cook_conflicts): Get rid of 'name conflict', 'parent
conflict' distinction and just create PathConflicts with a file_id
to address bug #531967.

* bzrlib/conflicts.py:
(PathConflict.associated_filenames): Helpers exist only when a
deletion is involved.
(PathConflict._resolve): We may have to version one path
again. This may happen when a deletion have occurred.
(PathConflict.action_take_this, PathConflict.action_take_other):
As a special case, we may have an helper to use when deletion was
involved.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
"""Tests for the IdentityMap class."""
19
19
 
45
45
        map.add_weave("id", weave)
46
46
        self.assertRaises(errors.BzrError, map.add_weave, "id", weave)
47
47
        self.assertEqual(weave, map.find_weave("id"))
48
 
 
 
48
 
49
49
    def test_remove_object(self):
50
50
        map = identitymap.IdentityMap()
51
51
        weave = "foo"
53
53
        map.remove_object(weave)
54
54
        map.add_weave("id", weave)
55
55
 
56
 
 
 
56
 
57
57
class TestNullIdentityMap(TestCase):
58
58
 
59
59
    def test_symbols(self):
74
74
        map.add_weave("id", weave)
75
75
        map.add_weave("id", weave)
76
76
        self.assertEqual(None, map.find_weave("id"))
77
 
        
 
77
 
78
78
    def test_null_identity_map_has_no_remove(self):
79
79
        map = identitymap.NullIdentityMap()
80
80
        self.assertEqual(None, getattr(map, 'remove_object', None))