~brz/brz/debian

« back to all changes in this revision

Viewing changes to breezy/tests/per_controldir/test_push.py

  • Committer: Jelmer Vernooij
  • Date: 2019-02-15 19:36:37 UTC
  • mfrom: (3815.3903.56)
  • Revision ID: jelmer@jelmer.uk-20190215193637-ll3oo6zw519vlix2
* New upstream snapshot.
* Drop patch 22_git_push_branch_tags: applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for bzrdir implementations - push."""
18
18
 
19
 
from ...errors import LossyPushToSameVCS
 
19
from ...errors import (
 
20
    LossyPushToSameVCS,
 
21
    TagsNotSupported,
 
22
    )
 
23
from ...revision import NULL_REVISION
 
24
from .. import TestNotApplicable
20
25
 
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())
43
48
 
 
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()
 
61
        try:
 
62
            branch.tags.set_tag('atag', rev_2)
 
63
        except TagsNotSupported:
 
64
            raise TestNotApplicable('source format does not support tags')
 
65
 
 
66
        dir = self.make_repository('target').controldir
 
67
        branch.get_config().set_user_option('branch.fetch_tags', True)
 
68
        result = dir.push_branch(branch)
 
69
        self.assertEqual(
 
70
            set([rev_1, rev_2, rev_3]),
 
71
            set(result.source_branch.repository.all_revision_ids()))
 
72
        self.assertEqual(
 
73
            {'atag': rev_2}, result.source_branch.tags.get_tag_dict())
 
74
 
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