~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

Merged Martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
 
155
155
        file('foo.tmp', 'wt').write('tmp files are ignored')
156
156
        self.assertEquals(list(b.unknowns()), [])
157
 
        assert self.capture('unknowns') == ''
 
157
        self.assertEquals(self.capture('unknowns'), '')
158
158
 
159
159
        file('foo.c', 'wt').write('int main() {}')
160
160
        self.assertEquals(list(b.unknowns()), ['foo.c'])
161
 
        assert self.capture('unknowns') == 'foo.c\n'
 
161
        self.assertEquals(self.capture('unknowns'), 'foo.c\n')
162
162
 
163
163
        self.runbzr(['add', 'foo.c'])
164
 
        assert self.capture('unknowns') == ''
 
164
        self.assertEquals(self.capture('unknowns'), '')
165
165
 
166
166
        # 'ignore' works when creating the .bzignore file
167
167
        file('foo.blah', 'wt').write('blah')
168
168
        self.assertEquals(list(b.unknowns()), ['foo.blah'])
169
169
        self.runbzr('ignore *.blah')
170
170
        self.assertEquals(list(b.unknowns()), [])
171
 
        assert file('.bzrignore', 'rU').read() == '*.blah\n'
 
171
        self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\n')
172
172
 
173
173
        # 'ignore' works when then .bzrignore file already exists
174
174
        file('garh', 'wt').write('garh')
175
175
        self.assertEquals(list(b.unknowns()), ['garh'])
176
 
        assert self.capture('unknowns') == 'garh\n'
 
176
        self.assertEquals(self.capture('unknowns'), 'garh\n')
177
177
        self.runbzr('ignore garh')
178
178
        self.assertEquals(list(b.unknowns()), [])
179
 
        assert file('.bzrignore', 'rU').read() == '*.blah\ngarh\n'
 
179
        self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\ngarh\n')
180
180
 
181
181
    def test_revert(self):
182
182
        self.runbzr('init')
269
269
        self.runbzr('export ../latest')
270
270
        self.assertEqual(file('../latest/goodbye', 'rt').read(), 'baz')
271
271
        self.runbzr('export ../first -r 1')
272
 
        assert not os.path.exists('../first/goodbye')
 
272
        self.assert_(not os.path.exists('../first/goodbye'))
273
273
        self.assertEqual(file('../first/hello', 'rt').read(), 'foo')
274
274
        self.runbzr('export ../first.gz -r 1')
275
275
        self.assertEqual(file('../first.gz/hello', 'rt').read(), 'foo')
276
276
        self.runbzr('export ../first.bz2 -r 1')
277
277
        self.assertEqual(file('../first.bz2/hello', 'rt').read(), 'foo')
278
278
        self.runbzr('export ../first.tar -r 1')
279
 
        assert os.path.isfile('../first.tar')
 
279
        self.assert_(os.path.isfile('../first.tar'))
280
280
        from tarfile import TarFile
281
281
        tf = TarFile('../first.tar')
282
 
        assert 'first/hello' in tf.getnames(), tf.getnames()
 
282
        self.assert_('first/hello' in tf.getnames(), tf.getnames())
283
283
        self.assertEqual(tf.extractfile('first/hello').read(), 'foo')
284
284
        self.runbzr('export ../first.tar.gz -r 1')
285
 
        assert os.path.isfile('../first.tar.gz')
 
285
        self.assert_(os.path.isfile('../first.tar.gz'))
286
286
        self.runbzr('export ../first.tbz2 -r 1')
287
 
        assert os.path.isfile('../first.tbz2')
 
287
        self.assert_(os.path.isfile('../first.tbz2'))
288
288
        self.runbzr('export ../first.tar.bz2 -r 1')
289
 
        assert os.path.isfile('../first.tar.bz2')
 
289
        self.assert_(os.path.isfile('../first.tar.bz2'))
290
290
        self.runbzr('export ../first.tar.tbz2 -r 1')
291
 
        assert os.path.isfile('../first.tar.tbz2')
 
291
        self.assert_(os.path.isfile('../first.tar.tbz2'))
292
292
        from bz2 import BZ2File
293
293
        tf = TarFile('../first.tar.tbz2', 
294
294
                     fileobj=BZ2File('../first.tar.tbz2', 'r'))
295
 
        assert 'first.tar/hello' in tf.getnames(), tf.getnames()
 
