1
# Copyright (C) 2006 by Canonical Ltd
3
# 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 by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
"""Tests for join between versioned files."""
20
from bzrlib.tests import TestCaseWithTransport
21
from bzrlib.transport import get_transport
24
class TestJoin(TestCaseWithTransport):
25
#Tests have self.versionedfile_factory and self.versionedfile_factory_to
26
#available to create source and target versioned files respectively.
28
def get_source(self, name='source'):
29
"""Get a versioned file we will be joining from."""
30
return self.versionedfile_factory(name,
31
get_transport(self.get_url()))
33
def get_target(self, name='source'):
34
""""Get an empty versioned file to join into."""
35
return self.versionedfile_factory_to(name,
36
get_transport(self.get_url()))
39
f1 = self.get_source()
40
f1.add_lines('r0', [], ['a\n', 'b\n'])
41
f1.add_lines('r1', ['r0'], ['c\n', 'b\n'])
42
f2 = self.get_target()
45
self.assertTrue(f.has_version('r0'))
46
self.assertTrue(f.has_version('r1'))
48
verify_file(self.get_target())
50
self.assertRaises(RevisionNotPresent,
51
f2.join, f1, version_ids=['r3'])
53
#f3 = self.get_file('1')
54
#f3.add_lines('r0', ['a\n', 'b\n'], [])
55
#f3.add_lines('r1', ['c\n', 'b\n'], ['r0'])
56
#f4 = self.get_file('2')
58
#self.assertTrue(f4.has_version('r0'))
59
#self.assertFalse(f4.has_version('r1'))