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):
143
147
os.rmdir('revertdir')
144
148
self.runbzr('revert')
146
def skipped_test_mv_modes(self):
150
def test_mv_modes(self):
147
151
"""Test two modes of operation for mv"""
148
152
from bzrlib.branch import Branch
149
153
b = Branch('.', init=True)
150
154
self.build_tree(['a', 'c', 'subdir/'])
155
self.run_bzr('add', self.test_dir)
151
156
self.run_bzr('mv', 'a', 'b')
152
157
self.run_bzr('mv', 'b', 'subdir')
153
158
self.run_bzr('mv', 'subdir/b', 'a')
154
self.run_bzr('mv', 'a', 'b', 'subdir')
159
self.run_bzr('mv', 'a', 'c', 'subdir')
155
160
self.run_bzr('mv', 'subdir/a', 'subdir/newa')
157
163
def test_main_version(self):
158
164
"""Check output from version command and master option is reasonable"""
159
165
# output is intentionally passed through to stdout so that we
214
218
b = Branch('../b')
215
219
a.get_revision_xml(b.last_patch())
217
220
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())
221
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
222
# % (a.pending_merges(), b.last_patch())
225
"""Pull changes from one branch to another."""
229
self.example_branch()
230
self.runbzr('pull', retcode=1)
231
self.runbzr('missing', retcode=1)
232
self.runbzr('missing .')
233
self.runbzr('missing')
235
self.runbzr('pull /', retcode=1)
239
self.runbzr('branch a b')
242
self.runbzr('commit -m blah --unchanged')
246
assert a.revision_history() == b.revision_history()[:-1]
247
self.runbzr('pull ../b')
248
assert a.revision_history() == b.revision_history()
249
self.runbzr('commit -m blah2 --unchanged')
251
self.runbzr('commit -m blah3 --unchanged')
252
self.runbzr('pull ../a', retcode=1)
254
self.runbzr('merge ../b')
255
self.runbzr('commit -m blah4 --unchanged')
257
self.runbzr('pull ../a')
258
assert a.revision_history()[-1] == b.revision_history()[-1]
261
def test_add_reports(self):
262
"""add command prints the names of added files."""
263
b = Branch('.', init=True)
264
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
266
from cStringIO import StringIO
269
ret = self.apply_redirected(None, out, None,
272
self.assertEquals(ret, 0)
274
# the ordering is not defined at the moment
275
results = sorted(out.getvalue().rstrip('\n').split('\n'))
276
self.assertEquals(['added dir',
221
282
class OldTests(ExternalBase):
222
283
"""old tests moved from ./testbzr."""