/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 brzlib/tests/test_upgrade_stacked.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 12:41:27 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521124127-iv8etg0vwymyai6y
s/bzr/brz/ in apport config.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for upgrades of various stacking situations."""
19
19
 
20
 
from .. import (
 
20
from brzlib import (
21
21
    controldir,
22
22
    check,
23
23
    errors,
24
24
    tests,
25
25
    )
26
 
from ..upgrade import upgrade
27
 
from .scenarios import load_tests_apply_scenarios
 
26
from brzlib.upgrade import upgrade
 
27
from brzlib.tests.scenarios import load_tests_apply_scenarios
28
28
 
29
29
 
30
30
def upgrade_scenarios():
31
 
    scenario_pairs = [  # old format, new format, model_change
32
 
        #        ('knit', 'rich-root', True),
 
31
    scenario_pairs = [ # old format, new format, model_change
 
32
#        ('knit', 'rich-root', True),
33
33
        ('knit', '1.6', False),
34
 
        #        ('pack-0.92', '1.6', False),
 
34
#        ('pack-0.92', '1.6', False),
35
35
        ('1.6', '1.6.1-rich-root', True),
36
36
        ]
37
37
    scenarios = []
38
38
    for (old_name, new_name, model_change) in scenario_pairs:
39
39
        name = old_name + ', ' + new_name
40
40
        scenarios.append((name,
41
 
                          dict(scenario_old_format=old_name,
42
 
                               scenario_new_format=new_name,
43
 
                               scenario_model_change=model_change)))
 
41
            dict(scenario_old_format=old_name,
 
42
                scenario_new_format=new_name,
 
43
                scenario_model_change=model_change)))
44
44
    return scenarios
45
45
 
46
46
 
51
51
    # TODO: This should possibly be repeated for all stacking repositories,
52
52
    # pairwise by rich/non-rich format; should possibly also try other kinds
53
53
    # of upgrades like knit->pack. -- mbp 20080804
54
 
 
 
54
    
55
55
    scenarios = upgrade_scenarios()
56
56
 
57
57
    def test_stack_upgrade(self):
62
62
        repository.
63
63
        """
64
64
        base = self.make_branch_and_tree('base',
65
 
                                         format=self.scenario_old_format)
 
65
            format=self.scenario_old_format)
66
66
        self.build_tree(['base/foo'])
67
67
        base.commit('base commit')
68
68
        # make another one stacked
69
 
        stacked = base.controldir.sprout('stacked', stacked=True)
 
69
        stacked = base.bzrdir.sprout('stacked', stacked=True)
70
70
        # this must really be stacked (or get_stacked_on_url raises an error)
71
71
        self.assertTrue(stacked.open_branch().get_stacked_on_url())
72
72
        # now we'll upgrade the underlying branch, then upgrade the stacked
73
73
        # branch, and this should still work.
74
 
        new_format = controldir.format_registry.make_controldir(
 
74
        new_format = controldir.format_registry.make_bzrdir(
75
75
            self.scenario_new_format)
76
76
        upgrade('base', new_format)
77
77
        # in some cases you'll get an error if the underlying model has
78
78
        # changed; if just the data format has changed this should still work
79
79
        if self.scenario_model_change:
80
80
            self.assertRaises(errors.IncompatibleRepositories,
81
 
                              stacked.open_branch)
 
81
                stacked.open_branch)
82
82
        else:
83
83
            check.check_dwim('stacked', False, True, True)
84
84
        stacked = controldir.ControlDir.open('stacked')