-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path05svm.t
228 lines (190 loc) · 8.42 KB
/
05svm.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#!/usr/bin/perl -w
use strict;
use Test::More;
use SVK::Test;
plan tests => 29;
our ($output, $answer);
# build another tree to be mirrored ourself
my ($xd, $svk) = build_test('test');
my $tree = create_basic_tree ($xd, '/test/');
my ($copath, $corpath) = get_copath ('svm');
my ($srepospath, $spath, $srepos) =$xd->find_repos ('/test/A', 1);
my $suuid = $srepos->fs->get_uuid;
$svk->copy ('-m', 'just make some more revisions', '/test/A', "/test/A-$_") for (1..20);
my $uri = uri($srepospath);
is_output ($svk, 'mirror', ['//m', $uri.($spath eq '/' ? '' : $spath)],
['Mirror initialized. Run svk sync //m to start mirroring.']);
is_output ($svk, 'mirror', [$uri.($spath eq '/' ? '' : $spath), '//m'],
['/m already exists.']);
is_output_like ($svk, 'mirror', [], qr'SYNOPSIS', 'add - help');
is_output ($svk, 'mirror', ['--upgrade'],
['nothing to upgrade']);
is_output ($svk, 'mirror', ['--upgrade', '//m'],
['nothing to upgrade']);
is_output ($svk, 'sync', ['//'],
['// is not a mirrored path.']);
is_output ($svk, 'sync', ['//what'],
['//what is not a mirrored path.']);
is_output ($svk, 'sync', ['/what/'],
["No such depot: what."]);
$svk->sync (-a => '/what/',
["No such depot: what."]);
$svk->sync ('//m');
$svk->copy ('-m', 'branch', '//m', '//l');
$svk->checkout ('//l', $copath);
ok (-e "$corpath/be");
append_file ("$copath/be", "from local branch of svm'ed directory\n");
mkdir "$copath/T/";
append_file ("$copath/T/xd", "local new file\n");
$svk->add ("$copath/T");
$svk->delete ("$copath/Q/qu");
$svk->commit ('-m', 'local modification from branch', "$copath");
$svk->merge (qw/-C -r 4:5/, '-m', 'merge back to remote', '//l', '//m');
$svk->merge (qw/-r 4:5/, '-m', 'merge back to remote', '//l', '//m');
$svk->sync ('//m');
#$svk->merge (qw/-r 5:6/, '//m', $copath);
$svk->switch ('//m', $copath);
$svk->update ($copath);
append_file ("$copath/T/xd", "back to mirror directly\n");
overwrite_file ("$copath/T/foo", "back to mirror directly\n");
$svk->add ("$copath/T/foo");
$svk->status ($copath);
is_output ($svk, 'commit', ['-m', 'commit to mirrored path', $copath],
['Commit into mirrored path: merging back directly.',
"Merging back to mirror source $uri/A.",
'Merge back committed as revision 24.',
"Syncing $uri/A",
'Retrieving log information from 24 to 24',
'Committed revision 7 from revision 24.']);
mkdir ("$copath/N");
$svk->add ("$copath/N");
is_output ($svk, 'commit', ['-m', 'commit to deep mirrored path', $copath],
['Commit into mirrored path: merging back directly.',
"Merging back to mirror source $uri/A.",
'Merge back committed as revision 25.',
"Syncing $uri/A",
'Retrieving log information from 25 to 25',
'Committed revision 8 from revision 25.']);
append_file ("$copath/T/xd", "back to mirror directly again\n");
$svk->commit ('-m', 'commit to deep mirrored path', "$copath/T/xd");
ok(1);
$svk->copy ('-m', 'branch in source', '/test/A', '/test/A-98');
$svk->copy ('-m', 'branch in source', '/test/A-98', '/test/A-99');
$svk->mirror ('//m-99', "$uri/A-99");
$svk->copy ('-m', 'make a copy', '//m-99', '//m-99-intermediate');
$svk->move ('-m', 'move the copy', '//m-99-intermediate', '//m-99-copy');
my ($copath2, $corpath2) = get_copath ('svm2');
$svk->checkout ('//m-99-copy', $copath2);
is_output($svk, 'update', ['--sync', '--merge', $copath2], [
"Syncing $uri/A-99",
'Retrieving log information from 1 to 28',
'Committed revision 13 from revision 28.',
'Auto-merging (0, 13) /m-99 to /m-99-copy (base /:0).',
'A Q',
'A Q/qz',
'A T',
'A T/foo',
'A T/xd',
'A be',
'A N',
"New merge ticket: $suuid:/A-99:28",
'Committed revision 14.',
"Syncing //m-99-copy(/m-99-copy) in $corpath2 to 14.",
__('A t/checkout/svm2/Q'),
__('A t/checkout/svm2/Q/qz'),
__('A t/checkout/svm2/T'),
__('A t/checkout/svm2/T/foo'),
__('A t/checkout/svm2/T/xd'),
__('A t/checkout/svm2/be'),
__('A t/checkout/svm2/N'), ]);
is_output($svk, 'smerge', ['-m', '', '--from', $copath2], [
"Auto-merging (0, 14) /m-99-copy to /m-99 (base /m-99:13).",
"Merging back to mirror source $uri/A-99.",
"Empty merge.",
]);
my ($copath3, $corpath3) = get_copath ('svm3');
$svk->checkout ('//m-99', $copath3);
append_file ("$copath3/T/xd", "modify something\n");
$svk->commit ('-m', 'local modification from mirrored path', "$copath3");
append_file ("$copath3/T/xd", "modify something again\n");
$svk->commit ('-m', 'local modification from mirrored path', "$copath3");
is_output($svk, 'update', ['--sync', '--merge', '--incremental', "$copath2/T"], [
"Syncing $uri/A-99",
'Auto-merging (13, 16) /m-99 to /m-99-copy (base /m-99:13).',
'===> Auto-merging (13, 15) /m-99 to /m-99-copy (base /m-99:13).',
'U T/xd',
"New merge ticket: $suuid:/A-99:29",
'Committed revision 17.',
'===> Auto-merging (15, 16) /m-99 to /m-99-copy (base /m-99:15).',
'U T/xd',
"New merge ticket: $suuid:/A-99:30",
'Committed revision 18.',
"Syncing //m-99-copy/T(/m-99-copy/T) in ".__("$corpath2/T to 18."),
__("U $copath2/T/xd"),
]);
is_output_like ($svk, 'mirror', ['--list'],
qr"//m.*\Q$uri\E/A\n//m-99.*\Q$uri\E/A-99");
is_output_like ($svk, 'mirror', ['//m-99', "$uri/A-99"],
qr"already", 'repeated mirror failed');
is_output_like ($svk, 'mirror', ['--detach', '//l'],
qr"not a mirrored", '--detach on non-mirrored path');
is_output_like ($svk, 'mirror', ['--detach', '//m/T'],
qr"inside", '--detach inside a mirrored path');
is_output ($svk, 'mirror', ['--detach', '//m'], [
"Mirror path '//m' detached.",
], '--detach on mirrored path');
is_output_like ($svk, 'mirror', ['--detach', '//m'],
qr"not a mirrored", '--detach on non-mirrored path');
is_output ($svk, 'mirror', ['//m', $uri.($spath eq '/' ? '' : $spath)],
['/m already exists.']);
$svk->copy ('-m', 'make a copy', '//m-99-copy', '//m-99-copy-twice');
my ($copath4, $corpath4) = get_copath ('svm4');
$svk->checkout ('//m-99-copy-twice', $copath4);
is_output($svk, 'update', ['--sync', '--merge', $copath4], [
"Syncing $uri/A-99",
'Auto-merging (16, 16) /m-99 to /m-99-copy-twice (base /m-99:16).',
"Empty merge.",
"Syncing //m-99-copy-twice(/m-99-copy-twice) in $corpath4 to 20.",
]);
is_output($svk, 'smerge', ['-m', '', '--sync', '--from', $copath4], [
"Auto-merging (0, 20) /m-99-copy-twice to /m-99 (base /m-99:16).",
"Merging back to mirror source $uri/A-99.",
"Empty merge.",
]);
is_output ($svk, 'delete', ['-m', 'die!', '//m-99'],
['Committed revision 22.']);
SKIP:{
skip 'recover not implemented.', 4;
$answer = 'y';
is_output ($svk, 'mirror', ['--recover', '//m'],
['Analyzing revision 19...',
'----------------------------------------------------------------------',
'SVM: discard mirror for /m',
'Analyzing revision 9...',
'----------------------------------------------------------------------',
'commit to deep mirrored path',
'Committed revision 23.',
'Committed revision 24.',
"Property 'svm:headrev' set on repository revision 24.",
"Property 'svn:author' set on repository revision 24.",
"Property 'svn:date' set on repository revision 24.",
"Property 'svn:log' set on repository revision 24.",
'Mirror state successfully recovered.',
'Committed revision 25.',
'//m added back to the list of mirrored paths.',
]);
is_output ($svk, 'mirror', ['--recover', '//m'],
['Analyzing revision 24...',
'----------------------------------------------------------------------',
'commit to deep mirrored path',
'No need to revert; it is already the head revision.',
]);
$svk->mv (-m => 'move on mirror', '//m/Q' => '//m/Q-moved');
is_ancestor ($svk, '//m/Q-moved', '/m/Q', 6);
is_output ($svk, 'ps', ['foo' => 'bar', -m => 'ps on mirror', '//m/Q-moved'],
["Merging back to mirror source $uri/A.",
'Merge back committed as revision 32.',
"Syncing $uri/A",
'Retrieving log information from 32 to 32',
'Committed revision 27 from revision 32.']);
}