232
228
self.assertEquals(tof.readlines(), ['? dir2/\n'])
234
def test_specific_files_conflicts(self):
235
tree = self.make_branch_and_tree('.')
236
self.build_tree(['dir2/'])
238
tree.commit('added dir2')
239
tree.set_conflicts(conflicts.ConflictList(
240
[conflicts.ContentsConflict('foo')]))
242
show_tree_status(tree, specific_files=['dir2'], to_file=tof)
243
self.assertEqualDiff('', tof.getvalue())
244
tree.set_conflicts(conflicts.ConflictList(
245
[conflicts.ContentsConflict('dir2')]))
247
show_tree_status(tree, specific_files=['dir2'], to_file=tof)
248
self.assertEqualDiff('conflicts:\n Contents conflict in dir2\n',
251
tree.set_conflicts(conflicts.ConflictList(
252
[conflicts.ContentsConflict('dir2/file1')]))
254
show_tree_status(tree, specific_files=['dir2'], to_file=tof)
255
self.assertEqualDiff('conflicts:\n Contents conflict in dir2/file1\n',
258
230
def test_status_nonexistent_file(self):
259
231
# files that don't exist in either the basis tree or working tree
260
232
# should give an error
261
233
wt = self.make_branch_and_tree('.')
262
out, err = self.run_bzr('status does-not-exist', retcode=3)
234
out, err = self.run_bzr('status', 'does-not-exist', retcode=3)
263
235
self.assertContainsRe(err, r'do not exist.*does-not-exist')
265
237
def test_status_out_of_date(self):
303
275
result = self.run_bzr("status")[0]
304
276
self.assertContainsRe(result, "unknown:\n hello.txt\n")
306
self.run_bzr("add hello.txt")
278
self.run_bzr("add", "hello.txt")
307
279
result = self.run_bzr("status")[0]
308
280
self.assertContainsRe(result, "added:\n hello.txt\n")
310
self.run_bzr("commit -m added")
311
result = self.run_bzr("status -r 0..1")[0]
282
self.run_bzr("commit", "-m", "added")
283
result = self.run_bzr("status", "-r", "0..1")[0]
312
284
self.assertContainsRe(result, "added:\n hello.txt\n")
314
286
self.build_tree(['world.txt'])
315
result = self.run_bzr("status -r 0")[0]
287
result = self.run_bzr("status", "-r", "0")[0]
316
288
self.assertContainsRe(result, "added:\n hello.txt\n" \
317
289
"unknown:\n world.txt\n")
318
result2 = self.run_bzr("status -r 0..")[0]
290
result2 = self.run_bzr("status", "-r", "0..")[0]
319
291
self.assertEquals(result2, result)
321
293
def test_status_short(self):
322
294
self.run_bzr("init")
324
296
self.build_tree(['hello.txt'])
325
result = self.run_bzr("status --short")[0]
297
result = self.run_bzr("status","--short")[0]
326
298
self.assertContainsRe(result, "[?] hello.txt\n")
328
self.run_bzr("add hello.txt")
329
result = self.run_bzr("status --short")[0]
300
self.run_bzr("add", "hello.txt")
301
result = self.run_bzr("status","--short")[0]
330
302
self.assertContainsRe(result, "[+]N hello.txt\n")
332
self.run_bzr("commit -m added")
333
result = self.run_bzr("status --short -r 0..1")[0]
304
self.run_bzr("commit", "-m", "added")
305
result = self.run_bzr("status", "--short", "-r", "0..1")[0]
334
306
self.assertContainsRe(result, "[+]N hello.txt\n")
336
308
self.build_tree(['world.txt'])
337
result = self.run_bzr("status --short -r 0")[0]
309
result = self.run_bzr("status", "--short", "-r", "0")[0]
338
310
self.assertContainsRe(result, "[+]N hello.txt\n" \
339
311
"[?] world.txt\n")
340
result2 = self.run_bzr("status --short -r 0..")[0]
312
result2 = self.run_bzr("status", "--short", "-r", "0..")[0]
341
313
self.assertEquals(result2, result)
343
315
def test_status_versioned(self):
344
316
self.run_bzr("init")
346
318
self.build_tree(['hello.txt'])
347
result = self.run_bzr("status --versioned")[0]
319
result = self.run_bzr("status", "--versioned")[0]
348
320
self.assertNotContainsRe(result, "unknown:\n hello.txt\n")
350
self.run_bzr("add hello.txt")
351
result = self.run_bzr("status --versioned")[0]
322
self.run_bzr("add", "hello.txt")
323
result = self.run_bzr("status", "--versioned")[0]
352
324
self.assertContainsRe(result, "added:\n hello.txt\n")
354
self.run_bzr("commit -m added")
355
result = self.run_bzr("status --versioned -r 0..1")[0]
326
self.run_bzr("commit", "-m", "added")
327
result = self.run_bzr("status", "--versioned", "-r", "0..1")[0]
356
328
self.assertContainsRe(result, "added:\n hello.txt\n")
358
330
self.build_tree(['world.txt'])
359
result = self.run_bzr("status --versioned -r 0")[0]
331
result = self.run_bzr("status", "--versioned", "-r", "0")[0]
360
332
self.assertContainsRe(result, "added:\n hello.txt\n")
361
333
self.assertNotContainsRe(result, "unknown:\n world.txt\n")
362
result2 = self.run_bzr("status --versioned -r 0..")[0]
334
result2 = self.run_bzr("status", "--versioned", "-r", "0..")[0]
363
335
self.assertEquals(result2, result)
365
337
def assertStatusContains(self, pattern):
366
338
"""Run status, and assert it contains the given pattern"""
367
result = self.run_bzr("status --short")[0]
339
result = self.run_bzr("status", "--short")[0]
368
340
self.assertContainsRe(result, pattern)
370
342
def test_kind_change_short(self):