1
# Copyright (C) 2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
"""Tests for InterBranch.fetch."""
19
from bzrlib.revision import NULL_REVISION
20
from bzrlib.tests.per_interbranch import (
21
TestCaseWithInterBranch,
25
class TestInterBranchFetch(TestCaseWithInterBranch):
27
def test_fetch_revisions(self):
28
"""Test fetch-revision operation."""
29
wt = self.make_from_branch_and_tree('b1')
31
self.build_tree_contents([('b1/foo', 'hello')])
32
wt.add(['foo'], ['foo-id'])
33
wt.commit('lala!', rev_id='revision-1', allow_pointless=False)
35
b2 = self.make_to_branch('b2')
38
# fetch does not update the last revision
39
self.assertEquals(NULL_REVISION, b2.last_revision())
41
rev = b2.repository.get_revision('revision-1')
42
tree = b2.repository.revision_tree('revision-1')
44
self.addCleanup(tree.unlock)
45
self.assertEqual(tree.get_file_text('foo-id'), 'hello')