-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathuri-escape-dav-move.t
140 lines (114 loc) · 4.77 KB
/
uri-escape-dav-move.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/perl -w
use strict;
# XXX: apache::test seems to alter inc to use blib
require SVK::Command::Merge;
use POSIX qw(setlocale LC_CTYPE);
# XXX: apache::TestConfig assumes lib.pm is compiled.
require lib;
use SVK::Util qw(can_run uri_escape $EOL);
BEGIN {
use SVK::Test;
plan (skip_all => "Test does not run under root") if $> == 0;
eval { require Apache2 };
eval { require Apache::Test;
$Apache::Test::VERSION >= 1.18 }
or plan (skip_all => "Apache::Test 1.18 required for testing dav");
}
setlocale (LC_CTYPE, $ENV{LC_CTYPE} = 'en_US.UTF-8')
or plan skip_all => 'cannot set locale to en_US.UTF-8';
use Apache::TestConfig;
use File::Spec::Functions qw(rel2abs catdir catfile);
our $output;
my ($xd, $svk) = build_test('test');
my $depotpath = '/test/';
my $pool = SVN::Pool->new_default;
my ($depot, $path) = $xd->find_depotpath($depotpath);
{
local $/ = $EOL;
my $edit = get_editor ($depot->repospath, $path, $depot->repos);
$edit->open_root ();
$edit->add_directory ('/B and K');
$edit->add_directory ('/B and K/A');
$edit->add_directory ('/B and K/A/N P1');
$edit->add_directory ('/B and K/A/N P1/trunk');
$edit->add_directory ('/B and K/A/N P1/trunk/doc');
$edit->modify_file (
$edit->add_file ('/B and K/A/N P1/trunk/doc/ReadMe.txt'),
"first line in pe$/2nd line in pe$/");
$edit->add_directory ('/B and K/A/N P1/trunk/src');
$edit->add_directory ('/B and K/A/N P1/trunk/data');
$edit->modify_file (
$edit->add_file ('/B and K/A/N P1/trunk/data/N M/HOWTO.txt'),
"first line in pe$/2nd line in pe$/");
$edit->add_directory ('/B and K/A/N P1/branches');
$edit->add_directory ('/B and K/A/N P1/tags');
$edit->close_edit ();
}
my ($srepospath, $spath, $srepos) = $xd->find_repos ('/test/B and K', 1);
my (undef, undef, $repos) = $xd->find_repos ('//', 1);
my $apache_root = rel2abs (catdir ('t', 'apache_svn'));
my $apxs = $ENV{APXS} || can_run('apxs2') || can_run ('apxs');
plan skip_all => "Can't find apxs utility. Use APXS env to specify path" unless $apxs;
my $cfg = Apache::TestConfig->new
( top_dir => $apache_root,
t_dir => $apache_root,
apxs => $apxs,
)->httpd_config;
plan skip_all => "apache 2.2 changed auth directives."
if $cfg->server->{version} =~ m|Apache/2\.2|;
unless ($cfg->can('find_and_load_module') and
$cfg->find_and_load_module ('mod_dav.so') and
$cfg->find_and_load_module ('mod_dav_svn.so') and
$cfg->find_and_load_module ('mod_authz_svn.so')) {
plan skip_all => "Can't find mod_dav_svn and mod_authz_svn";
}
plan tests => 5;
$cfg->postamble (Location => "/svn",
qq{DAV svn\n SVNPath $depot->{repospath}\n});
$cfg->generate_httpd_conf;
my $server = $cfg->server;
$server->start;
ok ($server->ping, 'server is alive');
my $uri = 'http://'.$server->{name}.'/svn';
my $uri_trunk = $uri.'/B and K/A/N P1/trunk';
my $uri_trunk_escape = uri_escape($uri_trunk);
$svk->mirror('//mirror/BK', $uri_trunk);
is_output ($svk, 'mirror', ['--list'], [
"Path Source",
"============================================================",
"//mirror/BK $uri/B and K/A/N P1/trunk"]);
is_output ($svk, 'sync', ['//mirror/BK'], [
"Syncing $uri/B and K/A/N P1/trunk",
"Retrieving log information from 1 to 1",
"Committed revision 2 from revision 1."]);
$svk->copy ('-p', '-m', 'branch', '//mirror/BK', '//local/BK');
my ($copath, $corpath) = get_copath('uri-escape-dav-move');
my ($scopath, $scorpath) = get_copath('uri-escape-dav-move-source');
$svk->checkout ('//local/BK', $copath);
chdir($copath);
#ref => #28087 on rt.cpan.org
$svk->move("data/N M/HOWTO.txt", "data/N M/good.txt");
$svk->commit ('-m', 'commit on local branch');
$svk->sync ('//mirror/BK');
is_output ($svk, 'push', ['-C'],
['Auto-merging (0, 4) /local/BK to /mirror/BK (base /mirror/BK:2).',
'===> Auto-merging (0, 3) /local/BK to /mirror/BK (base /mirror/BK:2).',
'Empty merge.',
'===> Auto-merging (3, 4) /local/BK to /mirror/BK (base /mirror/BK:2).',
'A + data/N M/good.txt',
'D data/N M/HOWTO.txt',
qr'New merge ticket: .*:/local/BK:4']);
is_output ($svk, 'push', [''],
['Auto-merging (0, 4) /local/BK to /mirror/BK (base /mirror/BK:2).',
'===> Auto-merging (0, 3) /local/BK to /mirror/BK (base /mirror/BK:2).',
qr'Merging back to mirror source http://[^/]+/svn/B and K/A/N P1/trunk.',
'Empty merge.',
'===> Auto-merging (3, 4) /local/BK to /mirror/BK (base /mirror/BK:2).',
qr'Merging back to mirror source http://[^/]+/svn/B and K/A/N P1/trunk.',
'A + data/N M/good.txt',
'D data/N M/HOWTO.txt',
qr'New merge ticket: .*:/local/BK:4',
'Merge back committed as revision 2.',
qr'Syncing http://[^/]+/svn/B and K/A/N P1/trunk',
'Retrieving log information from 2 to 2',
'Committed revision 5 from revision 2.']);