295
        self.assert_('first.tar/hello' in tf.getnames(), tf.getnames())
296
296
        self.assertEqual(tf.extractfile('first.tar/hello').read(), 'foo')
297
297
        self.runbzr('export ../first2.tar -r 1 --root pizza')
298
298
        tf = TarFile('../first2.tar')
299
 
        assert 'pizza/hello' in tf.getnames(), tf.getnames()
 
299
        self.assert_('pizza/hello' in tf.getnames(), tf.getnames())
300
300
 
301
301
    def test_diff(self):
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"
377
379
        b = Branch.open('../b')
378
380
        a.get_revision_xml(b.last_revision())
379
381
        self.log('pending merges: %s', a.pending_merges())
380
 
        assert a.pending_merges() == [b.last_revision()], "Assertion %s %s" \
381
 
            % (a.pending_merges(), b.last_patch())
 
382
        self.assertEquals(a.pending_merges(), [b.last_revision()])
382
383
        self.runbzr('commit -m merged')
383
384
        self.runbzr('merge ../b -r last:1')
384
385
        self.assertEqual(Branch.open('.').pending_merges(), [])
411
412
        print >> file('sub/c.txt', 'ab'), "something"
412
413
        self.runbzr(('commit', '-m', 'Modified a.txt'))
413
414
        self.runbzr('merge ../a/', retcode=1)
414
 
        assert os.path.exists('sub/a.txt.THIS')
415
 
        assert os.path.exists('sub/a.txt.BASE')
 
415
        self.assert_(os.path.exists('sub/a.txt.THIS'))
 
416
        self.assert_(os.path.exists('sub/a.txt.BASE'))
416
417
        os.chdir('../a')
417
418
        self.runbzr('merge ../b/', retcode=1)
418
 
        assert os.path.exists('sub/a.txt.OTHER')
419
 
        assert os.path.exists('sub/a.txt.BASE')
 
419
        self.assert_(os.path.exists('sub/a.txt.OTHER'))
 
420
        self.assert_(os.path.exists('sub/a.txt.BASE'))
420
421
 
421
422
    def test_pull(self):
422
423
        """Pull changes from one branch to another."""
442
443
        os.chdir('../a')
443
444
        a = Branch.open('.')
444
445
        b = Branch.open('../b')
445
 
        assert a.revision_history() == b.revision_history()[:-1]
 
446
        self.assertEquals(a.revision_history(), b.revision_history()[:-1])
446
447
        self.runbzr('pull ../b')
447
 
        assert a.revision_history() == b.revision_history()
 
448
        self.assertEquals(a.revision_history(), b.revision_history())
448
449
        self.runbzr('commit -m blah2 --unchanged')
449
450
        os.chdir('../b')
450
451
        self.runbzr('commit -m blah3 --unchanged')
462
463
        self.runbzr('commit -m blah4 --unchanged')
463
464
        os.chdir('../b/subdir')
464
465
        self.runbzr('pull ../../a')
465
 
        assert a.revision_history()[-1] == b.revision_history()[-1]
 
466
        self.assertEquals(a.revision_history()[-1], b.revision_history()[-1])
466
467
        self.runbzr('commit -m blah5 --unchanged')
467
468
        self.runbzr('commit -m blah6 --unchanged')
468
469
        os.chdir('..')
690
691
        self.create_conflicts()
691
692
        self.runbzr('merge ../other --show-base', retcode=1)
692
693
        conflict_text = file('hello').read()
693
 
        assert '<<<<<<<' in conflict_text
694
 
        assert '>>>>>>>' in conflict_text
695
 
        assert '=======' in conflict_text
696
 
        assert '|||||||' in conflict_text
697
 
        assert 'hi world' in conflict_text
 
694
        self.assert_('<<<<<<<' in conflict_text)
 
695
        self.assert_('>>>>>>>' in conflict_text)
 
696
        self.assert_('=======' in conflict_text)
 
697
        self.assert_('|||||||' in conflict_text)
 
698
        self.assert_('hi world' in conflict_text)
698
699
        self.runbzr('revert')
699
700
        self.runbzr('resolve --all')
700
701
        self.runbzr('merge ../other', retcode=1)
701
702
        conflict_text = file('hello').read()
702
 
        assert '|||||||' not in conflict_text
703
 
        assert 'hi world' not in conflict_text
 
