1 #!/bin/sh |
|
2 |
|
3 cat <<EOF >> $HGRCPATH |
|
4 [extensions] |
|
5 transplant= |
|
6 EOF |
|
7 |
|
8 hg init t |
|
9 cd t |
|
10 echo r1 > r1 |
|
11 hg ci -Amr1 -d'0 0' |
|
12 echo r2 > r2 |
|
13 hg ci -Amr2 -d'1 0' |
|
14 hg up 0 |
|
15 |
|
16 echo b1 > b1 |
|
17 hg ci -Amb1 -d '0 0' |
|
18 echo b2 > b2 |
|
19 hg ci -Amb2 -d '1 0' |
|
20 echo b3 > b3 |
|
21 hg ci -Amb3 -d '2 0' |
|
22 |
|
23 hg log --template '{rev} {parents} {desc}\n' |
|
24 |
|
25 hg clone . ../rebase |
|
26 cd ../rebase |
|
27 |
|
28 hg up -C 1 |
|
29 echo '% rebase b onto r1' |
|
30 hg transplant -a -b tip |
|
31 hg log --template '{rev} {parents} {desc}\n' |
|
32 |
|
33 hg clone ../t ../prune |
|
34 cd ../prune |
|
35 |
|
36 hg up -C 1 |
|
37 echo '% rebase b onto r1, skipping b2' |
|
38 hg transplant -a -b tip -p 3 |
|
39 hg log --template '{rev} {parents} {desc}\n' |
|
40 |
|
41 echo '% remote transplant' |
|
42 hg clone -r 1 ../t ../remote |
|
43 cd ../remote |
|
44 hg transplant --log -s ../t 2 4 |
|
45 hg log --template '{rev} {parents} {desc}\n' |
|
46 |
|
47 echo '% skip previous transplants' |
|
48 hg transplant -s ../t -a -b 4 |
|
49 hg log --template '{rev} {parents} {desc}\n' |
|
50 |
|
51 echo '% skip local changes transplanted to the source' |
|
52 echo b4 > b4 |
|
53 hg ci -Amb4 -d '3 0' |
|
54 hg clone ../t ../pullback |
|
55 cd ../pullback |
|
56 hg transplant -s ../remote -a -b tip |
|
57 |
|
58 echo '% remote transplant with pull' |
|
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid |
|
60 cat ../t.pid >> $DAEMON_PIDS |
|
61 |
|
62 hg clone -r 0 ../t ../rp |
|
63 cd ../rp |
|
64 hg transplant -s http://localhost:$HGPORT/ 2 4 |
|
65 hg log --template '{rev} {parents} {desc}\n' |
|
66 |
|
67 echo '% transplant --continue' |
|
68 hg init ../tc |
|
69 cd ../tc |
|
70 cat <<EOF > foo |
|
71 foo |
|
72 bar |
|
73 baz |
|
74 EOF |
|
75 echo toremove > toremove |
|
76 hg ci -Amfoo |
|
77 cat <<EOF > foo |
|
78 foo2 |
|
79 bar2 |
|
80 baz2 |
|
81 EOF |
|
82 rm toremove |
|
83 echo added > added |
|
84 hg ci -Amfoo2 |
|
85 echo bar > bar |
|
86 hg ci -Ambar |
|
87 echo bar2 >> bar |
|
88 hg ci -mbar2 |
|
89 hg up 0 |
|
90 echo foobar > foo |
|
91 hg ci -mfoobar |
|
92 hg transplant 1:3 |
|
93 # transplant -c shouldn't use an old changeset |
|
94 hg up -C |
|
95 rm added |
|
96 hg transplant 1 |
|
97 hg transplant --continue |
|
98 hg transplant 1:3 |
|
99 hg locate |
|
100 cd .. |
|
101 |
|
102 # Test transplant --merge (issue 1111) |
|
103 echo % test transplant merge |
|
104 hg init t1111 |
|
105 cd t1111 |
|
106 echo a > a |
|
107 hg ci -Am adda |
|
108 echo b >> a |
|
109 hg ci -m appendb |
|
110 echo c >> a |
|
111 hg ci -m appendc |
|
112 hg up -C 0 |
|
113 echo d >> a |
|
114 hg ci -m appendd |
|
115 echo % tranplant |
|
116 hg transplant -m 1 |
|
117 cd .. |
|
118 |
|
119 echo '% test transplant into empty repository' |
|
120 hg init empty |
|
121 cd empty |
|
122 hg transplant -s ../t -b tip -a |
|
123 cd .. |
|
124 |
|
125 echo '% test filter' |
|
126 hg init filter |
|
127 cd filter |
|
128 cat <<'EOF' >test-filter |
|
129 #!/bin/sh |
|
130 sed 's/r1/r2/' $1 > $1.new |
|
131 mv $1.new $1 |
|
132 EOF |
|
133 chmod +x test-filter |
|
134 hg transplant -s ../t -b tip -a --filter ./test-filter |\ |
|
135 sed 's/filtering.*/filtering/g' |
|
136 hg log --template '{rev} {parents} {desc}\n' |
|
137 cd .. |
|
138 |
|
139 echo '% test filter with failed patch' |
|
140 cd filter |
|
141 hg up 0 |
|
142 echo foo > b1 |
|
143 hg ci -d '0 0' -Am foo |
|
144 hg transplant 1 --filter ./test-filter |\ |
|
145 sed 's/filtering.*/filtering/g' |
|
146 cd .. |
|
147 |
|
148 echo '% test with a win32ext like setup (differing EOLs)' |
|
149 hg init twin1 |
|
150 cd twin1 |
|
151 echo a > a |
|
152 echo b > b |
|
153 echo b >> b |
|
154 hg ci -Am t |
|
155 echo a > b |
|
156 echo b >> b |
|
157 hg ci -m changeb |
|
158 cd .. |
|
159 |
|
160 hg init twin2 |
|
161 cd twin2 |
|
162 echo '[patch]' >> .hg/hgrc |
|
163 echo 'eol = crlf' >> .hg/hgrc |
|
164 python -c "file('b', 'wb').write('b\r\nb\r\n')" |
|
165 hg ci -m addb |
|
166 hg transplant -s ../twin1 tip |
|
167 python -c "print repr(file('b', 'rb').read())" |
|
168 cd .. |
|