30
32
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
33
from bzrlib.branch import Branch
34
from bzrlib.commands import run_bzr
32
37
class ExternalBase(TestCaseInTempDir):
33
38
def runbzr(self, args, retcode=0,backtick=False):
214
216
b = Branch('../b')
215
217
a.get_revision_xml(b.last_patch())
217
218
self.log('pending merges: %s', a.pending_merges())
218
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
219
# % (a.pending_merges(), b.last_patch())
219
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
220
# % (a.pending_merges(), b.last_patch())
223
"""Pull changes from one branch to another."""
227
self.example_branch()
229
self.runbzr('branch a b')
231
self.runbzr('commit -m blah --unchanged')
235
assert a.revision_history() == b.revision_history()[:-1]
236
self.runbzr('pull ../b')
237
assert a.revision_history() == b.revision_history()
238
self.runbzr('commit -m blah2 --unchanged')
240
self.runbzr('commit -m blah3 --unchanged')
241
self.runbzr('pull ../a', retcode=1)
243
self.runbzr('merge ../b')
244
self.runbzr('commit -m blah4 --unchanged')
246
self.runbzr('pull ../a')
247
assert a.revision_history()[-1] == b.revision_history()[-1]
250
def test_add_reports(self):
251
"""add command prints the names of added files."""
252
b = Branch('.', init=True)
253
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
255
from cStringIO import StringIO
258
ret = self.apply_redirected(None, out, None,
261
self.assertEquals(ret, 0)
263
# the ordering is not defined at the moment
264
results = sorted(out.getvalue().rstrip('\n').split('\n'))
265
self.assertEquals(['added dir',
221
271
class OldTests(ExternalBase):
222
272
"""old tests moved from ./testbzr."""