/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/per_interbranch/test_pull.py

Add a tag_selector argument to push/pull/sprout functions.

Merged from https://code.launchpad.net/~jelmer/brz/tag-selector/+merge/379435

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
        self.assertEqual(p1, result.old_revid)
145
145
        self.assertEqual(2, result.new_revno)
146
146
        self.assertEqual(m1, result.new_revid)
147
 
        self.assertEqual([], result.tag_conflicts)
 
147
        self.assertEqual([], list(result.tag_conflicts))
148
148
 
149
149
    def test_pull_overwrite(self):
150
150
        tree_a = self.make_from_branch_and_tree('tree_a')
180
180
        self.assertEqual(tree_b.branch.last_revision(),
181
181
                         tree_a.branch.last_revision())
182
182
 
 
183
    def test_pull_tag_selector(self):
 
184
        if not self.branch_format_from.supports_tags():
 
185
            raise TestNotApplicable('from format does not support tags')
 
186
        if not self.branch_format_to.supports_tags():
 
187
            raise TestNotApplicable('to format does not support tags')
 
188
        tree_a = self.make_from_branch_and_tree('tree_a')
 
189
        revid1 = tree_a.commit('message 1')
 
190
        try:
 
191
            tree_b = self.sprout_to(
 
192
                tree_a.controldir, 'tree_b').open_workingtree()
 
193
        except errors.NoRoundtrippingSupport:
 
194
            raise TestNotApplicable(
 
195
                'lossless push between %r and %r not supported' %
 
196
                (self.branch_format_from, self.branch_format_to))
 
197
        tree_b.branch.tags.set_tag('tag1', revid1)
 
198
        tree_b.branch.tags.set_tag('tag2', revid1)
 
199
        tree_b.branch.get_config_stack().set('branch.fetch_tags', True)
 
200
        tree_a.pull(tree_b.branch, tag_selector=lambda x: x == 'tag1')
 
201
        self.assertEqual({'tag1': revid1}, tree_a.branch.tags.get_tag_dict())
 
202
 
183
203
 
184
204
class TestPullHook(TestCaseWithInterBranch):
185
205