179
177
self.log(tmp_output)
180
178
self.assertEquals(output, tmp_output)
180
def example_branch(test):
182
file('hello', 'wt').write('foo')
183
test.runbzr('add hello')
184
test.runbzr('commit -m setup hello')
185
file('goodbye', 'wt').write('baz')
186
test.runbzr('add goodbye')
187
test.runbzr('commit -m setup goodbye')
189
def test_revert(self):
190
self.example_branch()
191
file('hello', 'wt').write('bar')
192
file('goodbye', 'wt').write('qux')
193
self.runbzr('revert hello')
194
self.check_file_contents('hello', 'foo')
195
self.check_file_contents('goodbye', 'qux')
196
self.runbzr('revert')
197
self.check_file_contents('goodbye', 'baz')
199
def test_merge(self):
200
from bzrlib.branch import Branch
201
from bzrlib.commands import run_bzr
207
self.example_branch()
209
self.runbzr('branch a b')
211
file('goodbye', 'wt').write('quux')
212
self.runbzr(['commit', '-m', "more u's are always good"])
215
file('hello', 'wt').write('quuux')
216
# We can't merge when there are in-tree changes
217
self.runbzr('merge ../b', retcode=1)
218
self.runbzr(['commit', '-m', "Like an epidemic of u's"])
219
self.runbzr('merge ../b')
220
self.check_file_contents('goodbye', 'quux')
221
# Merging a branch pulls its revision into the tree
224
a.get_revision_xml(b.last_patch())
226
self.log('pending merges: %s', a.pending_merges())
227
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
228
# % (a.pending_merges(), b.last_patch())
182
230
class OldTests(ExternalBase):
183
# old tests moved from ./testbzr
231
"""old tests moved from ./testbzr."""
184
233
def test_bzr(self):
185
234
from os import chdir, mkdir
186
235
from os.path import exists
354
def example_branch(test):
357
file('hello', 'wt').write('foo')
358
test.runbzr('add hello')
359
test.runbzr('commit -m setup hello')
361
file('goodbye', 'wt').write('baz')
362
test.runbzr('add goodbye')
363
test.runbzr('commit -m setup goodbye')
366
class RevertCommand(ExternalBase):
369
file('hello', 'wt').write('bar')
370
file('goodbye', 'wt').write('qux')
371
self.runbzr('revert hello')
372
self.check_file_contents('hello', 'foo')
373
self.check_file_contents('goodbye', 'qux')
374
self.runbzr('revert')
375
self.check_file_contents('goodbye', 'baz')
378
class MergeCommand(ExternalBase):
380
from bzrlib.branch import Branch
381
from bzrlib.commands import run_bzr
389
self.runbzr('branch a b')
391
file('goodbye', 'wt').write('quux')
392
self.runbzr(['commit', '-m', "more u's are always good"])
395
file('hello', 'wt').write('quuux')
396
# We can't merge when there are in-tree changes
397
self.runbzr('merge ../b', retcode=1)
398
self.runbzr(['commit', '-m', "Like an epidemic of u's"])
399
self.runbzr('merge ../b')
400
self.check_file_contents('goodbye', 'quux')
401
# Merging a branch pulls its revision into the tree
404
a.get_revision_xml(b.last_patch())
406
self.log('pending merges: %s', a.pending_merges())
407
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
408
# % (a.pending_merges(), b.last_patch())