~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/tests/cmdline/trans_tests.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
# Set the property keyword for PATH.  Turn on all possible keywords.
192
192
### todo: Later, take list of keywords to set.
193
193
def keywords_on(path):
194
 
  svntest.actions.run_and_verify_svn(None, None, [], 'propset',
 
194
  svntest.actions.run_and_verify_svn(None, [], 'propset',
195
195
                                     "svn:keywords",
196
196
                                     "Author Rev Date URL Id Header",
197
197
                                     path)
199
199
# Delete property NAME from versioned PATH in the working copy.
200
200
### todo: Later, take list of keywords to remove from the propval?
201
201
def keywords_off(path):
202
 
  svntest.actions.run_and_verify_svn(None, None, [], 'propdel',
 
202
  svntest.actions.run_and_verify_svn(None, [], 'propdel',
203
203
                                     "svn:keywords", path)
204
204
 
205
205
 
298
298
    })
299
299
 
300
300
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
301
 
                                        None, None, wc_dir)
 
301
                                        None)
302
302
 
303
303
  # Make sure the unexpanded URL keyword got expanded correctly.
304
304
  fp = open(url_unexp_path, 'r')
449
449
# This is a slight rewrite of his test, to use the run_and_verify_* API.
450
450
# This is for issue #631.
451
451
 
452
 
def do_nothing(x, y):
453
 
  return 0
454
 
 
455
452
@Issue(631)
456
453
def update_modified_with_translation(sbox):
457
454
  "update modified file with eol-style 'native'"
462
459
  # Replace contents of rho and set eol translation to 'native'
463
460
  rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
464
461
  svntest.main.file_write(rho_path, "1\n2\n3\n4\n5\n6\n7\n8\n9\n")
465
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
462
  svntest.actions.run_and_verify_svn(None, [],
466
463
                                     'propset', 'svn:eol-style', 'native',
467
464
                                     rho_path)
468
465
 
479
476
  svntest.actions.run_and_verify_commit(wc_dir,
480
477
                                        expected_output,
481
478
                                        expected_status,
482
 
                                        None, rho_path)
 
479
                                        [], rho_path)
483
480
 
484
481
  # Change rho again
485
482
  svntest.main.file_write(rho_path, "1\n2\n3\n4\n4.5\n5\n6\n7\n8\n9\n")
491
488
  svntest.actions.run_and_verify_commit(wc_dir,
492
489
                                        expected_output,
493
490
                                        expected_status,
494
 
                                        None, rho_path)
 
491
                                        [], rho_path)
495
492
 
496
493
  # Locally modify rho again.
497
494
  svntest.main.file_write(rho_path, "1\n2\n3\n4\n4.5\n5\n6\n7\n8\n9\n10\n")
515
512
                                          "8",
516
513
                                          "9",
517
514
                                          "10",
 
515
                                          "||||||| .r3",
 
516
                                          "1",
 
517
                                          "2",
 
518
                                          "3",
 
519
                                          "4",
 
520
                                          "4.5",
 
521
                                          "5",
 
522
                                          "6",
 
523
                                          "7",
 
524
                                          "8",
 
525
                                          "9",
518
526
                                          "=======",
519
527
                                          "This is the file 'rho'.",
520
528
                                          ">>>>>>> .r1",
522
530
 
523
531
  # Updating back to revision 1 should not error; the merge should
524
532
  # work, with eol-translation turned on.
 
533
  extra_files = ['rho.r1', 'rho.r3', 'rho.mine']
525
534
  svntest.actions.run_and_verify_update(wc_dir,
526
535
                                        expected_output,
527
536
                                        expected_disk,
528
 
                                        None, None,
529
 
                                        do_nothing, None,
530
 
                                        None, None,
531
 
                                        0, '-r', '1', wc_dir)
 
537
                                        None,
 
538
                                        [], False,
 
539
                                        '-r', '1', wc_dir,
 
540
                                        extra_files=extra_files)
532
541
 
533
542
 
534
543
#----------------------------------------------------------------------
559
568
  f.close()
