~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2007-08-10 09:04:38 UTC
  • mto: This revision was merged to the branch mainline in revision 2694.
  • Revision ID: bialix@ukr.net-20070810090438-0835xdz0rl8825qv
fixes after Ian's review

Show diffs side-by-side

added added

removed removed

Lines of Context:
230
230
        tof.seek(0)
231
231
        self.assertEquals(tof.readlines(), ['?   dir2/\n'])
232
232
 
233
 
        tof = StringIO()
234
 
        revs = [RevisionSpec.from_string('0'), RevisionSpec.from_string('1')]
235
 
        show_tree_status(wt, specific_files=['test.c'], to_file=tof,
236
 
                         short=True, revision=revs)
237
 
        tof.seek(0)
238
 
        self.assertEquals(tof.readlines(), ['+N  test.c\n'])
239
 
 
240
233
    def test_specific_files_conflicts(self):
241
234
        tree = self.make_branch_and_tree('.')
242
235
        self.build_tree(['dir2/'])
303
296
class TestStatus(TestCaseWithTransport):
304
297
 
305
298
    def test_status_plain(self):
306
 
        tree = self.make_branch_and_tree('.')
 
299
        self.run_bzr("init")
307
300
 
308
301
        self.build_tree(['hello.txt'])
309
302
        result = self.run_bzr("status")[0]
310
303
        self.assertContainsRe(result, "unknown:\n  hello.txt\n")
311
304
 
312
 
        tree.add("hello.txt")
 
305
        self.run_bzr("add hello.txt")
313
306
        result = self.run_bzr("status")[0]
314
307
        self.assertContainsRe(result, "added:\n  hello.txt\n")
315
308
 
316
 
        tree.commit(message="added")
 
309
        self.run_bzr("commit -m added")
317
310
        result = self.run_bzr("status -r 0..1")[0]
318
311
        self.assertContainsRe(result, "added:\n  hello.txt\n")
319
312
 
320
 
        result = self.run_bzr("status -c 1")[0]
321
 
        self.assertContainsRe(result, "added:\n  hello.txt\n")
322
 
 
323
313
        self.build_tree(['world.txt'])
324
314
        result = self.run_bzr("status -r 0")[0]
325
315
        self.assertContainsRe(result, "added:\n  hello.txt\n" \
328
318
        self.assertEquals(result2, result)
329
319
 
330
320
    def test_status_short(self):
331
 
        tree = self.make_branch_and_tree('.')
 
321
        self.run_bzr("init")
332
322
 
333
323
        self.build_tree(['hello.txt'])
334
324
        result = self.run_bzr("status --short")[0]
335
325
        self.assertContainsRe(result, "[?]   hello.txt\n")
336
326
 
337
 
        tree.add("hello.txt")
 
327
        self.run_bzr("add hello.txt")
338
328
        result = self.run_bzr("status --short")[0]
339
329
        self.assertContainsRe(result, "[+]N  hello.txt\n")
340
330
 
341
 
        tree.commit(message="added")
 
331
        self.run_bzr("commit -m added")
342
332
        result = self.run_bzr("status --short -r 0..1")[0]
343
333
        self.assertContainsRe(result, "[+]N  hello.txt\n")
344
334
 
350
340
        self.assertEquals(result2, result)
351
341
 
352
342
    def test_status_versioned(self):
353
 
        tree = self.make_branch_and_tree('.')
 
343
        self.run_bzr("init")
354
344
 
355
345
        self.build_tree(['hello.txt'])
356
346
        result = self.run_bzr("status --versioned")[0]
357
347
        self.assertNotContainsRe(result, "unknown:\n  hello.txt\n")
358
348
 
359
 
        tree.add("hello.txt")
 
349
        self.run_bzr("add hello.txt")
360
350
        result = self.run_bzr("status --versioned")[0]
361
351
        self.assertContainsRe(result, "added:\n  hello.txt\n")
362
352
 
363
 
        tree.commit("added")
 
353
        self.run_bzr("commit -m added")
364
354
        result = self.run_bzr("status --versioned -r 0..1")[0]
365
355
        self.assertContainsRe(result, "added:\n  hello.txt\n")
366
356
 
371
361
        result2 = self.run_bzr("status --versioned -r 0..")[0]
372
362
        self.assertEquals(result2, result)
373
363
 
374
 
    def test_status_SV(self):
375
 
        tree = self.make_branch_and_tree('.')
376
 
 
377
 
        self.build_tree(['hello.txt'])
378
 
        result = self.run_bzr("status -SV")[0]
379
 
        self.assertNotContainsRe(result, "hello.txt")
380
 
 
381
 
        tree.add("hello.txt")
382
 
        result = self.run_bzr("status -SV")[0]
383
 
        self.assertContainsRe(result, "[+]N  hello.txt\n")
384
 
 
385
 
        tree.commit(message="added")
386
 
        result = self.run_bzr("status -SV -r 0..1")[0]
387
 
        self.assertContainsRe(result, "[+]N  hello.txt\n")
388
 
 
389
 
        self.build_tree(['world.txt'])
390
 
        result = self.run_bzr("status -SV -r 0")[0]
391
 
        self.assertContainsRe(result, "[+]N  hello.txt\n")
392
 
 
393
 
        result2 = self.run_bzr("status -SV -r 0..")[0]
394
 
        self.assertEquals(result2, result)
395
 
 
396
364
    def assertStatusContains(self, pattern):
397
365
        """Run status, and assert it contains the given pattern"""
398
366
        result = self.run_bzr("status --short")[0]
411
379
        rmdir('directory')
412
380
        self.assertStatusContains('RD  file => directory')
413
381
 
414
 
    def test_status_illegal_revision_specifiers(self):
415
 
        out, err = self.run_bzr('status -r 1..23..123', retcode=3)
416
 
        self.assertContainsRe(err, 'one or two revision specifiers')
417
 
 
418
382
 
419
383
class TestStatusEncodings(TestCaseWithTransport):
420
384