~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-06-26 20:32:49 UTC
  • mto: (2581.1.1 cleanup-runbzr)
  • mto: This revision was merged to the branch mainline in revision 2588.
  • Revision ID: v.ladeuil+lp@free.fr-20070626203249-sqm4afiai5dxofum
Deprecate the varargs syntax and fix the tests.

* bzrlib/tests/__init__.py:
(TestCase.run_bzr): Activate the deprecation warning.
(TestCase.run_bzr_error): Add error_regexes to kwargs or run_bzr
get confused.

* bzrlib/tests/blackbox/test_selftest.py:
(TestRunBzr.test_args): Activate.

* bzrlib/tests/blackbox/test_inventory.py:
(TestInventory.assertInventoryEqual): Build the command from args
if not None.

* bzrlib/tests/blackbox/test_ls.py:
(TestLS.ls_equals): Build the command from args if not None.

* bzrlib/tests/blackbox/test_remove_tree.py:
(TestRemoveTree.test_remove_tree_lightweight_checkout_explicit):
Nice catch, we were calling run_bzr instead of run_bzr_error. This
went unnoticed for some time...

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        wt = self.create_simple_tree()
43
43
 
44
44
        os.chdir('tree')
45
 
        out, err = self.run_bzr('uncommit', '--dry-run', '--force')
 
45
        out, err = self.run_bzr('uncommit --dry-run --force')
46
46
        self.assertContainsRe(out, 'Dry-run')
47
47
        self.assertNotContainsRe(out, 'initial commit')
48
48
        self.assertContainsRe(out, 'second commit')
51
51
        self.assertEqual(['a2'], wt.get_parent_ids())
52
52
 
53
53
        # Uncommit, don't prompt
54
 
        out, err = self.run_bzr('uncommit', '--force')
 
54
        out, err = self.run_bzr('uncommit --force')
55
55
        self.assertNotContainsRe(out, 'initial commit')
56
56
        self.assertContainsRe(out, 'second commit')
57
57
 
67
67
        self.assertEqual(['a2'], checkout_tree.get_parent_ids())
68
68
 
69
69
        os.chdir('checkout')
70
 
        out, err = self.run_bzr('uncommit', '--dry-run', '--force')
 
70
        out, err = self.run_bzr('uncommit --dry-run --force')
71
71
        self.assertContainsRe(out, 'Dry-run')
72
72
        self.assertNotContainsRe(out, 'initial commit')
73
73
        self.assertContainsRe(out, 'second commit')
74
74
 
75
75
        self.assertEqual(['a2'], checkout_tree.get_parent_ids())
76
76
 
77
 
        out, err = self.run_bzr('uncommit', '--force')
 
77
        out, err = self.run_bzr('uncommit --force')
78
78
        self.assertNotContainsRe(out, 'initial commit')
79
79
        self.assertContainsRe(out, 'second commit')
80
80
 
108
108
        wt = self.create_simple_tree()
109
109
 
110
110
        os.chdir('tree')
111
 
        out, err = self.run_bzr('uncommit', '-r1', '--force')
 
111
        out, err = self.run_bzr('uncommit -r1 --force')
112
112
 
113
113
        self.assertNotContainsRe(out, 'initial commit')
114
114
        self.assertContainsRe(out, 'second commit')
118
118
    def test_uncommit_neg_1(self):
119
119
        wt = self.create_simple_tree()
120
120
        os.chdir('tree')
121
 
        out, err = self.run_bzr('uncommit', '-r', '-1', retcode=1)
 
121
        out, err = self.run_bzr('uncommit -r -1', retcode=1)
122
122
        self.assertEqual('No revisions to uncommit.\n', out)
123
123
 
124
124
    def test_uncommit_merges(self):
135
135
        self.assertEqual(['a3'], wt.get_parent_ids())
136
136
 
137
137
        os.chdir('tree')
138
 
        out, err = self.run_bzr('uncommit', '--force')
 
138
        out, err = self.run_bzr('uncommit --force')
139
139
 
140
140
        self.assertEqual(['a2', 'b4'], wt.get_parent_ids())
141
141
 
148
148
        wt.set_pending_merges(['b3'])
149
149
 
150
150
        os.chdir('tree')
151
 
        out, err = self.run_bzr('uncommit', '--force')
 
151
        out, err = self.run_bzr('uncommit --force')
152
152
        self.assertEqual(['a1', 'b3'], wt.get_parent_ids())
153
153
 
154
154
    def test_uncommit_multiple_merge(self):
169
169
        self.assertEqual(['a4'], wt.get_parent_ids())
170
170
 
171
171
        os.chdir('tree')
172
 
        out, err = self.run_bzr('uncommit', '--force', '-r', '2')
 
172
        out, err = self.run_bzr('uncommit --force -r 2')
173
173
 
174
174
        self.assertEqual(['a2', 'b3', 'b4'], wt.get_parent_ids())
175
175
 
190
190
        self.assertEqual(['a3', 'b4'], wt.get_parent_ids())
191
191
 
192
192
        os.chdir('tree')
193
 
        out, err = self.run_bzr('uncommit', '--force', '-r', '2')
 
193
        out, err = self.run_bzr('uncommit --force -r 2')
194
194
 
195
195
        self.assertEqual(['a2', 'b3', 'b4'], wt.get_parent_ids())
196
196
 
218
218
        self.assertEqual(['a4'], wt.get_parent_ids())
219
219
 
220
220
        os.chdir('tree')
221
 
        out, err = self.run_bzr('uncommit', '--force', '-r', '2')
 
221
        out, err = self.run_bzr('uncommit --force -r 2')
222
222
 
223
223
        self.assertEqual(['a2', 'b3', 'c3', 'c4', 'b4'], wt.get_parent_ids())