560
569
 
561
570
  # commit the file
562
 
  svntest.actions.run_and_verify_svn(None, None, [], 'add', foo_path)
563
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
571
  svntest.actions.run_and_verify_svn(None, [], 'add', foo_path)
 
572
  svntest.actions.run_and_verify_svn(None, [],
564
573
                                     'ci', '-m', 'log msg',
565
574
                                     foo_path)
566
575
 
567
576
  if svntest.main.windows:
568
 
    svntest.actions.run_and_verify_svn(None, None, [], 'propset',
 
577
    svntest.actions.run_and_verify_svn(None, [], 'propset',
569
578
                                       'svn:eol-style', 'LF', foo_path)
570
579
  else:
571
 
    svntest.actions.run_and_verify_svn(None, None, [], 'propset',
 
580
    svntest.actions.run_and_verify_svn(None, [], 'propset',
572
581
                                       'svn:eol-style', 'CRLF', foo_path)
573
582
 
574
583
  # check 1: did new contents get transmitted?
575
584
  expected_output = ["Sending        " + foo_path + "\n",
576
 
                     "Transmitting file data .\n",
 
585
                     "Transmitting file data .done\n",
 
586
                     "Committing transaction...\n",
577
587
                     "Committed revision 3.\n"]
578
 
  svntest.actions.run_and_verify_svn(None, expected_output, [],
 
588
  svntest.actions.run_and_verify_svn(expected_output, [],
579
589
                                     'ci', '-m', 'log msg', foo_path)
580
590
 
581
591
  # check 2: do the files have the right contents now?
605
615
  # The bug didn't occur if there were multiple files in the
606
616
  # directory, so setup an empty directory.
607
617
  Z_path = os.path.join(wc_dir, 'Z')
608
 
  svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', Z_path)
 
618
  svntest.actions.run_and_verify_svn(None, [], 'mkdir', Z_path)
609
619
 
610
620
  # Add the file that has the keyword to be expanded
611
621
  url_path = os.path.join(Z_path, 'url')
612
622
  svntest.main.file_append(url_path, "$URL$")
613
 
  svntest.actions.run_and_verify_svn(None, None, [], 'add', url_path)
 
623
  svntest.actions.run_and_verify_svn(None, [], 'add', url_path)
614
624
  keywords_on(url_path)
615
625
 
616
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
626
  svntest.actions.run_and_verify_svn(None, [],
617
627
                                     'ci', '-m', 'log msg', wc_dir)
618
628
 
619
629
  other_wc_dir = sbox.add_wc_path('other')
620
630
  other_url_path = os.path.join(other_wc_dir, 'Z', 'url')
621
 
  svntest.actions.run_and_verify_svn(None, None, [], 'checkout',
 
631
  svntest.actions.run_and_verify_svn(None, [], 'checkout',
622
632
                                     sbox.repo_url,
623
633
                                     other_wc_dir)
624
634
 
645
655
 
646
656
  # Set up A/mu to do $Rev$ keyword expansion
647
657
  svntest.main.file_append(mu_path , "$Rev$\n$Author$")
648
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
658
  svntest.actions.run_and_verify_svn(None, [],
649
659
                                     'propset', 'svn:keywords', 'Rev Author',
650
660
                                     mu_path)
651
661
 
655
665
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
656
666
  expected_status.tweak('A/mu', wc_rev=2)
657
667
  svntest.actions.run_and_verify_commit(wc_dir,
658
 
                                        expected_output, expected_status,
659
 
                                        None, wc_dir)
 
668
                                        expected_output, expected_status)
660
669
 
661
670
  # Change the author to value which will get truncated on expansion
662
671
  full_author = "x" * 400
663
672
  key_author = "x" * 244
664
673
  svntest.actions.enable_revprop_changes(sbox.repo_dir)
665
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
674
  svntest.actions.run_and_verify_svn(None, [],
666
675
                                     'propset', '--revprop', '-r2',
667
676
                                     'svn:author', full_author,
668
677
                                     sbox.wc_dir)
669
 
  svntest.actions.run_and_verify_svn(None, [ full_author ], [],
 
678
  svntest.actions.run_and_verify_svn([ full_author ], [],
670
679
                                     'propget', '--revprop', '-r2',
671
 
                                     'svn:author', '--strict',
 
680
                                     'svn:author', '--no-newline',
672
681
                                     sbox.wc_dir)
673
682
 
674
683
  # Make another commit so that the last changed revision for A/mu is
675
684
  # not HEAD.
676
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
685
  svntest.actions.run_and_verify_svn(None, [],
677
686
                                     'propset', 'foo', 'bar', lambda_path)
678
687
  expected_output = wc.State(wc_dir, {
679
688
    'A/B/lambda' : Item(verb='Sending'),
680
689
    })
681
690
  expected_status.tweak('A/B/lambda', wc_rev=3)
682
691
  svntest.actions.run_and_verify_commit(wc_dir,
683
 
                                        expected_output, expected_status,
684
 
                                        None, wc_dir)
 
692
                                        expected_output, expected_status)
685
693
 
686
694
  # At one stage the keywords were expanded to values for the requested
687
695
  # revision, not to those committed revision
688
 
  svntest.actions.run_and_verify_svn(None,
689
 
                                     [ "This is the file 'mu'.\n",
 
696
  svntest.actions.run_and_verify_svn([ "This is the file 'mu'.\n",
690
697
                                       "$Rev: 2 $\n",
691
698
                                       "$Author: " + key_author + " $"], [],
692
699
                                     'cat', '-r', 'HEAD', mu_path)
702
709
  mu2_path = os.path.join(wc_dir, 'A', 'mu2')
703
710
 
704
711
  # Copy and propset
705
 
  svntest.actions.run_and_verify_svn(None, None, [], 'copy', mu_path, mu2_path)
706
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
712
  svntest.actions.run_and_verify_svn(None, [], 'copy', mu_path, mu2_path)
 
713
  svntest.actions.run_and_verify_svn(None, [],
707
714
                                     'propset', 'svn:eol-style', 'native',
708
715
                                     mu2_path)
709
716
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
718
725
    })
719
726
  expected_status.tweak('A/mu2', status='  ', wc_rev=2, copied=None)
720
727
  svntest.actions.run_and_verify_commit(wc_dir,
721
 
                                        expected_output, expected_status,
722
 
                                        None, wc_dir)
 
728
                                        expected_output, expected_status)
723
729
 
724
730
#----------------------------------------------------------------------
725
731
#      Create a greek tree, commit a keyword into one file,
741
747
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
742
748
  expected_status.tweak('A/mu', wc_rev=2)
743
749
  svntest.actions.run_and_verify_commit(wc_dir,
744
 
                                        expected_output, expected_status,
745
 
                                        None, wc_dir)
 
750
                                        expected_output, expected_status)
746
751
 
747
752
  # Set property to do keyword expansion on A/mu, commit.
748
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
753
  svntest.actions.run_and_verify_svn(None, [],
749
754
                                     'propset', 'svn:keywords', 'Rev', mu_path)
750
755
  expected_output = wc.State(wc_dir, {
751
756
    'A/mu' : Item(verb='Sending'),
753
758
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
754
759
  expected_status.tweak('A/mu', wc_rev=3)
755
760
  svntest.actions.run_and_verify_commit(wc_dir,
756
 
                                        expected_output, expected_status,
757
 
                                        None, wc_dir)
 
761
                                        expected_output, expected_status)
758
762
 
759
763
  # Check out into another wc dir
760
764
  other_wc_dir = sbox.add_wc_path('other')
761
765
  mu_other_path = os.path.join(other_wc_dir, 'A', 'mu')
762
766
 
763
 
  svntest.actions.run_and_verify_svn(None, None, [], 'checkout',
 
767
  svntest.actions.run_and_verify_svn(None, [], 'checkout',
764
768
                                     sbox.repo_url,
765
769
                                     other_wc_dir)
766
770
 
783
787
  # Set the Rev keyword for the mu file
784
788
  # could use the keywords_on()/keywords_off() functions to
785
789
  # set/del all svn:keywords
786
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
790
  svntest.actions.run_and_verify_svn(None, [],
787
791
                                     'propset', 'svn:keywords', 'Rev', mu_path)
788
792
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
789
793
  expected_status.tweak('A/mu', status=' M')
790
794
  svntest.actions.run_and_verify_status(wc_dir, expected_status)
791
795
 
792
796
  # Revert the propset
793
 
  svntest.actions.run_and_verify_svn(None, None, [], 'revert', mu_path)
 
797
  svntest.actions.run_and_verify_svn(None, [], 'revert', mu_path)
794
798
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
795
799
  svntest.actions.run_and_verify_status(wc_dir, expected_status)
796
800
 
822
826
 
823
827
  svntest.actions.run_and_verify_commit(wc_dir,
824
828
                                        expected_output,
825
 
                                        expected_status,
826
 
                                        None,
827
 
                                        wc_dir)
 
829
                                        expected_status)
828
830
 
829
831
  # Create r3 that drops svn:keywords
830
832
 
837
839
 
838
840
  svntest.actions.run_and_verify_commit(wc_dir,
839
841
                                        expected_output,
840
 
                                        expected_status,
841
 
                                        None,
842
 
                                        wc_dir)
 
842
                                        expected_status)
843
843
 
844
844
  # Now, go back to r2. iota should have the Author keyword expanded.
845
845
  expected_disk = svntest.main.greek_state.copy()
849
849
 
850
850
  svntest.actions.run_and_verify_update(wc_dir,
851
851
                                        None, None, expected_status,
852
 
                                        None,
853
 
                                        None, None, None, None,
854
 
                                        False,
 
852
                                        [], False,
855
853
                                        wc_dir, '-r', '2')
856
854
 
857
855
  if open(iota_path).read() != ''.join(content_expanded):
864
862
  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
865
863
 
866
864
  svntest.actions.run_and_verify_update(wc_dir,
867
 
                                        None, expected_disk, expected_status,
868
 
                                        None,
869
 
                                        None, None, None, None,
870
 
                                        False,
871
 
                                        wc_dir)
 
865
                                        None, expected_disk, expected_status)
