-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path07smerge-rename3.t
138 lines (113 loc) · 4.08 KB
/
07smerge-rename3.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
#!/usr/bin/perl -w
#
# Tests that smerge handles updates after renames have been made
#
use Test::More tests => 11;
use strict;
use File::Path;
use Cwd;
use SVK::Test;
my ($xd, $svk) = build_test();
our ($answer, $output);
my ($co_trunk_rpath, $co_trunk_path) = get_copath ('smerge-rename3-trunk');
my ($co_branch_rpath, $co_branch_path) = get_copath ('smerge-rename3-branch');
my ($repospath, undef, $repos) = $xd->find_repos ('//', 1);
my $uuid = $repos->fs->get_uuid;
# Setup the trunk
$svk->mkdir ('-m', 'trunk', '//trunk');
$svk->checkout ('//trunk', $co_trunk_path);
# Create some data in trunk
chdir($co_trunk_path);
$svk->mkdir('module');
overwrite_file('module/test.txt', '1');
$svk->add('module/test.txt');
$svk->ci(-m => "test 1");
# Make a copy
$svk->mkdir ('-m', 'branches', '//branches');
$svk->cp(-m => 'newbranch', '//trunk', '//branches/newbranch');
$svk->checkout ('//branches/newbranch', $co_branch_path);
is_file_content("$co_branch_path/module/test.txt", '1');
# Rename the module in the branch
chdir($co_branch_path);
$svk->move('module', 'module2');
$svk->commit(-m => "renamed");
# Make a change to trunk
chdir($co_trunk_path);
overwrite_file('module/test.txt', '2');
$svk->ci(-m => "test 2");
# Merge changes w/rename from trunk to branch
is_output ($svk, 'smerge', ['//trunk', '//branches/newbranch', '--track-rename', '-m', 'merge 1'], [
'Auto-merging (2, 6) /trunk to /branches/newbranch (base /trunk:2).',
'Collecting renames, this might take a while.',
'U module/test.txt - module2/test.txt',
"New merge ticket: $uuid:/trunk:6",
'Committed revision 7.',
]);
# Update the branch
chdir($co_branch_path);
$svk->update();
is_file_content('module2/test.txt', '2');
# Make another change to trunk
chdir($co_trunk_path);
overwrite_file('module/test.txt', '3');
$svk->ci(-m => "test 3");
# Merge changes w/rename from trunk to branch
is_output ($svk, 'smerge', ['//trunk', '//branches/newbranch', '--track-rename', '-m', 'merge 2'], [
'Auto-merging (6, 8) /trunk to /branches/newbranch (base /trunk:6).',
'Collecting renames, this might take a while.',
'U module/test.txt - module2/test.txt',
"New merge ticket: $uuid:/trunk:8",
'Committed revision 9.',
]);
# Update the branch
chdir($co_branch_path);
$svk->update();
is_file_content('module2/test.txt', '3');
append_file('module2/test.txt', '4');
$svk->ci(-m => "test 4");
# Merge changes w/rename from trunk to branch
# NOTE: This expected output might not be completely correct!
is_output ($svk, 'smerge', ['//branches/newbranch', '//trunk', '--track-rename', '-m', 'merge back'], [
'Auto-merging (0, 10) /branches/newbranch to /trunk (base /trunk:8).',
'Collecting renames, this might take a while.',
'A + module2',
'U module2/test.txt',
'D module',
"New merge ticket: $uuid:/branches/newbranch:10",
'Committed revision 11.',
]);
chdir($co_trunk_path);
$svk->update();
is_file_content('module2/test.txt', '34');
# adding a new dir on trunk
$svk->mkdir('foo');
overwrite_file('foo/test.txt', 'a');
$svk->add('foo/test.txt');
$svk->ci(-m => "new module added");
# Merge changes w/rename from trunk to branch
is_output ($svk, 'smerge', ['//trunk', '//branches/newbranch', '--track-rename', '-m', 'merge 3'], [
'Auto-merging (8, 12) /trunk to /branches/newbranch (base /branches/newbranch:10).',
'Collecting renames, this might take a while.',
'A foo',
'A foo/test.txt',
"New merge ticket: $uuid:/trunk:12",
'Committed revision 13.',
]);
chdir($co_branch_path);
$svk->update();
is_file_content('foo/test.txt', 'a');
$svk->move('foo', 'bar');
overwrite_file('bar/test.txt', 'b');
$svk->ci(-m => "test 6 - renamed and changed");
is_output ($svk, 'smerge', ['//branches/newbranch', '//trunk', '--track-rename', '-m', 'merge back'], [
'Auto-merging (10, 14) /branches/newbranch to /trunk (base /trunk:12).',
'Collecting renames, this might take a while.',
'A + bar',
'U bar/test.txt',
'D foo',
"New merge ticket: $uuid:/branches/newbranch:14",
'Committed revision 15.',
]);
chdir($co_trunk_path);
$svk->update();
is_file_content('bar/test.txt', 'b');