1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# Copyright (C) 2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Tests for all_revision_ids on a repository with external references."""
from bzrlib import errors
from bzrlib.tests.per_repository_reference import (
TestCaseWithExternalReferenceRepository,
)
class TestAllRevisionIds(TestCaseWithExternalReferenceRepository):
def test_all_revision_ids_empty(self):
base = self.make_repository('base')
repo = self.make_referring('referring', 'base')
self.assertEqual(set([]), set(repo.all_revision_ids()))
def test_all_revision_ids_from_base(self):
tree = self.make_branch_and_tree('base')
revid = tree.commit('one')
repo = self.make_referring('referring', 'base')
self.assertEqual(set([revid]), set(repo.all_revision_ids()))
def test_all_revision_ids_from_repo(self):
tree = self.make_branch_and_tree('spare')
revid = tree.commit('one')
base = self.make_repository('base')
repo = self.make_referring('referring', 'base')
repo.fetch(tree.branch.repository, revid)
self.assertEqual(set([revid]), set(repo.all_revision_ids()))
def test_all_revision_ids_from_both(self):
tree = self.make_branch_and_tree('spare')
revid = tree.commit('one')
base_tree = self.make_branch_and_tree('base')
revid2 = base_tree.commit('two')
repo = self.make_referring('referring', 'base')
repo.fetch(tree.branch.repository, revid)
self.assertEqual(set([revid, revid2]), set(repo.all_revision_ids()))
def test_duplicate_ids_do_not_affect_length(self):
tree = self.make_branch_and_tree('spare')
revid = tree.commit('one')
base = self.make_repository('base')
repo = self.make_referring('referring', 'base')
repo.fetch(tree.branch.repository, revid)
base.fetch(tree.branch.repository, revid)
self.assertEqual(set([revid]), set(repo.all_revision_ids()))
self.assertEqual(1, len(repo.all_revision_ids()))
|