872
866
 
873
867
  if open(iota_path).read() != ''.join(content):
874
868
    raise svntest.Failure("$Author$ is not contracted in 'iota'")
905
899
  sbox.simple_add_text(text, 'add.c')
906
900
  sbox.simple_add_text(text, 'add-force.c')
907
901
 
908
 
  svntest.actions.run_and_verify_svn(None, None, '.*inconsistent newlines.*',
 
902
  svntest.actions.run_and_verify_svn(None, '.*inconsistent newlines.*',
909
903
                                     'ps', 'svn:eol-style', 'native',
910
904
                                     sbox.ospath('add.c'))
911
905
 
912
 
  svntest.actions.run_and_verify_svn(None, None, [],
 
906
  svntest.actions.run_and_verify_svn(None, [],
913
907
                                     'ps', 'svn:eol-style', 'native', '--force',
914
908
                                     sbox.ospath('add.c'))
915
909
 
931
925
  expected_output = ['A         %s\n' % sbox.ospath('auto.c')]
932
926
 
933
927
  # Fails with svn: E200009: File '.*auto.c' has inconsistent newlines
934
 
  svntest.actions.run_and_verify_svn(None, expected_output,
 
928
  svntest.actions.run_and_verify_svn(expected_output,
935
929
                                     [], 'add', sbox.ospath('auto.c'))
936
930
 
937
931
@XFail()
950
944
  expected_output = ['A         %s\n' % sbox.ospath('c.iota.c')]
951
945
 
952
946
  # Fails with svn: E200009: File '.*c.iota.c' has binary mime type property
953
 
  svntest.actions.run_and_verify_svn(None, expected_output,
 
947
  svntest.actions.run_and_verify_svn(expected_output,
954
948
                                     [], 'add', sbox.ospath('c.iota.c'))
955
949
 
956
950