~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_status.py

  • Committer: Robert Collins
  • Date: 2007-04-23 02:29:35 UTC
  • mfrom: (2441 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070423022935-9hhongamvk6bfdso
Resolve conflicts with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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",
249
 
                             err)
250
247
        finally:
 
248
            # before run another commands we should unlock tree
251
249
            tree.unlock()
 
250
        out, err = self.run_bzr('status')
 
251
        self.assertEqual("working tree is out of date, run 'bzr update'\n",
 
252
                         err)
252
253
 
253
254
 
254
255
class CheckoutStatus(BranchStatus):
267
268
 
268
269
class TestStatus(TestCaseWithTransport):
269
270
 
270
 
    def test_status(self):
 
271
    def test_status_plain(self):
271
272
        self.run_bzr("init")
272
273
 
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")
278
277
 
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")
284
281
 
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")
290
285
 
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)
 
292
 
 
293
    def test_status_short(self):
 
294
        self.run_bzr("init")
 
295
 
 
296
        self.build_tree(['hello.txt'])
 
297
        result = self.run_bzr("status","--short")[0]
 
298
        self.assertContainsRe(result, "[?]   hello.txt\n")
 
299
 
 
300
        self.run_bzr("add", "hello.txt")
 
301
        result = self.run_bzr("status","--short")[0]
 
302
        self.assertContainsRe(result, "[+]N  hello.txt\n")
 
303
 
 
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")
 
307
 
 
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)
302
314
 
 
315
    def test_status_versioned(self):
 
316
        self.run_bzr("init")
 
317
 
 
318
        self.build_tree(['hello.txt'])
 
319
        result = self.run_bzr("status", "--versioned")[0]
 
320
        self.assertNotContainsRe(result, "unknown:\n  hello.txt\n")
 
321
 
 
322
        self.run_bzr("add", "hello.txt")
 
323
        result = self.run_bzr("status", "--versioned")[0]
 
324
        self.assertContainsRe(result, "added:\n  hello.txt\n")
 
325
 
 
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")
 
329
 
 
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)
 
336
 
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]