244
244
tree.commit('add test file')
245
245
# simulate what happens after a remote push
246
246
tree.set_last_revision("0")
247
out, err = self.run_bzr('status')
248
self.assertEqual("working tree is out of date, run 'bzr update'\n",
248
# before run another commands we should unlock tree
250
out, err = self.run_bzr('status')
251
self.assertEqual("working tree is out of date, run 'bzr update'\n",
254
255
class CheckoutStatus(BranchStatus):
268
269
class TestStatus(TestCaseWithTransport):
270
def test_status(self):
271
def test_status_plain(self):
271
272
self.run_bzr("init")
273
274
self.build_tree(['hello.txt'])
274
275
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")
276
self.assertContainsRe(result, "unknown:\n hello.txt\n")
279
278
self.run_bzr("add", "hello.txt")
280
279
result = self.run_bzr("status")[0]
281
280
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
282
self.run_bzr("commit", "-m", "added")
286
283
result = self.run_bzr("status", "-r", "0..1")[0]
287
284
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
286
self.build_tree(['world.txt'])
292
287
result = self.run_bzr("status", "-r", "0")[0]
294
289
"unknown:\n world.txt\n")
295
290
result2 = self.run_bzr("status", "-r", "0..")[0]
296
291
self.assertEquals(result2, result)
293
def test_status_short(self):
296
self.build_tree(['hello.txt'])
297
result = self.run_bzr("status","--short")[0]
298
self.assertContainsRe(result, "[?] hello.txt\n")
300
self.run_bzr("add", "hello.txt")
301
result = self.run_bzr("status","--short")[0]
302
self.assertContainsRe(result, "[+]N hello.txt\n")
304
self.run_bzr("commit", "-m", "added")
305
result = self.run_bzr("status", "--short", "-r", "0..1")[0]
306
self.assertContainsRe(result, "[+]N hello.txt\n")
308
self.build_tree(['world.txt'])
297
309
result = self.run_bzr("status", "--short", "-r", "0")[0]
298
310
self.assertContainsRe(result, "[+]N hello.txt\n" \
299
311
"[?] world.txt\n")
300
312
result2 = self.run_bzr("status", "--short", "-r", "0..")[0]
301
313
self.assertEquals(result2, result)
315
def test_status_versioned(self):
318
self.build_tree(['hello.txt'])
319
result = self.run_bzr("status", "--versioned")[0]
320
self.assertNotContainsRe(result, "unknown:\n hello.txt\n")
322
self.run_bzr("add", "hello.txt")
323
result = self.run_bzr("status", "--versioned")[0]
324
self.assertContainsRe(result, "added:\n hello.txt\n")
326
self.run_bzr("commit", "-m", "added")
327
result = self.run_bzr("status", "--versioned", "-r", "0..1")[0]
328
self.assertContainsRe(result, "added:\n hello.txt\n")
330
self.build_tree(['world.txt'])
331
result = self.run_bzr("status", "--versioned", "-r", "0")[0]
332
self.assertContainsRe(result, "added:\n hello.txt\n")
333
self.assertNotContainsRe(result, "unknown:\n world.txt\n")
334
result2 = self.run_bzr("status", "--versioned", "-r", "0..")[0]
335
self.assertEquals(result2, result)
303
337
def assertStatusContains(self, pattern):
304
338
"""Run status, and assert it contains the given pattern"""
305
339
result = self.run_bzr("status", "--short")[0]