17
17
"""Tests for bzrdir implementations - push."""
19
from ...errors import LossyPushToSameVCS
19
from ...errors import (
23
from ...revision import NULL_REVISION
24
from .. import TestNotApplicable
21
26
from breezy.tests.per_controldir import (
22
27
TestCaseWithControlDir,
41
46
self.assertEqual(dir.open_branch().base,
42
47
tree.branch.get_push_location())
49
def test_push_new_branch_fetch_tags(self):
50
builder = self.make_branch_builder('from')
51
builder.start_series()
52
rev_1 = builder.build_snapshot(None, [
53
('add', ('', None, 'directory', '')),
54
('add', ('filename', None, 'file', b'content'))])
55
rev_2 = builder.build_snapshot(
56
[rev_1], [('modify', ('filename', b'new-content\n'))])
57
rev_3 = builder.build_snapshot(
58
[rev_1], [('modify', ('filename', b'new-new-content\n'))])
59
builder.finish_series()
60
branch = builder.get_branch()
62
branch.tags.set_tag('atag', rev_2)
63
except TagsNotSupported:
64
raise TestNotApplicable('source format does not support tags')
66
dir = self.make_repository('target').controldir
67
branch.get_config().set_user_option('branch.fetch_tags', True)
68
result = dir.push_branch(branch)
70
set([rev_1, rev_2, rev_3]),
71
set(result.source_branch.repository.all_revision_ids()))
73
{'atag': rev_2}, result.source_branch.tags.get_tag_dict())
44
75
def test_push_new_branch_lossy(self):
45
76
tree, rev_1 = self.create_simple_tree()
46
77
dir = self.make_repository('dir').controldir