-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path07smerge-delete.t
241 lines (214 loc) · 7.22 KB
/
07smerge-delete.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
229
230
231
232
233
234
235
236
237
238
239
240
#!/usr/bin/perl -w
use Test::More tests => 25;
use strict;
use File::Path;
use Cwd;
use SVK::Test;
my ($xd, $svk) = build_test();
our $output;
our ($copath, $corpath) = get_copath ('smerge-delete');
$svk->mkdir ('-m', 'trunk', '//trunk');
$svk->checkout ('//trunk', $copath);
my ($repospath, undef, $repos) = $xd->find_repos ('//', 1);
my $uuid = $repos->fs->get_uuid;
mkdir "$copath/A";
mkdir "$copath/A/deep";
mkdir "$copath/A/deep/stay";
mkdir "$copath/A/deep/deeper";
mkdir "$copath/B";
overwrite_file ("$copath/A/foo", "foobar\n");
overwrite_file ("$copath/A/deep/foo", "foobar\n");
overwrite_file ("$copath/A/bar", "foobar\n");
overwrite_file ("$copath/A/normal", "foobar\n");
overwrite_file ("$copath/test.pl", "foobarbazzz\n");
$svk->add ("$copath/test.pl", "$copath/A", "$copath/B");
$svk->commit ('-m', 'init', "$copath");
$svk->cp ('-m', 'branch', '//trunk', '//local');
$svk->rm ('-m', 'rm A on trunk', '//trunk/A');
$svk->rm ('-m', 'rm B on trunk', '//trunk/B');
append_file ("$copath/A/foo", "modified\n");
overwrite_file ("$copath/A/unused", "foobar\n");
my $oldwd = getcwd;
chdir ($copath);
is_output ($svk, 'up', [],
["Syncing //trunk(/trunk) in $corpath to 5.",
__('C A'),
__('D A/bar'),
__('D A/deep'),
__('C A/foo'),
__('D A/normal'),
__('C A/unused'),
__('D B'),
'3 conflicts found.'
], 'delete entry but modified on checkout');
chdir ($oldwd);
ok (-e "$copath/A/foo", 'local file not deleted');
ok (-e "$copath/A/unused", 'unversioned file not deleted');
ok (!-e "$copath/A/bar", 'delete merged');
ok (!-e "$copath/B/foo", 'unmodified dir deleted');
$svk->resolved ('-R', "$copath/A");
rmtree (["$copath/A"]);
$svk->switch ('//local', $copath);
append_file ("$copath/A/foo", "modified\n");
overwrite_file ("$copath/A/unused", "foobar\n");
is_output ($svk, 'smerge', ['//trunk', $copath],
['Auto-merging (2, 5) /trunk to /local (base /trunk:2).',
__"C $copath/A",
__"D $copath/A/bar",
__"D $copath/A/deep",
__"C $copath/A/foo",
__"D $copath/A/normal",
__"C $copath/A/unused",
__"D $copath/B",
"New merge ticket: $uuid:/trunk:5",
'3 conflicts found.'
]);
is_output ($svk, 'st', [$copath],
[
__"C $copath/A/foo",
__"C $copath/A/unused",
__"D $copath/A/bar",
__"D $copath/A/deep",
__"D $copath/A/deep/deeper",
__"D $copath/A/deep/foo",
__"D $copath/A/deep/stay",
__"D $copath/A/normal",
__"C $copath/A",
__"D $copath/B",
__" M $copath",
]);
ok (-e "$copath/A/unused", 'unversioned file not deleted');
ok (-e "$copath/A/foo", 'local file not deleted');
ok (!-e "$copath/B/foo", 'unmodified dir deleted');
$svk->revert ('-R', $copath);
is_output ($svk, 'st', [$copath],
[__"? $copath/A/unused"]);
append_file ("$copath/A/foo", "modified\n");
overwrite_file ("$copath/A/unused", "foobar\n");
$svk->add ("$copath/A/unused");
$svk->rm ("$copath/A/bar");
$svk->rm ("$copath/A/deep/deeper");
is_output ($svk, 'commit', ['-m', 'local modification', $copath],
['Committed revision 6.']);
is_output ($svk, 'smerge', ['-C', '//trunk', '//local'],
['Auto-merging (2, 5) /trunk to /local (base /trunk:2).',
'C A',
'D A/bar',
'D A/deep',
'C A/foo',
'D A/normal',
'C A/unused',
'D B',
"New merge ticket: $uuid:/trunk:5",
'Empty merge.',
'3 conflicts found.']);
is_output ($svk, 'smerge', ['//trunk', $copath],
['Auto-merging (2, 5) /trunk to /local (base /trunk:2).',
__"C $copath/A",
__"D $copath/A/bar",
__"D $copath/A/deep",
__"C $copath/A/foo",
__"D $copath/A/normal",
__"C $copath/A/unused",
__"D $copath/B",
"New merge ticket: $uuid:/trunk:5",
'3 conflicts found.']);
is_output ($svk, 'status', [$copath],
[__"D $copath/A/deep",
__"D $copath/A/deep/foo",
__"D $copath/A/deep/stay",
__"C $copath/A/foo",
__"D $copath/A/normal",
__"C $copath/A/unused",
__"C $copath/A",
__"D $copath/B",
__" M $copath"], 'merge partial deletes to checkout');
$svk->revert ('-R', $copath);
$svk->resolved ('-R', $copath);
overwrite_file ("$copath/A/deep/foo", "bah foobar\n");
$svk->commit ('-m', 'local modification', $copath);
is_output ($svk, 'smerge', ['-C', '//trunk', '//local'],
['Auto-merging (2, 5) /trunk to /local (base /trunk:2).',
'C A',
'D A/bar',
'C A/deep',
'D A/deep/deeper',
'C A/deep/foo',
'D A/deep/stay',
'C A/foo',
'D A/normal',
'C A/unused',
'D B',
"New merge ticket: $uuid:/trunk:5",
'Empty merge.',
'5 conflicts found.']);
is_output ($svk, 'smerge', ['//trunk', $copath],
['Auto-merging (2, 5) /trunk to /local (base /trunk:2).',
__"C $copath/A",
__"D $copath/A/bar",
__"C $copath/A/deep",
__"D $copath/A/deep/deeper",
__"C $copath/A/deep/foo",
__"D $copath/A/deep/stay",
__"C $copath/A/foo",
__"D $copath/A/normal",
__"C $copath/A/unused",
__"D $copath/B",
"New merge ticket: $uuid:/trunk:5",
'5 conflicts found.']);
is_output ($svk, 'status', [$copath],
[__"C $copath/A/deep/foo",
__"D $copath/A/deep/stay",
__"C $copath/A/deep",
__"C $copath/A/foo",
__"D $copath/A/normal",
__"C $copath/A/unused",
__"C $copath/A",
__"D $copath/B",
__" M $copath"], 'merge partial deletes to checkout');
$svk->resolved ('-R', $copath);
$svk->commit ('-m', 'merged', $copath);
$svk->rm ('-m', 'kill test.pl', '//trunk/test.pl');
is_output ($svk, 'smerge', ['//trunk', $copath],
['Auto-merging (5, 9) /trunk to /local (base /trunk:5).',
__"D $copath/test.pl",
"New merge ticket: $uuid:/trunk:9"]);
is_output ($svk, 'status', [$copath],
[__"D $copath/test.pl",
__" M $copath"]);
$svk->revert ('-R', $copath);
overwrite_file ("$copath/test.pl", "modified\n");
is_output ($svk, 'smerge', ['//trunk', $copath],
['Auto-merging (5, 9) /trunk to /local (base /trunk:5).',
__"C $copath/test.pl",
"New merge ticket: $uuid:/trunk:9",
'1 conflict found.']);
$svk->revert ('-R', $copath);
$svk->mkdir ('-m', 'new dir C on trunk', '//trunk/C');
is_output ($svk, 'smerge', ['-m', 'merge down clean', '//trunk', '//local'],
['Auto-merging (5, 10) /trunk to /local (base /trunk:5).',
"A C",
"D test.pl",
"New merge ticket: $uuid:/trunk:10",
'Committed revision 11.']);
$svk->update ($copath);
my $unversioned = "$copath/C/unversioned.txt";
overwrite_file ($unversioned, "I am here\n");
$svk->rm ('-m', 'rm C on trunk', '//trunk/C');
is_output ($svk, 'smerge', ['//trunk', $copath],
['Auto-merging (10, 12) /trunk to /local (base /trunk:10).',
status_native ($copath,
'C ', "C",
'C ', "C/unversioned.txt"),
"New merge ticket: $uuid:/trunk:12",
'2 conflicts found.']);
ok (-e $unversioned, 'unversioned file not deleted');
$svk->revert(-R => $copath);
$svk->switch('//local', $copath);
$svk->rm("$copath/A/foo");
$svk->mkdir("$copath/A/foo");
$svk->rm(-m => 'hate', '//local/A/foo');
is_output($svk, 'up', [$copath],
['Syncing //local(/local) in '.__($corpath).' to 13.',
__("C $copath/A/foo"),
'1 conflict found.']);