703
        self.assert_('|||||||' not in conflict_text)
 
704
        self.assert_('hi world' not in conflict_text)
704
705
        result = self.runbzr('conflicts', backtick=1)
705
706
        self.assertEquals(result, "hello\nquestion\n")
706
707
        result = self.runbzr('status', backtick=1)
707
 
        assert "conflicts:\n  hello\n  question\n" in result, result
 
708
        self.assert_("conflicts:\n  hello\n  question\n" in result, result)
708
709
        self.runbzr('resolve hello')
709
710
        result = self.runbzr('conflicts', backtick=1)
710
711
        self.assertEquals(result, "question\n")
751
752
        finally:
752
753
            bzrlib.gpg.GPGStrategy = oldstrategy
753
754
 
 
755
    def test_push(self):
 
756
        # create a source branch
 
757
        os.mkdir('my-branch')
 
758
        os.chdir('my-branch')
 
759
        self.example_branch()
 
760
 
 
761
        # with no push target, fail
 
762
        self.runbzr('push', retcode=1)
 
763
        # with an explicit target work
 
764
        self.runbzr('push ../output-branch')
 
765
        # with an implicit target work
 
766
        self.runbzr('push')
 
767
        # nothing missing
 
768
        self.runbzr('missing ../output-branch')
 
769
        # advance this branch
 
770
        self.runbzr('commit --unchanged -m unchanged')
 
771
 
 
772
        os.chdir('../output-branch')
 
773
        # should be a diff as we have not pushed the tree
 
774
        self.runbzr('diff', retcode=1)
 
775
        self.runbzr('revert')
 
776
        # but not now.
 
777
        self.runbzr('diff')
 
778
        # diverge the branches
 
779
        self.runbzr('commit --unchanged -m unchanged')
 
780
        os.chdir('../my-branch')
 
781
        # cannot push now
 
782
        self.runbzr('push', retcode=1)
 
783
        # and there are difference
 
784
        self.runbzr('missing ../output-branch', retcode=1)
 
785
        # but we can force a push
 
786
        self.runbzr('push --overwrite')
 
787
        # nothing missing
 
788
        self.runbzr('missing ../output-branch')
 
789
        
 
790
        # pushing to a new dir with no parent should fail
 
791
        self.runbzr('push ../missing/new-branch', retcode=1)
 
792
        # unless we provide --create-prefix
 
793
        self.runbzr('push --create-prefix ../missing/new-branch')
 
794
        # nothing missing
 
795
        self.runbzr('missing ../missing/new-branch')
 
796
 
754
797
 
755
798
def listdir_sorted(dir):
756
799
    L = os.listdir(dir)
786
829
        self.assertEquals(capture('unknowns'), 'test.txt\n')
787
830
 
788
831
        out = capture("status")
789
 
        assert out == 'unknown:\n  test.txt\n'
 
832
        self.assertEquals(out, 'unknown:\n  test.txt\n')
790
833
 
791
834
        out = capture("status --all")
792
 
        assert out == "unknown:\n  test.txt\n"
 
835
        self.assertEquals(out, "unknown:\n  test.txt\n")
793
836
 
794
837
        out = capture("status test.txt --all")
795
 
        assert out == "unknown:\n  test.txt\n"
 
838
        self.assertEquals(out, "unknown:\n  test.txt\n")
796
839
 
797
840
        f = file('test2.txt', 'wt')
798
841
        f.write('goodbye cruel world...\n')
799
842
        f.close()
800
843
 
801
844
        out = capture("status test.txt")
802
 
        assert out == "unknown:\n  test.txt\n"
 
845
        self.assertEquals(out, "unknown:\n  test.txt\n")
803
846
 
804
847
        out = capture("status")
805
 
        assert out == ("unknown:\n"
806
 
                       "  test.txt\n"
807
 
                       "  test2.txt\n")
 
848
        self.assertEquals(out, ("unknown:\n" "  test.txt\n" "  test2.txt\n"))
808
849
 
809
850
        os.unlink('test2.txt')
810
851
 
811
852
        progress("command aliases")
812
853
        out = capture("st --all")
813
 
        assert out == ("unknown:\n"
814
 
                       "  test.txt\n")
 
854
        self.assertEquals(out, ("unknown:\n" "  test.txt\n"))
815
855
 
816
856
        out = capture("stat")
817
 
        assert out == ("unknown:\n"
818
 
                       "  test.txt\n")
 
