178
178
self.log(tmp_output)
179
179
self.assertEquals(output, tmp_output)
181
def example_branch(test):
183
file('hello', 'wt').write('foo')
184
test.runbzr('add hello')
185
test.runbzr('commit -m setup hello')
186
file('goodbye', 'wt').write('baz')
187
test.runbzr('add goodbye')
188
test.runbzr('commit -m setup goodbye')
190
def test_revert(self):
191
self.example_branch()
192
file('hello', 'wt').write('bar')
193
file('goodbye', 'wt').write('qux')
194
self.runbzr('revert hello')
195
self.check_file_contents('hello', 'foo')
196
self.check_file_contents('goodbye', 'qux')
197
self.runbzr('revert')
198
self.check_file_contents('goodbye', 'baz')
200
def test_merge(self):
201
from bzrlib.branch import Branch
205
self.example_branch()
207
self.runbzr('branch a b')
209
file('goodbye', 'wt').write('quux')
210
self.runbzr(['commit', '-m', "more u's are always good"])
213
file('hello', 'wt').write('quuux')
214
# We can't merge when there are in-tree changes
215
self.runbzr('merge ../b', retcode=1)
216
self.runbzr(['commit', '-m', "Like an epidemic of u's"])
217
self.runbzr('merge ../b')
218
self.check_file_contents('goodbye', 'quux')
219
# Merging a branch pulls its revision into the tree
222
a.get_revision_xml(b.last_patch())
223
print "Pending: %s" % a.pending_merges()
224
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
225
# % (a.pending_merges(), b.last_patch())
181
227
class OldTests(ExternalBase):
182
# old tests moved from ./testbzr
228
"""old tests moved from ./testbzr."""
183
230
def test_bzr(self):
184
231
from os import chdir, mkdir
185
232
from os.path import exists
353
def example_branch(test):
356
file('hello', 'wt').write('foo')
357
test.runbzr('add hello')
358
test.runbzr('commit -m setup hello')
360
file('goodbye', 'wt').write('baz')
361
test.runbzr('add goodbye')
362
test.runbzr('commit -m setup goodbye')
365
class RevertCommand(ExternalBase):
368
file('hello', 'wt').write('bar')
369
file('goodbye', 'wt').write('qux')
370
self.runbzr('revert hello')
371
self.check_file_contents('hello', 'foo')
372
self.check_file_contents('goodbye', 'qux')
373
self.runbzr('revert')
374
self.check_file_contents('goodbye', 'baz')
377
class MergeCommand(ExternalBase):
379
from bzrlib.branch import Branch
385
self.runbzr('branch a b')
387
file('goodbye', 'wt').write('quux')
388
self.runbzr(['commit', '-m', "more u's are always good"])
391
file('hello', 'wt').write('quuux')
392
# We can't merge when there are in-tree changes
393
self.runbzr('merge ../b', retcode=1)
394
self.runbzr(['commit', '-m', "Like an epidemic of u's"])
395
self.runbzr('merge ../b')
396
self.check_file_contents('goodbye', 'quux')
397
# Merging a branch pulls its revision into the tree
400
a.get_revision_xml(b.last_patch())
401
print "Pending: %s" % a.pending_merges()
402
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
403
# % (a.pending_merges(), b.last_patch())