-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path04merge-rename.t
130 lines (117 loc) · 5.46 KB
/
04merge-rename.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
#!/usr/bin/perl -w
use Test::More tests => 17;
use strict;
use File::Path;
use Cwd;
use SVK::Test;
my ($xd, $svk) = build_test();
our $output;
my ($copath, $corpath) = get_copath ('smerge-moved');
$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/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\nend\n");
$svk->add ("$copath/test.pl", "$copath/A", "$copath/B");
$svk->commit ('-m', 'init', "$copath");
$svk->cp ('-m', 'branch', '//trunk', '//local');
$svk->mv ('-m', 'move foo', '//trunk/A/foo', '//trunk/A/foo.new');
$svk->mv ('-m', 'move deep', '//trunk/A/deep', '//trunk/A/deep.new');
$svk->mv ('-m', 'move bar', '//trunk/A/bar', '//trunk/A/deep.new/bar');
$svk->mv ('-m', 'move test.pl on local', '//local/test.pl', '//local/A/deep/test.pl');
$svk->update ($copath);
append_file ("$copath/A/foo.new", "appended\n");
append_file ("$copath/A/deep.new/foo", "appended\n");
append_file ("$copath/A/deep.new/bar", "appended\n");
append_file ("$copath/test.pl", "appended\n");
append_file ("$copath/A/normal", "appended\n");
is_output ($svk, 'commit', ['-m', 'append to moved files', $copath],
['Committed revision 8.']);
is_output ($svk, 'merge', ['-C', '-r7:8', '//trunk', '//local'],
[' A/deep.new - skipped',
' A/deep.new/foo - skipped',
' A/deep.new/bar - skipped',
'U A/normal',
' A/foo.new - skipped',
' test.pl - skipped',
'5 files skipped, you might want to rerun merge with --track-rename.']);
is_output ($svk, 'merge', ['-C', '--track-rename', '-r7:8', '//trunk', '//local'],
['Collecting renames, this might take a while.',
'U A/deep.new/foo - A/deep/foo',
'U A/deep.new/bar - A/bar',
'U A/normal',
'U A/foo.new - A/foo',
'U test.pl - A/deep/test.pl']);
$svk->switch ('//local', $copath);
is_output ($svk, 'merge', ['-C', '--track-rename', '-r7:8', '//trunk', $copath],
['Collecting renames, this might take a while.',
__("U $copath/A/deep.new/foo")." - A/deep/foo",
__("U $copath/A/deep.new/bar")." - A/bar",
__("U $copath/A/normal"),
__("U $copath/A/foo.new")." - A/foo",
__("U $copath/test.pl")." - A/deep/test.pl"]);
is_output ($svk, 'merge', ['--track-rename', '-r7:8', '//trunk', $copath],
['Collecting renames, this might take a while.',
__("U $copath/A/deep.new/foo")." - A/deep/foo",
__("U $copath/A/deep.new/bar")." - A/bar",
__("U $copath/A/normal"),
__("U $copath/A/foo.new")." - A/foo",
__("U $copath/test.pl")." - A/deep/test.pl"]);
is_output ($svk, 'status', [$copath],
[__"M $copath/A/bar",
__"M $copath/A/deep/foo",
__"M $copath/A/deep/test.pl",
__"M $copath/A/foo",
__"M $copath/A/normal"], 'merge renamed entries to checkout');
$svk->revert ('-R', $copath);
overwrite_file ("$copath/A/deep/test.pl", "foobarbazzz\nfromlocal\nend\n");
is_output ($svk, 'commit', ['-m', 'append to moved files', $copath],
['Committed revision 9.']);
is_output ($svk, 'merge', ['-C', '-r8:9', '//local', '//trunk'],
[' A/deep - skipped',
' A/deep/test.pl - skipped',
'Empty merge.',
'2 files skipped, you might want to rerun merge with --track-rename.']);
is_output ($svk, 'merge', ['-C', '--track-rename', '-r8:9', '//local', '//trunk'],
['Collecting renames, this might take a while.',
'G A/deep/test.pl - test.pl']);
$svk->switch ('//trunk', $copath);
is_output ($svk, 'merge', ['--track-rename', '-r8:9', '//local', $copath],
['Collecting renames, this might take a while.',
__"G $copath/A/deep/test.pl - test.pl"]);
is_output ($svk, 'status', [$copath],
[__"M $copath/test.pl"], 'merge renamed entries to checkout');
$svk->revert ('-R', $copath);
$svk->cp ('-m', 'new trunk', '//trunk', '//trunk.new');
is_output ($svk, 'merge', ['-C', '--track-rename', '-r8:9', '//local', '//trunk.new'],
['Collecting renames, this might take a while.',
'G A/deep/test.pl - test.pl']);
overwrite_file ("$copath/test.pl", "fnord\nfoobarbazzz\nend\nappended\n");
is_output ($svk, 'commit', ['-m', 'append', $copath],
['Committed revision 11.']);
$svk->switch ('//local', $copath);
is_output ($svk, 'merge', ['--track-rename', '-r10:11', '//trunk', $copath],
['Collecting renames, this might take a while.',
__("G $copath/test.pl")." - A/deep/test.pl"]);
is_output ($svk, 'status', [$copath],
[__"M $copath/A/deep/test.pl"], 'merge renamed entries to checkout');
$svk->revert ('-R', $copath);
$svk->mkdir ('-m', 'new', "//trunk/A/new");
$svk->move ('-m', 'move normal to descent', "//trunk/A/deep.new", '//trunk/A/new/deep.new');
$svk->move ('-m', 'move normal to descent', "//trunk/A/normal", '//trunk/A/new/normal');
$svk->switch ('//trunk', $copath);
append_file ("$copath/A/new/deep.new/bar", "appended after rename\n");
append_file ("$copath/A/new/normal", "appended after rename\n");
is_output ($svk, 'commit', ['-m', 'append', $copath],
['Committed revision 15.']);
is_output ($svk, 'merge', ['-C', '--track-rename', '-r14:15', '//trunk', '//trunk.new'],
['Collecting renames, this might take a while.',
"U A/new/deep.new/bar - A/deep.new/bar",
"U A/new/normal - A/normal"]);