857
        self.assertEquals(out, ("unknown:\n" "  test.txt\n"))
819
858
 
820
859
        progress("command help")
821
860
        runbzr("help st")
832
871
        progress("adding a file")
833
872
 
834
873
        runbzr("add test.txt")
835
 
        assert capture("unknowns") == ''
836
 
        assert capture("status --all") == ("added:\n"
837
 
                                                "  test.txt\n")
 
874
        self.assertEquals(capture("unknowns"), '')
 
875
        self.assertEquals(capture("status --all"), ("added:\n" "  test.txt\n"))
838
876
 
839
877
        progress("rename newly-added file")
840
878
        runbzr("rename test.txt hello.txt")
841
 
        assert os.path.exists("hello.txt")
842
 
        assert not os.path.exists("test.txt")
 
879
        self.assert_(os.path.exists("hello.txt"))
 
880
        self.assert_(not os.path.exists("test.txt"))
843
881
 
844
 
        assert capture("revno") == '0\n'
 
882
        self.assertEquals(capture("revno"), '0\n')
845
883
 
846
884
        progress("add first revision")
847
885
        runbzr(['commit', '-m', 'add first revision'])
858
896
        self.assertEqual(capture("relpath sub2/hello.txt"),
859
897
                         os.path.join("sub2", "hello.txt\n"))
860
898
 
861
 
        assert exists("sub2")
862
 
        assert exists("sub2/hello.txt")
863
 
        assert not exists("sub1")
864
 
        assert not exists("hello.txt")
 
899
        self.assert_(exists("sub2"))
 
900
        self.assert_(exists("sub2/hello.txt"))
 
901
        self.assert_(not exists("sub1"))
 
902
        self.assert_(not exists("hello.txt"))
865
903
 
866
904
        runbzr(['commit', '-m', 'commit with some things moved to subdirs'])
867
905
 
868
906
        mkdir("sub1")
869
907
        runbzr('add sub1')
870
908
        runbzr('move sub2/hello.txt sub1')
871
 
        assert not exists('sub2/hello.txt')
872
 
        assert exists('sub1/hello.txt')
 
909
        self.assert_(not exists('sub2/hello.txt'))
 
910
        self.assert_(exists('sub1/hello.txt'))
873
911
        runbzr('move sub2 sub1')
874
 
        assert not exists('sub2')
875
 
        assert exists('sub1/sub2')
 
912
        self.assert_(not exists('sub2'))
 
913
        self.assert_(exists('sub1/sub2'))
876
914
 
877
915
        runbzr(['commit', '-m', 'rename nested subdirectories'])
878
916
 
880
918
        self.assertEquals(capture('root')[:-1],
881
919
                          os.path.join(self.test_dir, 'branch1'))
882
920
        runbzr('move ../hello.txt .')
883
 
        assert exists('./hello.txt')
 
921
        self.assert_(exists('./hello.txt'))
884
922
        self.assertEquals(capture('relpath hello.txt'),
885
923
                          os.path.join('sub1', 'sub2', 'hello.txt') + '\n')
886
 
        assert capture('relpath ../../sub1/sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')
 
924
        self.assertEquals(capture('relpath ../../sub1/sub2/hello.txt'), os.path.join('sub1', 'sub2', 'hello.txt\n'))
887
925
        runbzr(['commit', '-m', 'move to parent directory'])
888
926
        chdir('..')
889
 
        assert capture('relpath sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')
 
927
        self.assertEquals(capture('relpath sub2/hello.txt'), os.path.join('sub1', 'sub2', 'hello.txt\n'))
890
928
 
891
929
        runbzr('move sub2/hello.txt .')
892
 
        assert exists('hello.txt')
 
930
        self.assert_(exists('hello.txt'))
893
931
 
894
932
        f = file('hello.txt', 'wt')
895
933
        f.write('some nice new content\n')
901
939
 
902
940
        runbzr('commit -F msg.tmp')
903
941
 
904
 
        assert capture('revno') == '5\n'
 
942
        self.assertEquals(capture('revno'), '5\n')
905
943
        runbzr('export -r 5 export-5.tmp')
906
944
        runbzr('export export.tmp')
907
945
 
910
948
        runbzr('log -v --forward')
911
949
        runbzr('log -m', retcode=1)
912
950
        log_out = capture('log -m commit')
