Show More
This diff has been collapsed as it changes many lines, (1247 lines changed) Show them Hide them | |||
@@ -1,497 +1,916 | |||
|
1 | #!/bin/sh | |
|
1 | $ hg init a | |
|
2 | $ mkdir a/d1 | |
|
3 | $ mkdir a/d1/d2 | |
|
4 | $ echo line 1 > a/a | |
|
5 | $ echo line 1 > a/d1/d2/a | |
|
6 | $ hg --cwd a ci -Ama | |
|
7 | adding a | |
|
8 | adding d1/d2/a | |
|
2 | 9 | |
|
3 | hg init a | |
|
4 | mkdir a/d1 | |
|
5 | mkdir a/d1/d2 | |
|
6 | echo line 1 > a/a | |
|
7 | echo line 1 > a/d1/d2/a | |
|
8 | hg --cwd a ci -Ama | |
|
10 | $ echo line 2 >> a/a | |
|
11 | $ hg --cwd a ci -u someone -d '1 0' -m'second change' | |
|
9 | 12 | |
|
10 | echo line 2 >> a/a | |
|
11 | hg --cwd a ci -u someone -d '1 0' -m'second change' | |
|
13 | ||
|
14 | import exported patch | |
|
12 | 15 | |
|
13 | echo % import exported patch | |
|
14 | hg clone -r0 a b | |
|
15 | hg --cwd a export tip > tip.patch | |
|
16 | hg --cwd b import ../tip.patch | |
|
17 | echo % message should be same | |
|
18 | hg --cwd b tip | grep 'second change' | |
|
19 | echo % committer should be same | |
|
20 | hg --cwd b tip | grep someone | |
|
21 | rm -r b | |
|
16 | $ hg clone -r0 a b | |
|
17 | requesting all changes | |
|
18 | adding changesets | |
|
19 | adding manifests | |
|
20 | adding file changes | |
|
21 | added 1 changesets with 2 changes to 2 files | |
|
22 | updating to branch default | |
|
23 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
24 | $ hg --cwd a export tip > tip.patch | |
|
25 | $ hg --cwd b import ../tip.patch | |
|
26 | applying ../tip.patch | |
|
22 | 27 | |
|
23 | echo % import exported patch with external patcher | |
|
24 | cat > dummypatch.py <<EOF | |
|
25 | print 'patching file a' | |
|
26 | file('a', 'wb').write('line2\n') | |
|
27 | EOF | |
|
28 | chmod +x dummypatch.py | |
|
29 | hg clone -r0 a b | |
|
30 | hg --cwd a export tip > tip.patch | |
|
31 | hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch | |
|
32 | cat b/a | |
|
33 | rm -r b | |
|
28 | message should be same | |
|
29 | ||
|
30 | $ hg --cwd b tip | grep 'second change' | |
|
31 | summary: second change | |
|
32 | ||
|
33 | committer should be same | |
|
34 | 34 | |
|
35 | echo % import of plain diff should fail without message | |
|
36 | hg clone -r0 a b | |
|
37 | hg --cwd a diff -r0:1 > tip.patch | |
|
38 | hg --cwd b import ../tip.patch | |
|
39 | rm -r b | |
|
35 | $ hg --cwd b tip | grep someone | |
|
36 | user: someone | |
|
37 | $ rm -r b | |
|
38 | ||
|
39 | ||
|
40 | import exported patch with external patcher | |
|
40 | 41 | |
|
41 | echo % import of plain diff should be ok with message | |
|
42 | hg clone -r0 a b | |
|
43 | hg --cwd a diff -r0:1 > tip.patch | |
|
44 | hg --cwd b import -mpatch ../tip.patch | |
|
45 | rm -r b | |
|
42 | $ cat > dummypatch.py <<EOF | |
|
43 | > print 'patching file a' | |
|
44 | > file('a', 'wb').write('line2\n') | |
|
45 | > EOF | |
|
46 | $ chmod +x dummypatch.py | |
|
47 | $ hg clone -r0 a b | |
|
48 | requesting all changes | |
|
49 | adding changesets | |
|
50 | adding manifests | |
|
51 | adding file changes | |
|
52 | added 1 changesets with 2 changes to 2 files | |
|
53 | updating to branch default | |
|
54 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
55 | $ hg --cwd a export tip > tip.patch | |
|
56 | $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch | |
|
57 | applying ../tip.patch | |
|
58 | $ cat b/a | |
|
59 | line2 | |
|
60 | $ rm -r b | |
|
46 | 61 | |
|
47 | echo % import of plain diff with specific date and user | |
|
48 | hg clone -r0 a b | |
|
49 | hg --cwd a diff -r0:1 > tip.patch | |
|
50 | hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch | |
|
51 | hg -R b tip -pv | |
|
52 | rm -r b | |
|
53 | 62 | |
|
54 |
|
|
|
55 | hg clone -r0 a b | |
|
56 | hg --cwd a diff -r0:1 > tip.patch | |
|
57 | hg --cwd b import --no-commit ../tip.patch | |
|
58 | hg --cwd b diff --nodates | |
|
59 | rm -r b | |
|
63 | import of plain diff should fail without message | |
|
60 | 64 | |
|
61 | echo % hg -R repo import | |
|
62 | # put the clone in a subdir - having a directory named "a" | |
|
63 | # used to hide a bug. | |
|
64 | mkdir dir | |
|
65 | hg clone -r0 a dir/b | |
|
66 | hg --cwd a export tip > dir/tip.patch | |
|
67 | cd dir | |
|
68 | hg -R b import tip.patch | |
|
69 | cd .. | |
|
70 | rm -r dir | |
|
65 | $ hg clone -r0 a b | |
|
66 | requesting all changes | |
|
67 | adding changesets | |
|
68 | adding manifests | |
|
69 | adding file changes | |
|
70 | added 1 changesets with 2 changes to 2 files | |
|
71 | updating to branch default | |
|
72 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
73 | $ hg --cwd a diff -r0:1 > tip.patch | |
|
74 | $ hg --cwd b import ../tip.patch | |
|
75 | applying ../tip.patch | |
|
76 | abort: empty commit message | |
|
77 | $ rm -r b | |
|
78 | ||
|
71 | 79 | |
|
72 | echo % import from stdin | |
|
73 | hg clone -r0 a b | |
|
74 | hg --cwd a export tip | hg --cwd b import - | |
|
75 | rm -r b | |
|
80 | import of plain diff should be ok with message | |
|
76 | 81 | |
|
77 | echo % import two patches in one stream | |
|
78 | hg init b | |
|
79 | hg --cwd a export 0:tip | hg --cwd b import - | |
|
80 | hg --cwd a id | |
|
81 | hg --cwd b id | |
|
82 | rm -r b | |
|
82 | $ hg clone -r0 a b | |
|
83 | requesting all changes | |
|
84 | adding changesets | |
|
85 | adding manifests | |
|
86 | adding file changes | |
|
87 | added 1 changesets with 2 changes to 2 files | |
|
88 | updating to branch default | |
|
89 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
90 | $ hg --cwd a diff -r0:1 > tip.patch | |
|
91 | $ hg --cwd b import -mpatch ../tip.patch | |
|
92 | applying ../tip.patch | |
|
93 | $ rm -r b | |
|
94 | ||
|
95 | ||
|
96 | import of plain diff with specific date and user | |
|
83 | 97 | |
|
84 | echo % override commit message | |
|
85 | hg clone -r0 a b | |
|
86 | hg --cwd a export tip | hg --cwd b import -m 'override' - | |
|
87 | hg --cwd b tip | grep override | |
|
88 | rm -r b | |
|
98 | $ hg clone -r0 a b | |
|
99 | requesting all changes | |
|
100 | adding changesets | |
|
101 | adding manifests | |
|
102 | adding file changes | |
|
103 | added 1 changesets with 2 changes to 2 files | |
|
104 | updating to branch default | |
|
105 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
106 | $ hg --cwd a diff -r0:1 > tip.patch | |
|
107 | $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch | |
|
108 | applying ../tip.patch | |
|
109 | $ hg -R b tip -pv | |
|
110 | changeset: 1:ca68f19f3a40 | |
|
111 | tag: tip | |
|
112 | user: user@nowhere.net | |
|
113 | date: Thu Jan 01 00:00:01 1970 +0000 | |
|
114 | files: a | |
|
115 | description: | |
|
116 | patch | |
|
89 | 117 | |
|
90 | cat > mkmsg.py <<EOF | |
|
91 | import email.Message, sys | |
|
92 | msg = email.Message.Message() | |
|
93 | msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) | |
|
94 | msg['Subject'] = 'email patch' | |
|
95 | msg['From'] = 'email patcher' | |
|
96 | sys.stdout.write(msg.as_string()) | |
|
97 | EOF | |
|
118 | ||
|
119 | diff -r 80971e65b431 -r ca68f19f3a40 a | |
|
120 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
|
121 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |
|
122 | @@ -1,1 +1,2 @@ | |
|
123 | line 1 | |
|
124 | +line 2 | |
|
98 | 125 | |
|
99 | echo % plain diff in email, subject, message body | |
|
100 | hg clone -r0 a b | |
|
101 | hg --cwd a diff -r0:1 > tip.patch | |
|
102 | python mkmsg.py > msg.patch | |
|
103 | hg --cwd b import ../msg.patch | |
|
104 | hg --cwd b tip | grep email | |
|
105 | rm -r b | |
|
126 | $ rm -r b | |
|
106 | 127 | |
|
107 | echo % plain diff in email, no subject, message body | |
|
108 | hg clone -r0 a b | |
|
109 | grep -v '^Subject:' msg.patch | hg --cwd b import - | |
|
110 | rm -r b | |
|
128 | ||
|
129 | import of plain diff should be ok with --no-commit | |
|
111 | 130 | |
|
112 | echo % plain diff in email, subject, no message body | |
|
113 | hg clone -r0 a b | |
|
114 | grep -v '^email ' msg.patch | hg --cwd b import - | |
|
115 | rm -r b | |
|
131 | $ hg clone -r0 a b | |
|
132 | requesting all changes | |
|
133 | adding changesets | |
|
134 | adding manifests | |
|
135 | adding file changes | |
|
136 | added 1 changesets with 2 changes to 2 files | |
|
137 | updating to branch default | |
|
138 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
139 | $ hg --cwd a diff -r0:1 > tip.patch | |
|
140 | $ hg --cwd b import --no-commit ../tip.patch | |
|
141 | applying ../tip.patch | |
|
142 | $ hg --cwd b diff --nodates | |
|
143 | diff -r 80971e65b431 a | |
|
144 | --- a/a | |
|
145 | +++ b/a | |
|
146 | @@ -1,1 +1,2 @@ | |
|
147 | line 1 | |
|
148 | +line 2 | |
|
149 | $ rm -r b | |
|
116 | 150 | |
|
117 | echo % plain diff in email, no subject, no message body, should fail | |
|
118 | hg clone -r0 a b | |
|
119 | egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - | |
|
120 | rm -r b | |
|
121 | 151 | |
|
122 | echo % hg export in email, should use patch header | |
|
123 | hg clone -r0 a b | |
|
124 | hg --cwd a export tip > tip.patch | |
|
125 | python mkmsg.py | hg --cwd b import - | |
|
126 | hg --cwd b tip | grep second | |
|
127 | rm -r b | |
|
152 | hg -R repo import | |
|
153 | put the clone in a subdir - having a directory named "a" | |
|
154 | used to hide a bug. | |
|
128 | 155 | |
|
129 | # subject: duplicate detection, removal of [PATCH] | |
|
130 | # The '---' tests the gitsendmail handling without proper mail headers | |
|
131 | cat > mkmsg2.py <<EOF | |
|
132 | import email.Message, sys | |
|
133 | msg = email.Message.Message() | |
|
134 | msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) | |
|
135 | msg['Subject'] = '[PATCH] email patch' | |
|
136 | msg['From'] = 'email patcher' | |
|
137 | sys.stdout.write(msg.as_string()) | |
|
138 | EOF | |
|
156 | $ mkdir dir | |
|
157 | $ hg clone -r0 a dir/b | |
|
158 | requesting all changes | |
|
159 | adding changesets | |
|
160 | adding manifests | |
|
161 | adding file changes | |
|
162 | added 1 changesets with 2 changes to 2 files | |
|
163 | updating to branch default | |
|
164 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
165 | $ hg --cwd a export tip > dir/tip.patch | |
|
166 | $ cd dir | |
|
167 | $ hg -R b import tip.patch | |
|
168 | applying tip.patch | |
|
169 | $ cd .. | |
|
170 | $ rm -r dir | |
|
171 | ||
|
139 | 172 | |
|
140 | echo '% plain diff in email, [PATCH] subject, message body with subject' | |
|
141 | hg clone -r0 a b | |
|
142 | hg --cwd a diff -r0:1 > tip.patch | |
|
143 | python mkmsg2.py | hg --cwd b import - | |
|
144 | hg --cwd b tip --template '{desc}\n' | |
|
145 | rm -r b | |
|
173 | import from stdin | |
|
174 | ||
|
175 | $ hg clone -r0 a b | |
|
176 | requesting all changes | |
|
177 | adding changesets | |
|
178 | adding manifests | |
|
179 | adding file changes | |
|
180 | added 1 changesets with 2 changes to 2 files | |
|
181 | updating to branch default | |
|
182 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
183 | $ hg --cwd a export tip | hg --cwd b import - | |
|
184 | applying patch from stdin | |
|
185 | $ rm -r b | |
|
186 | ||
|
187 | ||
|
188 | import two patches in one stream | |
|
146 | 189 | |
|
147 | # We weren't backing up the correct dirstate file when importing many patches | |
|
148 | # (issue963) | |
|
149 | echo '% import patch1 patch2; rollback' | |
|
150 | echo line 3 >> a/a | |
|
151 | hg --cwd a ci -m'third change' | |
|
152 | hg --cwd a export -o '../patch%R' 1 2 | |
|
153 | hg clone -qr0 a b | |
|
154 | hg --cwd b parents --template 'parent: {rev}\n' | |
|
155 | hg --cwd b import ../patch1 ../patch2 | |
|
156 | hg --cwd b rollback | |
|
157 | hg --cwd b parents --template 'parent: {rev}\n' | |
|
158 | rm -r b | |
|
190 | $ hg init b | |
|
191 | $ hg --cwd a export 0:tip | hg --cwd b import - | |
|
192 | applying patch from stdin | |
|
193 | applied 80971e65b431 | |
|
194 | $ hg --cwd a id | |
|
195 | 1d4bd90af0e4 tip | |
|
196 | $ hg --cwd b id | |
|
197 | 1d4bd90af0e4 tip | |
|
198 | $ rm -r b | |
|
199 | ||
|
200 | ||
|
201 | override commit message | |
|
159 | 202 | |
|
160 | # bug non regression test | |
|
161 | # importing a patch in a subdirectory failed at the commit stage | |
|
162 | echo line 2 >> a/d1/d2/a | |
|
163 | hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' | |
|
164 | echo % hg import in a subdirectory | |
|
165 | hg clone -r0 a b | |
|
166 | hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch | |
|
167 | dir=`pwd` | |
|
168 | cd b/d1/d2 2>&1 > /dev/null | |
|
169 | hg import ../../../tip.patch | |
|
170 | cd "$dir" | |
|
171 | echo "% message should be 'subdir change'" | |
|
172 | hg --cwd b tip | grep 'subdir change' | |
|
173 | echo "% committer should be 'someoneelse'" | |
|
174 | hg --cwd b tip | grep someoneelse | |
|
175 | echo "% should be empty" | |
|
176 | hg --cwd b status | |
|
203 | $ hg clone -r0 a b | |
|
204 | requesting all changes | |
|
205 | adding changesets | |
|
206 | adding manifests | |
|
207 | adding file changes | |
|
208 | added 1 changesets with 2 changes to 2 files | |
|
209 | updating to branch default | |
|
210 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
211 | $ hg --cwd a export tip | hg --cwd b import -m 'override' - | |
|
212 | applying patch from stdin | |
|
213 | $ hg --cwd b tip | grep override | |
|
214 | summary: override | |
|
215 | $ rm -r b | |
|
216 | ||
|
217 | $ cat > mkmsg.py <<EOF | |
|
218 | > import email.Message, sys | |
|
219 | > msg = email.Message.Message() | |
|
220 | > msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) | |
|
221 | > msg['Subject'] = 'email patch' | |
|
222 | > msg['From'] = 'email patcher' | |
|
223 | > sys.stdout.write(msg.as_string()) | |
|
224 | > EOF | |
|
177 | 225 | |
|
178 | 226 | |
|
179 | # Test fuzziness (ambiguous patch location, fuzz=2) | |
|
180 | echo % test fuzziness | |
|
181 | hg init fuzzy | |
|
182 | cd fuzzy | |
|
183 | echo line1 > a | |
|
184 | echo line0 >> a | |
|
185 | echo line3 >> a | |
|
186 | hg ci -Am adda | |
|
187 | echo line1 > a | |
|
188 | echo line2 >> a | |
|
189 | echo line0 >> a | |
|
190 | echo line3 >> a | |
|
191 | hg ci -m change a | |
|
192 | hg export tip > tip.patch | |
|
193 | hg up -C 0 | |
|
194 | echo line1 > a | |
|
195 | echo line0 >> a | |
|
196 | echo line1 >> a | |
|
197 | echo line0 >> a | |
|
198 | hg ci -m brancha | |
|
199 | hg import --no-commit -v tip.patch | |
|
200 | hg revert -a | |
|
201 | echo '% test fuzziness with eol=auto' | |
|
202 | hg --config patch.eol=auto import --no-commit -v tip.patch | |
|
203 | cd .. | |
|
227 | plain diff in email, subject, message body | |
|
228 | ||
|
229 | $ hg clone -r0 a b | |
|
230 | requesting all changes | |
|
231 | adding changesets | |
|
232 | adding manifests | |
|
233 | adding file changes | |
|
234 | added 1 changesets with 2 changes to 2 files | |
|
235 | updating to branch default | |
|
236 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
237 | $ hg --cwd a diff -r0:1 > tip.patch | |
|
238 | $ python mkmsg.py > msg.patch | |
|
239 | $ hg --cwd b import ../msg.patch | |
|
240 | applying ../msg.patch | |
|
241 | $ hg --cwd b tip | grep email | |
|
242 | user: email patcher | |
|
243 | summary: email patch | |
|
244 | $ rm -r b | |
|
245 | ||
|
246 | ||
|
247 | plain diff in email, no subject, message body | |
|
204 | 248 | |
|
205 | # Test hunk touching empty files (issue906) | |
|
206 | hg init empty | |
|
207 | cd empty | |
|
208 | touch a | |
|
209 | touch b1 | |
|
210 | touch c1 | |
|
211 | echo d > d | |
|
212 | hg ci -Am init | |
|
213 | echo a > a | |
|
214 | echo b > b1 | |
|
215 | hg mv b1 b2 | |
|
216 | echo c > c1 | |
|
217 | hg copy c1 c2 | |
|
218 | rm d | |
|
219 | touch d | |
|
220 | hg diff --git | |
|
221 | hg ci -m empty | |
|
222 | hg export --git tip > empty.diff | |
|
223 | hg up -C 0 | |
|
224 | hg import empty.diff | |
|
225 | for name in a b1 b2 c1 c2 d; | |
|
226 | do | |
|
227 | echo % $name file | |
|
228 | test -f $name && cat $name | |
|
229 | done | |
|
230 | cd .. | |
|
249 | $ hg clone -r0 a b | |
|
250 | requesting all changes | |
|
251 | adding changesets | |
|
252 | adding manifests | |
|
253 | adding file changes | |
|
254 | added 1 changesets with 2 changes to 2 files | |
|
255 | updating to branch default | |
|
256 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
257 | $ grep -v '^Subject:' msg.patch | hg --cwd b import - | |
|
258 | applying patch from stdin | |
|
259 | $ rm -r b | |
|
260 | ||
|
261 | ||
|
262 | plain diff in email, subject, no message body | |
|
231 | 263 | |
|
232 | # Test importing a patch ending with a binary file removal | |
|
233 | echo % test trailing binary removal | |
|
234 | hg init binaryremoval | |
|
235 | cd binaryremoval | |
|
236 | echo a > a | |
|
237 | python -c "file('b', 'wb').write('a\x00b')" | |
|
238 | hg ci -Am addall | |
|
239 | hg rm a | |
|
240 | hg rm b | |
|
241 | hg st | |
|
242 | hg ci -m remove | |
|
243 | hg export --git . > remove.diff | |
|
244 | cat remove.diff | grep git | |
|
245 | hg up -C 0 | |
|
246 | hg import remove.diff | |
|
247 | hg manifest | |
|
248 | cd .. | |
|
264 | $ hg clone -r0 a b | |
|
265 | requesting all changes | |
|
266 | adding changesets | |
|
267 | adding manifests | |
|
268 | adding file changes | |
|
269 | added 1 changesets with 2 changes to 2 files | |
|
270 | updating to branch default | |
|
271 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
272 | $ grep -v '^email ' msg.patch | hg --cwd b import - | |
|
273 | applying patch from stdin | |
|
274 | $ rm -r b | |
|
275 | ||
|
276 | ||
|
277 | plain diff in email, no subject, no message body, should fail | |
|
249 | 278 | |
|
250 | echo % 'test update+rename with common name (issue 927)' | |
|
251 | hg init t | |
|
252 | cd t | |
|
253 | touch a | |
|
254 | hg ci -Am t | |
|
255 | echo a > a | |
|
256 | # Here, bfile.startswith(afile) | |
|
257 | hg copy a a2 | |
|
258 | hg ci -m copya | |
|
259 | hg export --git tip > copy.diff | |
|
260 | hg up -C 0 | |
|
261 | hg import copy.diff | |
|
262 | echo % view a | |
|
263 | # a should contain an 'a' | |
|
264 | cat a | |
|
265 | echo % view a2 | |
|
266 | # and a2 should have duplicated it | |
|
267 | cat a2 | |
|
268 | cd .. | |
|
279 | $ hg clone -r0 a b | |
|
280 | requesting all changes | |
|
281 | adding changesets | |
|
282 | adding manifests | |
|
283 | adding file changes | |
|
284 | added 1 changesets with 2 changes to 2 files | |
|
285 | updating to branch default | |
|
286 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
287 | $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - | |
|
288 | applying patch from stdin | |
|
289 | abort: empty commit message | |
|
290 | $ rm -r b | |
|
291 | ||
|
292 | ||
|
293 | hg export in email, should use patch header | |
|
269 | 294 | |
|
270 | echo % 'test -p0' | |
|
271 | hg init p0 | |
|
272 | cd p0 | |
|
273 | echo a > a | |
|
274 | hg ci -Am t | |
|
275 | hg import -p0 - << EOF | |
|
276 | foobar | |
|
277 | --- a Sat Apr 12 22:43:58 2008 -0400 | |
|
278 | +++ a Sat Apr 12 22:44:05 2008 -0400 | |
|
279 | @@ -1,1 +1,1 @@ | |
|
280 | -a | |
|
281 | +bb | |
|
282 | EOF | |
|
283 | hg status | |
|
284 | cat a | |
|
285 | cd .. | |
|
295 | $ hg clone -r0 a b | |
|
296 | requesting all changes | |
|
297 | adding changesets | |
|
298 | adding manifests | |
|
299 | adding file changes | |
|
300 | added 1 changesets with 2 changes to 2 files | |
|
301 | updating to branch default | |
|
302 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
303 | $ hg --cwd a export tip > tip.patch | |
|
304 | $ python mkmsg.py | hg --cwd b import - | |
|
305 | applying patch from stdin | |
|
306 | $ hg --cwd b tip | grep second | |
|
307 | summary: second change | |
|
308 | $ rm -r b | |
|
309 | ||
|
286 | 310 | |
|
287 | echo % 'test paths outside repo root' | |
|
288 | mkdir outside | |
|
289 | touch outside/foo | |
|
290 | hg init inside | |
|
291 | cd inside | |
|
292 | hg import - <<EOF | |
|
293 | diff --git a/a b/b | |
|
294 | rename from ../outside/foo | |
|
295 | rename to bar | |
|
296 | EOF | |
|
297 | cd .. | |
|
311 | subject: duplicate detection, removal of [PATCH] | |
|
312 | The '---' tests the gitsendmail handling without proper mail headers | |
|
313 | ||
|
314 | $ cat > mkmsg2.py <<EOF | |
|
315 | > import email.Message, sys | |
|
316 | > msg = email.Message.Message() | |
|
317 | > msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) | |
|
318 | > msg['Subject'] = '[PATCH] email patch' | |
|
319 | > msg['From'] = 'email patcher' | |
|
320 | > sys.stdout.write(msg.as_string()) | |
|
321 | > EOF | |
|
322 | ||
|
323 | ||
|
324 | plain diff in email, [PATCH] subject, message body with subject | |
|
298 | 325 | |
|
299 | echo '% test import with similarity and git and strip (issue295 et al.)' | |
|
300 | hg init sim | |
|
301 | cd sim | |
|
302 | echo 'this is a test' > a | |
|
303 | hg ci -Ama | |
|
304 | cat > ../rename.diff <<EOF | |
|
305 | diff --git a/foo/a b/foo/a | |
|
306 | deleted file mode 100644 | |
|
307 | --- a/foo/a | |
|
308 | +++ /dev/null | |
|
309 | @@ -1,1 +0,0 @@ | |
|
310 | -this is a test | |
|
311 | diff --git a/foo/b b/foo/b | |
|
312 | new file mode 100644 | |
|
313 | --- /dev/null | |
|
314 | +++ b/foo/b | |
|
315 | @@ -0,0 +1,2 @@ | |
|
316 | +this is a test | |
|
317 | +foo | |
|
318 | EOF | |
|
319 | hg import --no-commit -v -s 1 ../rename.diff -p2 | |
|
320 | hg st -C | |
|
321 | hg revert -a | |
|
322 | rm b | |
|
323 | hg import --no-commit -v -s 100 ../rename.diff -p2 | |
|
324 | hg st -C | |
|
325 | cd .. | |
|
326 | $ hg clone -r0 a b | |
|
327 | requesting all changes | |
|
328 | adding changesets | |
|
329 | adding manifests | |
|
330 | adding file changes | |
|
331 | added 1 changesets with 2 changes to 2 files | |
|
332 | updating to branch default | |
|
333 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
334 | $ hg --cwd a diff -r0:1 > tip.patch | |
|
335 | $ python mkmsg2.py | hg --cwd b import - | |
|
336 | applying patch from stdin | |
|
337 | $ hg --cwd b tip --template '{desc}\n' | |
|
338 | email patch | |
|
339 | ||
|
340 | next line | |
|
341 | --- | |
|
342 | $ rm -r b | |
|
326 | 343 | |
|
327 | 344 | |
|
328 | echo '% add empty file from the end of patch (issue 1495)' | |
|
329 | hg init addemptyend | |
|
330 | cd addemptyend | |
|
331 | touch a | |
|
332 | hg addremove | |
|
333 | hg ci -m "commit" | |
|
334 | cat > a.patch <<EOF | |
|
345 | We weren't backing up the correct dirstate file when importing many patches | |
|
346 | (issue963) | |
|
347 | import patch1 patch2; rollback | |
|
348 | ||
|
349 | $ echo line 3 >> a/a | |
|
350 | $ hg --cwd a ci -m'third change' | |
|
351 | $ hg --cwd a export -o '../patch%R' 1 2 | |
|
352 | $ hg clone -qr0 a b | |
|
353 | $ hg --cwd b parents --template 'parent: {rev}\n' | |
|
354 | parent: 0 | |
|
355 | $ hg --cwd b import ../patch1 ../patch2 | |
|
356 | applying ../patch1 | |
|
357 | applying ../patch2 | |
|
358 | applied 1d4bd90af0e4 | |
|
359 | $ hg --cwd b rollback | |
|
360 | rolling back to revision 1 (undo commit) | |
|
361 | $ hg --cwd b parents --template 'parent: {rev}\n' | |
|
362 | parent: 1 | |
|
363 | $ rm -r b | |
|
364 | ||
|
365 | ||
|
366 | importing a patch in a subdirectory failed at the commit stage | |
|
367 | ||
|
368 | $ echo line 2 >> a/d1/d2/a | |
|
369 | $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' | |
|
370 | ||
|
371 | hg import in a subdirectory | |
|
372 | ||
|
373 | $ hg clone -r0 a b | |
|
374 | requesting all changes | |
|
375 | adding changesets | |
|
376 | adding manifests | |
|
377 | adding file changes | |
|
378 | added 1 changesets with 2 changes to 2 files | |
|
379 | updating to branch default | |
|
380 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
381 | $ hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch | |
|
382 | $ dir=`pwd` | |
|
383 | $ cd b/d1/d2 2>&1 > /dev/null | |
|
384 | $ hg import ../../../tip.patch | |
|
385 | applying ../../../tip.patch | |
|
386 | $ cd "$dir" | |
|
387 | ||
|
388 | message should be 'subdir change' | |
|
389 | ||
|
390 | $ hg --cwd b tip | grep 'subdir change' | |
|
391 | summary: subdir change | |
|
392 | ||
|
393 | committer should be 'someoneelse' | |
|
394 | ||
|
395 | $ hg --cwd b tip | grep someoneelse | |
|
396 | user: someoneelse | |
|
397 | ||
|
398 | should be empty | |
|
399 | ||
|
400 | $ hg --cwd b status | |
|
401 | ||
|
402 | ||
|
403 | Test fuzziness (ambiguous patch location, fuzz=2) | |
|
404 | ||
|
405 | $ hg init fuzzy | |
|
406 | $ cd fuzzy | |
|
407 | $ echo line1 > a | |
|
408 | $ echo line0 >> a | |
|
409 | $ echo line3 >> a | |
|
410 | $ hg ci -Am adda | |
|
411 | adding a | |
|
412 | $ echo line1 > a | |
|
413 | $ echo line2 >> a | |
|
414 | $ echo line0 >> a | |
|
415 | $ echo line3 >> a | |
|
416 | $ hg ci -m change a | |
|
417 | $ hg export tip > tip.patch | |
|
418 | $ hg up -C 0 | |
|
419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
420 | $ echo line1 > a | |
|
421 | $ echo line0 >> a | |
|
422 | $ echo line1 >> a | |
|
423 | $ echo line0 >> a | |
|
424 | $ hg ci -m brancha | |
|
425 | created new head | |
|
426 | $ hg import --no-commit -v tip.patch | |
|
427 | applying tip.patch | |
|
428 | patching file a | |
|
429 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). | |
|
430 | $ hg revert -a | |
|
431 | reverting a | |
|
432 | ||
|
433 | test fuzziness with eol=auto | |
|
434 | ||
|
435 | $ hg --config patch.eol=auto import --no-commit -v tip.patch | |
|
436 | applying tip.patch | |
|
437 | patching file a | |
|
438 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). | |
|
439 | $ cd .. | |
|
440 | ||
|
441 | ||
|
442 | Test hunk touching empty files (issue906) | |
|
443 | ||
|
444 | $ hg init empty | |
|
445 | $ cd empty | |
|
446 | $ touch a | |
|
447 | $ touch b1 | |
|
448 | $ touch c1 | |
|
449 | $ echo d > d | |
|
450 | $ hg ci -Am init | |
|
451 | adding a | |
|
452 | adding b1 | |
|
453 | adding c1 | |
|
454 | adding d | |
|
455 | $ echo a > a | |
|
456 | $ echo b > b1 | |
|
457 | $ hg mv b1 b2 | |
|
458 | $ echo c > c1 | |
|
459 | $ hg copy c1 c2 | |
|
460 | $ rm d | |
|
461 | $ touch d | |
|
462 | $ hg diff --git | |
|
335 | 463 | diff --git a/a b/a |
|
336 | 464 | --- a/a |
|
337 | 465 | +++ b/a |
|
338 | 466 | @@ -0,0 +1,1 @@ |
|
339 | 467 | +a |
|
340 | diff --git a/b b/b | |
|
341 | new file mode 100644 | |
|
342 | EOF | |
|
343 | hg import --no-commit a.patch | |
|
344 | cd .. | |
|
345 | ||
|
346 | echo '% create file when source is not /dev/null' | |
|
347 | cat > create.patch <<EOF | |
|
348 | diff -Naur proj-orig/foo proj-new/foo | |
|
349 | --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 | |
|
350 | +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 | |
|
468 | diff --git a/b1 b/b2 | |
|
469 | rename from b1 | |
|
470 | rename to b2 | |
|
471 | --- a/b1 | |
|
472 | +++ b/b2 | |
|
473 | @@ -0,0 +1,1 @@ | |
|
474 | +b | |
|
475 | diff --git a/c1 b/c1 | |
|
476 | --- a/c1 | |
|
477 | +++ b/c1 | |
|
478 | @@ -0,0 +1,1 @@ | |
|
479 | +c | |
|
480 | diff --git a/c1 b/c2 | |
|
481 | copy from c1 | |
|
482 | copy to c2 | |
|
483 | --- a/c1 | |
|
484 | +++ b/c2 | |
|
351 | 485 | @@ -0,0 +1,1 @@ |
|
352 | +a | |
|
353 | EOF | |
|
354 | # some people have patches like the following too | |
|
355 | cat > create2.patch <<EOF | |
|
356 | diff -Naur proj-orig/foo proj-new/foo | |
|
357 | --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 | |
|
358 | +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 | |
|
359 | @@ -0,0 +1,1 @@ | |
|
360 | +a | |
|
361 | EOF | |
|
362 | hg init oddcreate | |
|
363 | cd oddcreate | |
|
364 | hg import --no-commit ../create.patch | |
|
365 | cat foo | |
|
366 | rm foo | |
|
367 | hg revert foo | |
|
368 | hg import --no-commit ../create2.patch | |
|
369 | cat foo | |
|
486 | +c | |
|
487 | diff --git a/d b/d | |
|
488 | --- a/d | |
|
489 | +++ b/d | |
|
490 | @@ -1,1 +0,0 @@ | |
|
491 | -d | |
|
492 | $ hg ci -m empty | |
|
493 | $ hg export --git tip > empty.diff | |
|
494 | $ hg up -C 0 | |
|
495 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
|
496 | $ hg import empty.diff | |
|
497 | applying empty.diff | |
|
498 | $ for name in a b1 b2 c1 c2 d; do | |
|
499 | > echo % $name file | |
|
500 | > test -f $name && cat $name | |
|
501 | > done | |
|
502 | % a file | |
|
503 | a | |
|
504 | % b1 file | |
|
505 | % b2 file | |
|
506 | b | |
|
507 | % c1 file | |
|
508 | c | |
|
509 | % c2 file | |
|
510 | c | |
|
511 | % d file | |
|
512 | $ cd .. | |
|
513 | ||
|
514 | ||
|
515 | Test importing a patch ending with a binary file removal | |
|
516 | ||
|
517 | $ hg init binaryremoval | |
|
518 | $ cd binaryremoval | |
|
519 | $ echo a > a | |
|
520 | $ python -c "file('b', 'wb').write('a\x00b')" | |
|
521 | $ hg ci -Am addall | |
|
522 | adding a | |
|
523 | adding b | |
|
524 | $ hg rm a | |
|
525 | $ hg rm b | |
|
526 | $ hg st | |
|
527 | R a | |
|
528 | R b | |
|
529 | $ hg ci -m remove | |
|
530 | $ hg export --git . > remove.diff | |
|
531 | $ cat remove.diff | grep git | |
|
532 | diff --git a/a b/a | |
|
533 | diff --git a/b b/b | |
|
534 | $ hg up -C 0 | |
|
535 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
536 | $ hg import remove.diff | |
|
537 | applying remove.diff | |
|
538 | $ hg manifest | |
|
539 | $ cd .. | |
|
540 | ||
|
541 | ||
|
542 | test update+rename with common name (issue 927) | |
|
543 | ||
|
544 | $ hg init t | |
|
545 | $ cd t | |
|
546 | $ touch a | |
|
547 | $ hg ci -Am t | |
|
548 | adding a | |
|
549 | $ echo a > a | |
|
550 | ||
|
551 | Here, bfile.startswith(afile) | |
|
552 | ||
|
553 | $ hg copy a a2 | |
|
554 | $ hg ci -m copya | |
|
555 | $ hg export --git tip > copy.diff | |
|
556 | $ hg up -C 0 | |
|
557 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
558 | $ hg import copy.diff | |
|
559 | applying copy.diff | |
|
560 | ||
|
561 | a should contain an 'a' | |
|
562 | ||
|
563 | $ cat a | |
|
564 | a | |
|
565 | ||
|
566 | and a2 should have duplicated it | |
|
567 | ||
|
568 | $ cat a2 | |
|
569 | a | |
|
570 | $ cd .. | |
|
571 | ||
|
572 | ||
|
573 | test -p0 | |
|
574 | ||
|
575 | $ hg init p0 | |
|
576 | $ cd p0 | |
|
577 | $ echo a > a | |
|
578 | $ hg ci -Am t | |
|
579 | adding a | |
|
580 | $ hg import -p0 - << EOF | |
|
581 | > foobar | |
|
582 | > --- a Sat Apr 12 22:43:58 2008 -0400 | |
|
583 | > +++ a Sat Apr 12 22:44:05 2008 -0400 | |
|
584 | > @@ -1,1 +1,1 @@ | |
|
585 | > -a | |
|
586 | > +bb | |
|
587 | > EOF | |
|
588 | applying patch from stdin | |
|
589 | $ hg status | |
|
590 | $ cat a | |
|
591 | bb | |
|
592 | $ cd .. | |
|
593 | ||
|
594 | ||
|
595 | test paths outside repo root | |
|
596 | ||
|
597 | $ mkdir outside | |
|
598 | $ touch outside/foo | |
|
599 | $ hg init inside | |
|
600 | $ cd inside | |
|
601 | $ hg import - <<EOF | |
|
602 | > diff --git a/a b/b | |
|
603 | > rename from ../outside/foo | |
|
604 | > rename to bar | |
|
605 | > EOF | |
|
606 | applying patch from stdin | |
|
607 | abort: ../outside/foo not under root | |
|
608 | $ cd .. | |
|
609 | ||
|
610 | ||
|
611 | test import with similarity and git and strip (issue295 et al.) | |
|
370 | 612 | |
|
371 | echo % 'first line mistaken for email headers (issue 1859)' | |
|
372 | hg init emailconfusion | |
|
373 | cd emailconfusion | |
|
374 | cat > a.patch <<EOF | |
|
613 | $ hg init sim | |
|
614 | $ cd sim | |
|
615 | $ echo 'this is a test' > a | |
|
616 | $ hg ci -Ama | |
|
617 | adding a | |
|
618 | $ cat > ../rename.diff <<EOF | |
|
619 | > diff --git a/foo/a b/foo/a | |
|
620 | > deleted file mode 100644 | |
|
621 | > --- a/foo/a | |
|
622 | > +++ /dev/null | |
|
623 | > @@ -1,1 +0,0 @@ | |
|
624 | > -this is a test | |
|
625 | > diff --git a/foo/b b/foo/b | |
|
626 | > new file mode 100644 | |
|
627 | > --- /dev/null | |
|
628 | > +++ b/foo/b | |
|
629 | > @@ -0,0 +1,2 @@ | |
|
630 | > +this is a test | |
|
631 | > +foo | |
|
632 | > EOF | |
|
633 | $ hg import --no-commit -v -s 1 ../rename.diff -p2 | |
|
634 | applying ../rename.diff | |
|
635 | patching file a | |
|
636 | patching file b | |
|
637 | removing a | |
|
638 | adding b | |
|
639 | recording removal of a as rename to b (88% similar) | |
|
640 | $ hg st -C | |
|
641 | A b | |
|
642 | a | |
|
643 | R a | |
|
644 | $ hg revert -a | |
|
645 | undeleting a | |
|
646 | forgetting b | |
|
647 | $ rm b | |
|
648 | $ hg import --no-commit -v -s 100 ../rename.diff -p2 | |
|
649 | applying ../rename.diff | |
|
650 | patching file a | |
|
651 | patching file b | |
|
652 | removing a | |
|
653 | adding b | |
|
654 | $ hg st -C | |
|
655 | A b | |
|
656 | R a | |
|
657 | $ cd .. | |
|
658 | ||
|
659 | ||
|
660 | add empty file from the end of patch (issue 1495) | |
|
661 | ||
|
662 | $ hg init addemptyend | |
|
663 | $ cd addemptyend | |
|
664 | $ touch a | |
|
665 | $ hg addremove | |
|
666 | adding a | |
|
667 | $ hg ci -m "commit" | |
|
668 | $ cat > a.patch <<EOF | |
|
669 | > diff --git a/a b/a | |
|
670 | > --- a/a | |
|
671 | > +++ b/a | |
|
672 | > @@ -0,0 +1,1 @@ | |
|
673 | > +a | |
|
674 | > diff --git a/b b/b | |
|
675 | > new file mode 100644 | |
|
676 | > EOF | |
|
677 | $ hg import --no-commit a.patch | |
|
678 | applying a.patch | |
|
679 | $ cd .. | |
|
680 | ||
|
681 | ||
|
682 | create file when source is not /dev/null | |
|
683 | ||
|
684 | $ cat > create.patch <<EOF | |
|
685 | > diff -Naur proj-orig/foo proj-new/foo | |
|
686 | > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 | |
|
687 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 | |
|
688 | > @@ -0,0 +1,1 @@ | |
|
689 | > +a | |
|
690 | > EOF | |
|
691 | ||
|
692 | some people have patches like the following too | |
|
693 | ||
|
694 | $ cat > create2.patch <<EOF | |
|
695 | > diff -Naur proj-orig/foo proj-new/foo | |
|
696 | > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 | |
|
697 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 | |
|
698 | > @@ -0,0 +1,1 @@ | |
|
699 | > +a | |
|
700 | > EOF | |
|
701 | $ hg init oddcreate | |
|
702 | $ cd oddcreate | |
|
703 | $ hg import --no-commit ../create.patch | |
|
704 | applying ../create.patch | |
|
705 | $ cat foo | |
|
706 | a | |
|
707 | $ rm foo | |
|
708 | $ hg revert foo | |
|
709 | $ hg import --no-commit ../create2.patch | |
|
710 | applying ../create2.patch | |
|
711 | $ cat foo | |
|
712 | a | |
|
713 | ||
|
714 | ||
|
715 | first line mistaken for email headers (issue 1859) | |
|
716 | ||
|
717 | $ hg init emailconfusion | |
|
718 | $ cd emailconfusion | |
|
719 | $ cat > a.patch <<EOF | |
|
720 | > module: summary | |
|
721 | > | |
|
722 | > description | |
|
723 | > | |
|
724 | > | |
|
725 | > diff -r 000000000000 -r 9b4c1e343b55 test.txt | |
|
726 | > --- /dev/null | |
|
727 | > +++ b/a | |
|
728 | > @@ -0,0 +1,1 @@ | |
|
729 | > +a | |
|
730 | > EOF | |
|
731 | $ hg import -d '0 0' a.patch | |
|
732 | applying a.patch | |
|
733 | $ hg parents -v | |
|
734 | changeset: 0:5a681217c0ad | |
|
735 | tag: tip | |
|
736 | user: test | |
|
737 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
738 | files: a | |
|
739 | description: | |
|
375 | 740 | module: summary |
|
376 | 741 | |
|
377 | 742 | description |
|
378 | 743 | |
|
379 | 744 | |
|
380 | diff -r 000000000000 -r 9b4c1e343b55 test.txt | |
|
381 | --- /dev/null | |
|
382 | +++ b/a | |
|
383 | @@ -0,0 +1,1 @@ | |
|
384 | +a | |
|
385 | EOF | |
|
386 | hg import -d '0 0' a.patch | |
|
387 | hg parents -v | |
|
388 | cd .. | |
|
745 | $ cd .. | |
|
746 | ||
|
747 | ||
|
748 | --- in commit message | |
|
389 | 749 | |
|
390 | echo % '--- in commit message' | |
|
391 |
|
|
|
392 | cd commitconfusion | |
|
393 | cat > a.patch <<EOF | |
|
750 | $ hg init commitconfusion | |
|
751 | $ cd commitconfusion | |
|
752 | $ cat > a.patch <<EOF | |
|
753 | > module: summary | |
|
754 | > | |
|
755 | > --- description | |
|
756 | > | |
|
757 | > diff --git a/a b/a | |
|
758 | > new file mode 100644 | |
|
759 | > --- /dev/null | |
|
760 | > +++ b/a | |
|
761 | > @@ -0,0 +1,1 @@ | |
|
762 | > +a | |
|
763 | > EOF | |
|
764 | > hg import -d '0 0' a.patch | |
|
765 | > hg parents -v | |
|
766 | > cd .. | |
|
767 | > | |
|
768 | > echo '% tricky header splitting' | |
|
769 | > cat > trickyheaders.patch <<EOF | |
|
770 | > From: User A <user@a> | |
|
771 | > Subject: [PATCH] from: tricky! | |
|
772 | > | |
|
773 | > # HG changeset patch | |
|
774 | > # User User B | |
|
775 | > # Date 1266264441 18000 | |
|
776 | > # Branch stable | |
|
777 | > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 | |
|
778 | > # Parent 0000000000000000000000000000000000000000 | |
|
779 | > from: tricky! | |
|
780 | > | |
|
781 | > That is not a header. | |
|
782 | > | |
|
783 | > diff -r 000000000000 -r f2be6a1170ac foo | |
|
784 | > --- /dev/null | |
|
785 | > +++ b/foo | |
|
786 | > @@ -0,0 +1,1 @@ | |
|
787 | > +foo | |
|
788 | > EOF | |
|
789 | applying a.patch | |
|
790 | changeset: 0:f34d9187897d | |
|
791 | tag: tip | |
|
792 | user: test | |
|
793 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
794 | files: a | |
|
795 | description: | |
|
394 | 796 | module: summary |
|
395 | 797 | |
|
396 | --- description | |
|
798 | ||
|
799 | % tricky header splitting | |
|
397 | 800 | |
|
398 | diff --git a/a b/a | |
|
399 | new file mode 100644 | |
|
400 | --- /dev/null | |
|
401 | +++ b/a | |
|
402 | @@ -0,0 +1,1 @@ | |
|
403 | +a | |
|
404 | EOF | |
|
405 | hg import -d '0 0' a.patch | |
|
406 | hg parents -v | |
|
407 | cd .. | |
|
408 | ||
|
409 | echo '% tricky header splitting' | |
|
410 | cat > trickyheaders.patch <<EOF | |
|
411 | From: User A <user@a> | |
|
412 | Subject: [PATCH] from: tricky! | |
|
413 | ||
|
801 | $ hg init trickyheaders | |
|
802 | $ cd trickyheaders | |
|
803 | $ hg import -d '0 0' ../trickyheaders.patch | |
|
804 | applying ../trickyheaders.patch | |
|
805 | $ hg export --git tip | |
|
414 | 806 | # HG changeset patch |
|
415 | 807 | # User User B |
|
416 | # Date 1266264441 18000 | |
|
417 | # Branch stable | |
|
418 | # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 | |
|
808 | # Date 0 0 | |
|
809 | # Node ID eb56ab91903632294ac504838508cb370c0901d2 | |
|
419 | 810 | # Parent 0000000000000000000000000000000000000000 |
|
420 | 811 | from: tricky! |
|
421 | 812 | |
|
422 | 813 | That is not a header. |
|
423 | 814 | |
|
424 | diff -r 000000000000 -r f2be6a1170ac foo | |
|
815 | diff --git a/foo b/foo | |
|
816 | new file mode 100644 | |
|
425 | 817 | --- /dev/null |
|
426 | 818 | +++ b/foo |
|
427 | 819 | @@ -0,0 +1,1 @@ |
|
428 | 820 | +foo |
|
429 | EOF | |
|
821 | $ cd .. | |
|
430 | 822 | |
|
431 | hg init trickyheaders | |
|
432 | cd trickyheaders | |
|
433 | hg import -d '0 0' ../trickyheaders.patch | |
|
434 | hg export --git tip | |
|
435 | cd .. | |
|
823 | ||
|
824 | issue2102 | |
|
436 | 825 | |
|
437 |
|
|
|
438 |
|
|
|
439 | cd issue2102 | |
|
440 | mkdir -p src/cmd/gc | |
|
441 | touch src/cmd/gc/mksys.bash | |
|
442 | hg ci -Am init | |
|
443 | hg import - <<EOF | |
|
444 | # HG changeset patch | |
|
445 | # User Rob Pike | |
|
446 | # Date 1216685449 25200 | |
|
447 | # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 | |
|
448 | # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 | |
|
826 | $ hg init issue2102 | |
|
827 | $ cd issue2102 | |
|
828 | $ mkdir -p src/cmd/gc | |
|
829 | $ touch src/cmd/gc/mksys.bash | |
|
830 | $ hg ci -Am init | |
|
831 | adding src/cmd/gc/mksys.bash | |
|
832 | $ hg import - <<EOF | |
|
833 | > # HG changeset patch | |
|
834 | > # User Rob Pike | |
|
835 | > # Date 1216685449 25200 | |
|
836 | > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 | |
|
837 | > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 | |
|
838 | > help management of empty pkg and lib directories in perforce | |
|
839 | > | |
|
840 | > R=gri | |
|
841 | > DELTA=4 (4 added, 0 deleted, 0 changed) | |
|
842 | > OCL=13328 | |
|
843 | > CL=13328 | |
|
844 | > | |
|
845 | > diff --git a/lib/place-holder b/lib/place-holder | |
|
846 | > new file mode 100644 | |
|
847 | > --- /dev/null | |
|
848 | > +++ b/lib/place-holder | |
|
849 | > @@ -0,0 +1,2 @@ | |
|
850 | > +perforce does not maintain empty directories. | |
|
851 | > +this file helps. | |
|
852 | > diff --git a/pkg/place-holder b/pkg/place-holder | |
|
853 | > new file mode 100644 | |
|
854 | > --- /dev/null | |
|
855 | > +++ b/pkg/place-holder | |
|
856 | > @@ -0,0 +1,2 @@ | |
|
857 | > +perforce does not maintain empty directories. | |
|
858 | > +this file helps. | |
|
859 | > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash | |
|
860 | > old mode 100644 | |
|
861 | > new mode 100755 | |
|
862 | > EOF | |
|
863 | applying patch from stdin | |
|
864 | $ hg sum | |
|
865 | parent: 1:d59915696727 tip | |
|
449 | 866 | help management of empty pkg and lib directories in perforce |
|
450 | ||
|
451 | R=gri | |
|
452 | DELTA=4 (4 added, 0 deleted, 0 changed) | |
|
453 | OCL=13328 | |
|
454 | CL=13328 | |
|
455 | ||
|
867 | branch: default | |
|
868 | commit: (clean) | |
|
869 | update: (current) | |
|
870 | $ hg diff --git -c tip | |
|
456 | 871 | diff --git a/lib/place-holder b/lib/place-holder |
|
457 | 872 | new file mode 100644 |
|
458 | 873 | --- /dev/null |
|
459 | 874 | +++ b/lib/place-holder |
|
460 | 875 | @@ -0,0 +1,2 @@ |
|
461 | 876 | +perforce does not maintain empty directories. |
|
462 | 877 | +this file helps. |
|
463 | 878 | diff --git a/pkg/place-holder b/pkg/place-holder |
|
464 | 879 | new file mode 100644 |
|
465 | 880 | --- /dev/null |
|
466 | 881 | +++ b/pkg/place-holder |
|
467 | 882 | @@ -0,0 +1,2 @@ |
|
468 | 883 | +perforce does not maintain empty directories. |
|
469 | 884 | +this file helps. |
|
470 | 885 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
471 | 886 | old mode 100644 |
|
472 | 887 | new mode 100755 |
|
473 | EOF | |
|
474 | hg sum | |
|
475 | hg diff --git -c tip | |
|
476 | cd .. | |
|
888 | $ cd .. | |
|
889 | ||
|
890 | ||
|
891 | diff lines looking like headers | |
|
477 | 892 | |
|
478 |
|
|
|
479 |
|
|
|
480 | cd difflineslikeheaders | |
|
481 |
|
|
|
482 |
|
|
|
483 | echo c >c | |
|
484 | hg ci -Am1 | |
|
893 | $ hg init difflineslikeheaders | |
|
894 | $ cd difflineslikeheaders | |
|
895 | $ echo a >a | |
|
896 | $ echo b >b | |
|
897 | $ echo c >c | |
|
898 | $ hg ci -Am1 | |
|
899 | adding a | |
|
900 | adding b | |
|
901 | adding c | |
|
485 | 902 | |
|
486 | echo "key: value" >>a | |
|
487 | echo "key: value" >>b | |
|
488 | echo "foo" >>c | |
|
489 | hg ci -m2 | |
|
903 | $ echo "key: value" >>a | |
|
904 | $ echo "key: value" >>b | |
|
905 | $ echo "foo" >>c | |
|
906 | $ hg ci -m2 | |
|
490 | 907 | |
|
491 | hg up -C 0 | |
|
492 | hg diff --git -c1 >want | |
|
493 | hg diff -c1 | hg import --no-commit - | |
|
494 | hg diff --git >have | |
|
495 | diff want have | |
|
496 | cd .. | |
|
908 | $ hg up -C 0 | |
|
909 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
910 | $ hg diff --git -c1 >want | |
|
911 | $ hg diff -c1 | hg import --no-commit - | |
|
912 | applying patch from stdin | |
|
913 | $ hg diff --git >have | |
|
914 | $ diff want have | |
|
915 | $ cd .. | |
|
497 | 916 |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now