-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path07smerge-multi.t
143 lines (96 loc) · 2.97 KB
/
07smerge-multi.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
#!/usr/bin/perl -w
use Test::More tests => 5;
use strict;
use SVK::Test;
my ($xd, $svk) = build_test();
our $output;
my ($copath, $corpath) = get_copath ('multimerge');
$svk->checkout ('//', $copath);
mkdir "$copath/trunk";
overwrite_file ("$copath/trunk/foo", "foobar\n");
overwrite_file ("$copath/trunk/test.pl", "foobarbazzz\n");
$svk->add ("$copath/trunk");
$svk->commit ('-m', 'init', "$copath");
overwrite_file ("$copath/trunk/test.pl", q|#!/usr/bin/perl -w
sub main {
print "this is main()\n";
#test
}
|);
$svk->commit ('-m', 'change on trunk', "$copath");
append_file ("$copath/trunk/test.pl", q|
sub test {
print "this is test()\n";
}
|);
$svk->commit ('-m', 'more change on trunk', "$copath");
append_file ("$copath/trunk/test.pl", q|
END {
}
|);
$svk->commit ('-m', 'more change on trunk', "$copath");
$svk->propset ('someprop', 'propvalue', "$copath/trunk/test.pl");
$svk->status ($copath);
$svk->commit ('-m', 'and some prop', "$copath");
$svk->copy ('-m', 'branch //work', '//trunk', '//work');
$svk->update ($copath);
system {$^X} ($^X, "-pi.bak", "-e", "s/is main/is local main/", "$copath/work/test.pl");
$svk->commit ('-m', 'local mod', "$copath/work");
append_file ("$copath/trunk/test.pl", q|
# copyright etc
|);
$svk->commit ('-m', 'more mod on trunk', "$copath/trunk");
is_output_like ($svk, 'smerge', ['-m', 'mergeback from //work', '//work', '//trunk'],
qr|base /trunk:5|);
is_output_like ($svk, 'smerge', ['-m', 'mergeback from //trunk', '//trunk', '//work'],
qr|base /work:7|);
$svk->update ($copath);
system {$^X} ($^X, "-pi.bak", "-e", "s|#!/usr/bin/|#!env |", "$copath/trunk/test.pl");
$svk->commit ('-m', 'mod on trunk before branch to feature', "$copath/trunk");
$svk->copy ('-m', 'branch //feature', '//trunk', '//feature');
$svk->update ($copath);
system {$^X} ($^X, "-pi.bak", "-e", "s/^#test/ test();/", "$copath/work/test.pl");
$svk->commit ('-m', 'call test() in main', "$copath/work");
append_file ("$copath/feature/test.pl", q|
sub newfeature {}
|);
$svk->commit ('-m', 'some new feature', "$copath/feature");
is_output_like ($svk, 'smerge', ['-m', 'merge from //feature', '//feature', '//work'],
qr|base /trunk:9|);
is_output_like ($svk, 'smerge', ['-m', 'merge from //work to //trunk', '//work', '//trunk'],
qr|base /trunk:11|);
is_output_like ($svk, 'smerge', ['-m', 'merge from //trunk to //feature', '//trunk', '//feature'],
qr|base /feature:14|);
__END__
test plan:
//test/trunk
r1-r5
//test/work
r6 (from trunk:5)
//test/work
r7
//test/trunk
r8
//test/trunk
r9 (merged from work:8)
//test/work
r10 (merged from trunk:9)
//test/trunk
r11
//test/feature
r12 (from trunk:11)
*note that /feature also has the ticket work:8 from copy*
//test/work
r13
//test/feature
r14
//test/work
r15 (merged from feature:14)
<base should be trunk:9>
# auto merge (9, 14) /feature -> /work (base /trunk)
//test/trunk
r16 (merged from work:15)
<ticket: feature:14, work:15>
//test/feature
r17 (merged from trunk:16)
<base should be feature:14>