/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_upload.py

(vila, beuno) Implement .bzrignore-upload

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        # We don't want to use run_bzr here because redirected output are a
204
204
        # pain to debug. But we need to provides a valid outf.
205
205
        # XXX: Should a bug against bzr be filled about that ?
206
 
        cmd._setup_outf()
 
206
 
 
207
        # Short story: we don't expect any output so we may just use stdout
 
208
        cmd.outf = sys.stdout
207
209
        return cmd
208
210
 
209
211
    def do_full_upload(self, *args, **kwargs):
445
447
    def test_ignore_file(self):
446
448
        self.make_branch_and_working_tree()
447
449
        self.do_full_upload()
448
 
        self.add_file('.bzrignore-upload','foo')
 
450
        self.add_file('.bzrignore-upload', 'foo')
 
451
        self.add_file('foo', 'bar')
 
452
 
 
453
        self.do_upload()
 
454
 
 
455
        self.failIfUpFileExists('foo')
 
456
 
 
457
    def test_ignore_regexp(self):
 
458
        self.make_branch_and_working_tree()
 
459
        self.do_full_upload()
 
460
        self.add_file('.bzrignore-upload', 'f*')
449
461
        self.add_file('foo', 'bar')
450
462
 
451
463
        self.do_upload()
455
467
    def test_ignore_directory(self):
456
468
        self.make_branch_and_working_tree()
457
469
        self.do_full_upload()
458
 
        self.add_file('.bzrignore-upload','dir')
459
 
        self.add_dir('dir')
460
 
 
461
 
        self.do_upload()
462
 
 
463
 
        self.failIfUpFileExists('dir')
 
470
        self.add_file('.bzrignore-upload', 'dir')
 
471
        self.add_dir('dir')
 
472
 
 
473
        self.do_upload()
 
474
 
 
475
        self.failIfUpFileExists('dir')
 
476
 
 
477
    def test_ignore_nested_directory(self):
 
478
        self.make_branch_and_working_tree()
 
479
        self.do_full_upload()
 
480
        self.add_file('.bzrignore-upload', 'dir')
 
481
        self.add_dir('dir')
 
482
        self.add_dir('dir/foo')
 
483
        self.add_file('dir/foo/bar', 'bar contents')
 
484
 
 
485
        self.do_upload()
 
486
 
 
487
        self.failIfUpFileExists('dir')
 
488
        self.failIfUpFileExists('dir/foo/bar')
 
489
 
 
490
    def test_ignore_change_file_into_dir(self):
 
491
        self.make_branch_and_working_tree()
 
492
        self.add_file('hello', 'foo')
 
493
        self.do_full_upload()
 
494
        self.add_file('.bzrignore-upload', 'hello')
 
495
        self.transform_file_into_dir('hello')
 
496
        self.add_file('hello/file', 'bar')
 
497
 
 
498
        self.assertUpFileEqual('foo', 'hello')
 
499
 
 
500
        self.do_upload()
 
501
 
 
502
        self.assertUpFileEqual('foo', 'hello')
 
503
 
 
504
    def test_ignore_change_dir_into_file(self):
 
505
        self.make_branch_and_working_tree()
 
506
        self.add_dir('hello')
 
507
        self.add_file('hello/file', 'foo')
 
508
        self.do_full_upload()
 
509
 
 
510
        self.add_file('.bzrignore-upload', 'hello')
 
511
        self.delete_any('hello/file')
 
512
        self.transform_dir_into_file('hello', 'bar')
 
513
 
 
514
        self.assertUpFileEqual('foo', 'hello/file')
 
515
 
 
516
        self.do_upload()
 
517
 
 
518
        self.assertUpFileEqual('foo', 'hello/file')
 
519
 
 
520
    def test_ignore_delete_dir_in_subdir(self):
 
521
        self.make_branch_and_working_tree()
 
522
        self.add_dir('dir')
 
523
        self.add_dir('dir/subdir')
 
524
        self.add_file('dir/subdir/a', 'foo')
 
525
        self.do_full_upload()
 
526
        self.add_file('.bzrignore-upload', 'dir/subdir')
 
527
        self.rename_any('dir/subdir/a', 'dir/a')
 
528
        self.delete_any('dir/subdir')
 
529
 
 
530
        self.assertUpFileEqual('foo', 'dir/subdir/a')
 
531
 
 
532
        self.do_upload()
 
533
 
 
534
        # The file in the dir is not ignored. This a bit contrived but
 
535
        # indicates that we may encounter problems when ignored items appear
 
536
        # and disappear... -- vila 100106
 
537
        self.assertUpFileEqual('foo', 'dir/a')
464
538
 
465
539
 
466
540
class TestFullUpload(tests.TestCaseWithTransport, TestUploadMixin):
576
650
 
577
651
        self.assertUpFileEqual('bar', 'hello')
578
652
 
 
653
    def test_ignore_delete_one_file(self):
 
654
        self.make_branch_and_working_tree()
 
655
        self.add_file('hello', 'foo')
 
656
        self.do_full_upload()
 
657
        self.add_file('.bzrignore-upload', 'hello')
 
658
        self.delete_any('hello')
 
659
 
 
660
        self.assertUpFileEqual('foo', 'hello')
 
661
 
 
662
        self.do_upload()
 
663
 
 
664
        self.assertUpFileEqual('foo', 'hello')
 
665
 
579
666
 
580
667
class TestBranchUploadLocations(per_branch.TestCaseWithBranch):
581
668