bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.436.19
by Jelmer Vernooij
- Add blackbox tests |
1 |
# Copyright (C) 2007 by Jelmer Vernooij
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
"""Couple of blackbox tests for the rebase plugin."""
|
|
17 |
||
18 |
from bzrlib.tests.blackbox import ExternalBase |
|
19 |
||
20 |
import os |
|
21 |
||
22 |
class TestRebaseSimple(ExternalBase): |
|
23 |
def make_file(self, name, contents): |
|
24 |
f = open(name, 'wb') |
|
25 |
try: |
|
26 |
f.write(contents) |
|
27 |
finally: |
|
28 |
f.close() |
|
29 |
||
30 |
def setUp(self): |
|
31 |
super(TestRebaseSimple, self).setUp() |
|
32 |
os.mkdir('main') |
|
33 |
os.chdir('main') |
|
34 |
self.run_bzr('init') |
|
35 |
self.make_file('hello', "hi world") |
|
36 |
self.run_bzr('add') |
|
37 |
self.run_bzr('commit -m bla') |
|
38 |
self.run_bzr('branch . ../feature') |
|
39 |
||
40 |
def test_notneeded(self): |
|
41 |
os.chdir('../feature') |
|
42 |
self.run_bzr_error(['bzr: ERROR: Already rebased on .*'], |
|
43 |
'rebase ../main') |
|
44 |
||
45 |
def test_simple_success(self): |
|
46 |
self.make_file('hello', '42') |
|
47 |
self.run_bzr('commit -m that') |
|
48 |
os.chdir('../feature') |
|
49 |
self.make_file('hoi', "my data") |
|
50 |
self.run_bzr('add') |
|
51 |
self.run_bzr('commit -m this') |
|
52 |
self.check_output('', 'rebase ../main') |
|
53 |
self.check_output('3\n', 'revno') |
|
|
0.436.20
by Jelmer Vernooij
Some more blackbox tests. |
54 |
|
55 |
def test_conflicting(self): |
|
56 |
self.make_file('hello', '42') |
|
57 |
self.run_bzr('commit -m that') |
|
58 |
os.chdir('../feature') |
|
59 |
self.make_file('hello', "other data") |
|
60 |
self.run_bzr('commit -m this') |
|
61 |
self.run_bzr_error('Text conflict in hello\nbzr: ERROR: A conflict occurred replaying a commit. Resolve the conflict and run \'bzr rebase-continue\' or run \'bzr rebase-abort\'.\n', 'rebase ../main') |
|
62 |
||
63 |
def test_conflicting_abort(self): |
|
64 |
self.make_file('hello', '42') |
|
65 |
self.run_bzr('commit -m that') |
|
66 |
os.chdir('../feature') |
|
67 |
self.make_file('hello', "other data") |
|
68 |
self.run_bzr('commit -m this') |
|
69 |
old_log = self.run_bzr('log')[0] |
|
70 |
self.run_bzr_error('Text conflict in hello\nbzr: ERROR: A conflict occurred replaying a commit. Resolve the conflict and run \'bzr rebase-continue\' or run \'bzr rebase-abort\'.\n', 'rebase ../main') |
|
71 |
self.check_output('', 'rebase-abort') |
|
72 |
self.check_output(old_log, 'log') |
|
73 |
||
74 |
def test_conflicting_continue(self): |
|
75 |
self.make_file('hello', '42') |
|
76 |
self.run_bzr('commit -m that') |
|
77 |
os.chdir('../feature') |
|
78 |
self.make_file('hello', "other data") |
|
79 |
self.run_bzr('commit -m this') |
|
80 |
self.run_bzr_error('Text conflict in hello\nbzr: ERROR: A conflict occurred replaying a commit. Resolve the conflict and run \'bzr rebase-continue\' or run \'bzr rebase-abort\'.\n', 'rebase ../main') |
|
81 |
self.run_bzr('resolved hello') |
|
82 |
self.check_output('', 'rebase-continue') |
|
83 |
self.check_output('3\n', 'revno') |
|
84 |
||
85 |
def test_continue_nothing(self): |
|
86 |
self.run_bzr_error('bzr: ERROR: No rebase to continue', |
|
87 |
'rebase-continue') |
|
88 |
||
89 |
def test_abort_nothing(self): |
|
90 |
self.run_bzr_error('bzr: ERROR: No rebase to abort', |
|
91 |
'rebase-abort') |
|
92 |
||
|
0.436.21
by Jelmer Vernooij
Tests. |
93 |
def test_todo_nothing(self): |
94 |
self.run_bzr_error('bzr: ERROR: No rebase in progress', |
|
95 |
'rebase-todo') |
|
|
0.437.2
by James Westby
Lookup the onto revision in the upstream branch. |
96 |
|
97 |
def test_onto(self): |
|
98 |
self.make_file('hello', '42') |
|
99 |
self.run_bzr('add') |
|
100 |
self.run_bzr('commit -m that') |
|
101 |
self.make_file('other', '43') |
|
102 |
self.run_bzr('add') |
|
103 |
self.run_bzr('commit -m that_other') |
|
104 |
os.chdir('../feature') |
|
105 |
self.make_file('hoi', "my data") |
|
106 |
self.run_bzr('add') |
|
107 |
self.run_bzr('commit -m this') |
|
108 |
self.check_output('', 'rebase --onto -2 ../main') |
|
109 |
self.check_output('3\n', 'revno') |
|
110 |
||
|
0.437.4
by James Westby
Import rebase_todo as it is needed for --verbose. |
111 |
def test_verbose(self): |
112 |
self.make_file('hello', '42') |
|
113 |
self.run_bzr('commit -m that') |
|
114 |
os.chdir('../feature') |
|
115 |
self.make_file('hoi', "my data") |
|
116 |
self.run_bzr('add') |
|
117 |
self.run_bzr('commit -m this') |
|
118 |
out, err = self.run_bzr('rebase -v ../main') |
|
119 |
self.assertContainsRe(err, ' -> ') |
|
120 |
self.assertEqual('', out) |
|
121 |
self.check_output('3\n', 'revno') |
|
122 |