913
 
        assert "this is my new commit\n  and" in log_out
914
 
        assert "rename nested" not in log_out
915
 
        assert 'revision-id' not in log_out
916
 
        assert 'revision-id' in capture('log --show-ids -m commit')
 
951
        self.assert_("this is my new commit\n  and" in log_out)
 
952
        self.assert_("rename nested" not in log_out)
 
953
        self.assert_('revision-id' not in log_out)
 
954
        self.assert_('revision-id' in capture('log --show-ids -m commit'))
917
955
 
918
956
        log_out = capture('log --line')
919
957
        for line in log_out.splitlines():
920
 
            assert len(line) <= 79, len(line)
921
 
        assert "this is my new commit and" in log_out
 
958
            self.assert_(len(line) <= 79, len(line))
 
959
        self.assert_("this is my new commit and" in log_out)
922
960
 
923
961
 
924
962
        progress("file with spaces in name")
925
963
        mkdir('sub directory')
926
964
        file('sub directory/file with spaces ', 'wt').write('see how this works\n')
927
965
        runbzr('add .')
928
 
        runbzr('diff')
 
966
        runbzr('diff', retcode=1)
929
967
        runbzr('commit -m add-spaces')
930
968
        runbzr('check')
931
969
 
941
979
            runbzr('init')
942
980
            os.symlink("NOWHERE1", "link1")
943
981
            runbzr('add link1')
944
 
            assert self.capture('unknowns') == ''
 
982
            self.assertEquals(self.capture('unknowns'), '')
945
983
            runbzr(['commit', '-m', '1: added symlink link1'])
946
984
    
947
985
            mkdir('d1')
948
986
            runbzr('add d1')
949
 
            assert self.capture('unknowns') == ''
 
987
            self.assertEquals(self.capture('unknowns'), '')
950
988
            os.symlink("NOWHERE2", "d1/link2")
951
 
            assert self.capture('unknowns') == 'd1/link2\n'
 
989
            self.assertEquals(self.capture('unknowns'), 'd1/link2\n')
952
990
            # is d1/link2 found when adding d1
953
991
            runbzr('add d1')
954
 
            assert self.capture('unknowns') == ''
 
992
            self.assertEquals(self.capture('unknowns'), '')
955
993
            os.symlink("NOWHERE3", "d1/link3")
956
 
            assert self.capture('unknowns') == 'd1/link3\n'
 
994
            self.assertEquals(self.capture('unknowns'), 'd1/link3\n')
957
995
            runbzr(['commit', '-m', '2: added dir, symlink'])
958
996
    
959
997
            runbzr('rename d1 d2')
960
998
            runbzr('move d2/link2 .')
961
999
            runbzr('move link1 d2')
962
 
            assert os.readlink("./link2") == "NOWHERE2"
963
 
            assert os.readlink("d2/link1") == "NOWHERE1"
 
1000
            self.assertEquals(os.readlink("./link2"), "NOWHERE2")
 
1001
            self.assertEquals(os.readlink("d2/link1"), "NOWHERE1")
964
1002
            runbzr('add d2/link3')
965
 
            runbzr('diff')
 
1003
            runbzr('diff', retcode=1)
