~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_dpush.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 04:25:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5472.
  • Revision ID: andrew.bennetts@canonical.com-20101008042510-sg9vdhmnggilzxsk
Fix stray TAB in source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
"""Black-box tests for bzr dpush."""
19
19
 
20
20
 
 
21
import os
 
22
 
21
23
from bzrlib import (
 
24
    branch,
 
25
    bzrdir,
 
26
    foreign,
22
27
    tests,
 
28
    workingtree,
23
29
    )
24
30
from bzrlib.tests import (
 
31
    blackbox,
25
32
    script,
26
33
    test_foreign,
27
34
    )
28
35
from bzrlib.tests.blackbox import test_push
29
 
from bzrlib.tests.scenarios import (
30
 
    load_tests_apply_scenarios,
31
 
    )
32
 
 
33
 
 
34
 
load_tests = load_tests_apply_scenarios
 
36
 
 
37
 
 
38
def load_tests(standard_tests, module, loader):
 
39
    """Multiply tests for the dpush command."""
 
40
    result = loader.suiteClass()
 
41
 
 
42
    # one for each king of change
 
43
    changes_tests, remaining_tests = tests.split_suite_by_condition(
 
44
        standard_tests, tests.condition_isinstance((
 
45
                TestDpushStrictWithChanges,
 
46
                )))
 
47
    changes_scenarios = [
 
48
        ('uncommitted',
 
49
         dict(_changes_type= '_uncommitted_changes')),
 
50
        ('pending-merges',
 
51
         dict(_changes_type= '_pending_merges')),
 
52
        ('out-of-sync-trees',
 
53
         dict(_changes_type= '_out_of_sync_trees')),
 
54
        ]
 
55
    tests.multiply_tests(changes_tests, changes_scenarios, result)
 
56
    # No parametrization for the remaining tests
 
57
    result.addTests(remaining_tests)
 
58
 
 
59
    return result
35
60
 
36
61
 
37
62
class TestDpush(tests.TestCaseWithTransport):
53
78
        source_tree = self.make_branch_and_tree("dc")
54
79
        output, error = self.run_bzr("dpush -d dc dp", retcode=3)
55
80
        self.assertEquals("", output)
56
 
        self.assertContainsRe(error,
57
 
            'in the same VCS, lossy push not necessary. Please use regular '
58
 
            'push.')
 
81
        self.assertContainsRe(error, 'in the same VCS, lossy push not necessary. Please use regular push.')
59
82
 
60
83
    def test_dpush(self):
61
84
        branch = self.make_dummy_builder('d').get_branch()
66
89
 
67
90
        script.run_script(self, """
68
91
            $ bzr dpush -d dc d
69
 
            2>Doing on-the-fly conversion from DummyForeignVcsRepositoryFormat() to RepositoryFormat2a().
70
 
            2>This may take some time. Upgrade the repositories to the same format for better performance.
71
92
            2>Pushed up to revision 2.
72
93
            $ bzr status dc
73
94
            """)
83
104
 
84
105
        script.run_script(self, '''
85
106
            $ bzr dpush -d dc d
86
 
            2>Doing on-the-fly conversion from DummyForeignVcsRepositoryFormat() to RepositoryFormat2a().
87
 
            2>This may take some time. Upgrade the repositories to the same format for better performance.
88
 
            2>Pushed up to revision 2.
89
107
            $ bzr revno dc
90
108
            2
91
109
            $ bzr status dc
103
121
        self.build_tree_contents([("dc/foofile", "blaaaal")])
104
122
        script.run_script(self, '''
105
123
            $ bzr dpush -d dc d --no-strict
106
 
            2>Doing on-the-fly conversion from DummyForeignVcsRepositoryFormat() to RepositoryFormat2a().
107
 
            2>This may take some time. Upgrade the repositories to the same format for better performance.
108
 
            2>Pushed up to revision 2.
109
124
            ''')
110
125
        self.assertFileEqual("blaaaal", "dc/foofile")
111
126
        # if the dummy vcs wasn't that dummy we could uncomment the line below
163
178
class TestDpushStrictWithChanges(TestDpushStrictMixin,
164
179
                                 test_push.TestPushStrictWithChanges):
165
180
 
166
 
    scenarios = test_push.strict_push_change_scenarios
167
 
 
168
181
    _changes_type = None # Set by load_tests
169
182
 
170
183
    def setUp(self):
173
186
 
174
187
    def test_push_with_revision(self):
175
188
        raise tests.TestNotApplicable('dpush does not handle --revision')
 
189