268
268
class TestStatus(TestCaseWithTransport):
270
def test_status(self):
270
def test_status_plain(self):
271
271
self.run_bzr("init")
273
273
self.build_tree(['hello.txt'])
274
274
result = self.run_bzr("status")[0]
275
self.assert_("unknown:\n hello.txt\n" in result, result)
276
result = self.run_bzr("status","--short")[0]
277
self.assertContainsRe(result, "[?] hello.txt\n")
275
self.assertContainsRe(result, "unknown:\n hello.txt\n")
279
277
self.run_bzr("add", "hello.txt")
280
278
result = self.run_bzr("status")[0]
281
279
self.assertContainsRe(result, "added:\n hello.txt\n")
282
result = self.run_bzr("status","--short")[0]
283
self.assertContainsRe(result, "[+]N hello.txt\n")
285
281
self.run_bzr("commit", "-m", "added")
286
282
result = self.run_bzr("status", "-r", "0..1")[0]
287
283
self.assertContainsRe(result, "added:\n hello.txt\n")
288
result = self.run_bzr("status", "--short", "-r", "0..1")[0]
289
self.assertContainsRe(result, "[+]N hello.txt\n")
291
285
self.build_tree(['world.txt'])
292
286
result = self.run_bzr("status", "-r", "0")[0]
294
288
"unknown:\n world.txt\n")
295
289
result2 = self.run_bzr("status", "-r", "0..")[0]
296
290
self.assertEquals(result2, result)
292
def test_status_short(self):
295
self.build_tree(['hello.txt'])
296
result = self.run_bzr("status","--short")[0]
297
self.assertContainsRe(result, "[?] hello.txt\n")
299
self.run_bzr("add", "hello.txt")
300
result = self.run_bzr("status","--short")[0]
301
self.assertContainsRe(result, "[+]N hello.txt\n")
303
self.run_bzr("commit", "-m", "added")
304
result = self.run_bzr("status", "--short", "-r", "0..1")[0]
305
self.assertContainsRe(result, "[+]N hello.txt\n")
307
self.build_tree(['world.txt'])
297
308
result = self.run_bzr("status", "--short", "-r", "0")[0]
298
309
self.assertContainsRe(result, "[+]N hello.txt\n" \
299
310
"[?] world.txt\n")
300
311
result2 = self.run_bzr("status", "--short", "-r", "0..")[0]
301
312
self.assertEquals(result2, result)
314
def test_status_versioned(self):
317
self.build_tree(['hello.txt'])
318
result = self.run_bzr("status", "--versioned")[0]
319
self.assertNotContainsRe(result, "unknown:\n hello.txt\n")
321
self.run_bzr("add", "hello.txt")
322
result = self.run_bzr("status", "--versioned")[0]
323
self.assertContainsRe(result, "added:\n hello.txt\n")
325
self.run_bzr("commit", "-m", "added")
326
result = self.run_bzr("status", "--versioned", "-r", "0..1")[0]
327
self.assertContainsRe(result, "added:\n hello.txt\n")
329
self.build_tree(['world.txt'])
330
result = self.run_bzr("status", "--versioned", "-r", "0")[0]
331
self.assertContainsRe(result, "added:\n hello.txt\n")
332
self.assertNotContainsRe(result, "unknown:\n world.txt\n")
333
result2 = self.run_bzr("status", "--versioned", "-r", "0..")[0]
334
self.assertEquals(result2, result)
303
336
def assertStatusContains(self, pattern):
304
337
"""Run status, and assert it contains the given pattern"""
305
338
result = self.run_bzr("status", "--short")[0]