/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_push.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:
375
375
        self.overrideAttr(SmartServerRepositoryGetParentMap,
376
376
                          'no_extra_results', True)
377
377
 
 
378
    def test_push_tag_selector(self):
 
379
        if not self.branch_format_from.supports_tags():
 
380
            raise tests.TestNotApplicable('from format does not support tags')
 
381
        if not self.branch_format_to.supports_tags():
 
382
            raise tests.TestNotApplicable('to format does not support tags')
 
383
        tree_a = self.make_from_branch_and_tree('tree_a')
 
384
        revid1 = tree_a.commit('message 1')
 
385
        try:
 
386
            tree_b = self.sprout_to(
 
387
                tree_a.controldir, 'tree_b').open_workingtree()
 
388
        except errors.NoRoundtrippingSupport:
 
389
            raise tests.TestNotApplicable(
 
390
                'lossless push between %r and %r not supported' %
 
391
                (self.branch_format_from, self.branch_format_to))
 
392
        tree_b.branch.tags.set_tag('tag1', revid1)
 
393
        tree_b.branch.tags.set_tag('tag2', revid1)
 
394
        tree_b.branch.get_config_stack().set('branch.fetch_tags', True)
 
395
        tree_b.branch.push(tree_a.branch, tag_selector=lambda x: x == 'tag1')
 
396
        self.assertEqual({'tag1': revid1}, tree_a.branch.tags.get_tag_dict())
 
397
 
378
398
 
379
399
class TestPushHook(TestCaseWithInterBranch):
380
400