~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

[merge] robert

Show diffs side-by-side

added added

removed removed

Lines of Context:
302
302
        self.example_branch()
303
303
        file('hello', 'wt').write('hello world!')
304
304
        self.runbzr('commit -m fixing hello')
305
 
        output = self.runbzr('diff -r 2..3', backtick=1)
 
305
        output = self.runbzr('diff -r 2..3', backtick=1, retcode=1)
306
306
        self.assert_('\n+hello world!' in output)
307
 
        output = self.runbzr('diff -r last:3..last:1', backtick=1)
 
307
        output = self.runbzr('diff -r last:3..last:1', backtick=1, retcode=1)
308
308
        self.assert_('\n+baz' in output)
309
309
 
310
310
    def test_diff_branches(self):
317
317
        branch2 = Branch.open('branch2')
318
318
        branch2.commit('update file')
319
319
        # should open branch1 and diff against branch2, 
320
 
        output = self.run_bzr_captured(['diff', '-r', 'branch:branch2', 'branch1'])
 
320
        output = self.run_bzr_captured(['diff', '-r', 'branch:branch2', 
 
321
                                        'branch1'],
 
322
                                       retcode=1)
321
323
        self.assertEquals(("=== modified file 'file'\n"
322
324
                           "--- file\n"
323
325
                           "+++ file\n"
716
718
        finally:
717
719
            bzrlib.gpg.GPGStrategy = oldstrategy
718
720
 
 
721
    def test_push(self):
 
722
        # create a source branch
 
723
        os.mkdir('my-branch')
 
724
        os.chdir('my-branch')
 
725
        self.example_branch()
 
726
 
 
727
        # with no push target, fail
 
728
        self.runbzr('push', retcode=1)
 
729
        # with an explicit target work
 
730
        self.runbzr('push ../output-branch')
 
731
        # with an implicit target work
 
732
        self.runbzr('push')
 
733
        # nothing missing
 
734
        self.runbzr('missing ../output-branch')
 
735
        # advance this branch
 
736
        self.runbzr('commit --unchanged -m unchanged')
 
737
 
 
738
        os.chdir('../output-branch')
 
739
        # should be a diff as we have not pushed the tree
 
740
        self.runbzr('diff', retcode=1)
 
741
        self.runbzr('revert')
 
742
        # but not now.
 
743
        self.runbzr('diff')
 
744
        # diverge the branches
 
745
        self.runbzr('commit --unchanged -m unchanged')
 
746
        os.chdir('../my-branch')
 
747
        # cannot push now
 
748
        self.runbzr('push', retcode=1)
 
749
        # and there are difference
 
750
        self.runbzr('missing ../output-branch', retcode=1)
 
751
        # but we can force a push
 
752
        self.runbzr('push --overwrite')
 
753
        # nothing missing
 
754
        self.runbzr('missing ../output-branch')
 
755
        
 
756
        # pushing to a new dir with no parent should fail
 
757
        self.runbzr('push ../missing/new-branch', retcode=1)
 
758
        # unless we provide --create-prefix
 
759
        self.runbzr('push --create-prefix ../missing/new-branch')
 
760
        # nothing missing
 
761
        self.runbzr('missing ../missing/new-branch')
 
762
 
719
763
 
720
764
def listdir_sorted(dir):
721
765
    L = os.listdir(dir)
890
934
        mkdir('sub directory')
891
935
        file('sub directory/file with spaces ', 'wt').write('see how this works\n')
892
936
        runbzr('add .')
893
 
        runbzr('diff')
 
937
        runbzr('diff', retcode=1)
894
938
        runbzr('commit -m add-spaces')
895
939
        runbzr('check')
896
940
 
927
971
            assert os.readlink("./link2") == "NOWHERE2"
928
972
            assert os.readlink("d2/link1") == "NOWHERE1"
929
973
            runbzr('add d2/link3')
930
 
            runbzr('diff')
 
974
            runbzr('diff', retcode=1)
931
975
            runbzr(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
932
976
    
933
977
            os.unlink("link2")
934
978
            os.symlink("TARGET 2", "link2")
935
979
            os.unlink("d2/link1")
936
980
            os.symlink("TARGET 1", "d2/link1")
937
 
            runbzr('diff')
 
981
            runbzr('diff', retcode=1)
938
982
            assert self.capture("relpath d2/link1") == "d2/link1\n"
939
983
            runbzr(['commit', '-m', '4: retarget of two links'])
940
984