966
1004
            runbzr(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
967
1005
    
968
1006
            os.unlink("link2")
969
1007
            os.symlink("TARGET 2", "link2")
970
1008
            os.unlink("d2/link1")
971
1009
            os.symlink("TARGET 1", "d2/link1")
972
 
            runbzr('diff')
973
 
            assert self.capture("relpath d2/link1") == "d2/link1\n"
 
1010
            runbzr('diff', retcode=1)
 
1011
            self.assertEquals(self.capture("relpath d2/link1"), "d2/link1\n")
974
1012
            runbzr(['commit', '-m', '4: retarget of two links'])
975
1013
    
976
1014
            runbzr('remove d2/link1')
977
 
            assert self.capture('unknowns') == 'd2/link1\n'
 
1015
            self.assertEquals(self.capture('unknowns'), 'd2/link1\n')
978
1016
            runbzr(['commit', '-m', '5: remove d2/link1'])
979
1017
            # try with the rm alias
980
1018
            runbzr('add d2/link1')
981
1019
            runbzr(['commit', '-m', '6: add d2/link1'])
982
1020
            runbzr('rm d2/link1')
983
 
            assert self.capture('unknowns') == 'd2/link1\n'
 
1021
            self.assertEquals(self.capture('unknowns'), 'd2/link1\n')
984
1022
            runbzr(['commit', '-m', '7: remove d2/link1'])
985
1023
    
986
1024
            os.mkdir("d1")
987
1025
            runbzr('add d1')
988
1026
            runbzr('rename d2/link3 d1/link3new')
989
 
            assert self.capture('unknowns') == 'd2/link1\n'
 
1027
            self.assertEquals(self.capture('unknowns'), 'd2/link1\n')
990
1028
            runbzr(['commit', '-m', '8: remove d2/link1, move/rename link3'])
991
1029
            
992
1030
            runbzr(['check'])
993
1031
            
994
1032
            runbzr(['export', '-r', '1', 'exp1.tmp'])
995
1033
            chdir("exp1.tmp")
996
 
            assert listdir_sorted(".") == [ "link1" ]
997
 
            assert os.readlink("link1") == "NOWHERE1"
 
1034
            self.assertEquals(listdir_sorted("."), [ "link1" ])
 
1035
            self.assertEquals(os.readlink("link1"), "NOWHERE1")
998
1036
            chdir("..")
999
1037
            
1000
1038
            runbzr(['export', '-r', '2', 'exp2.tmp'])
1001
1039
            chdir("exp2.tmp")
1002
 
            assert listdir_sorted(".") == [ "d1", "link1" ]
 
1040
            self.assertEquals(listdir_sorted("."), [ "d1", "link1" ])
1003
1041
            chdir("..")
1004
1042
            
1005
1043
            runbzr(['export', '-r', '3', 'exp3.tmp'])
1006
1044
            chdir("exp3.tmp")
1007
 
            assert listdir_sorted(".") == [ "d2", "link2" ]
1008
 
            assert listdir_sorted("d2") == [ "link1", "link3" ]
1009
 
            assert os.readlink("d2/link1") == "NOWHERE1"
1010
 
            assert os.readlink("link2")    == "NOWHERE2"
 
1045
            self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
 
1046
            self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
 
1047
            self.assertEquals(os.readlink("d2/link1"), "NOWHERE1")
 
1048
            self.assertEquals(os.readlink("link2")   , "NOWHERE2")
1011
1049
            chdir("..")
1012
1050
            
1013
1051
            runbzr(['export', '-r', '4', 'exp4.tmp'])
1014
1052
            chdir("exp4.tmp")
1015
 
            assert listdir_sorted(".") == [ "d2", "link2" ]
1016
 
            assert os.readlink("d2/link1") == "TARGET 1"
1017
 
            assert os.readlink("link2")    == "TARGET 2"
1018
 
            assert listdir_sorted("d2") == [ "link1", "link3" ]
 
1053
            self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
 
1054
            self.assertEquals(os.readlink("d2/link1"), "TARGET 1")
 
1055
            self.assertEquals(os.readlink("link2")   , "TARGET 2")
 
1056
            self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
1019
1057
            chdir("..")
1020
1058
            
1021
1059
            runbzr(['export', '-r', '5', 'exp5.tmp'])
1022
1060
            chdir("exp5.tmp")
1023
 
            assert listdir_sorted(".") == [ "d2", "link2" ]
1024
 
            assert os.path.islink("link2")
1025
 
            assert listdir_sorted("d2")== [ "link3" ]
 
1061
            self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
 
1062
            self.assert_(os.path.islink("link2"))
 
1063
            self.assert_(listdir_sorted("d2")== [ "link3" ])
1026
1064
            chdir("..")
1027
1065
            
1028
1066
            runbzr(['export', '-r', '8', 'exp6.tmp'])
1029
1067
            chdir("exp6.tmp")
1030
1068
            self.assertEqual(listdir_sorted("."), [ "d1", "d2", "link2"])
1031
 
            assert listdir_sorted("d1") == [ "link3new" ]
1032
 
            assert listdir_sorted("d2") == []
1033
 
            assert os.readlink("d1/link3new") == "NOWHERE3"
 
1069
            self.assertEquals(listdir_sorted("d1"), [ "link3new" ])
 
1070
            self.assertEquals(listdir_sorted("d2"), [])
 
1071
            self.assertEquals(os.readlink("d1/link3new"), "NOWHERE3")
1034
1072
            chdir("..")
1035
1073
        else:
1036
1074
            progress("skipping symlink tests")