Show More
This diff has been collapsed as it changes many lines, (1247 lines changed) Show them Hide them | |||||
@@ -1,458 +1,873 b'' | |||||
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 |
|
10 | $ echo line 2 >> a/a | |
4 | mkdir a/d1 |
|
11 | $ hg --cwd a ci -u someone -d '1 0' -m'second change' | |
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 |
|
|||
9 |
|
12 | |||
10 | echo line 2 >> a/a |
|
13 | ||
11 | hg --cwd a ci -u someone -d '1 0' -m'second change' |
|
14 | import exported patch | |
12 |
|
15 | |||
13 | echo % import exported patch |
|
16 | $ hg clone -r0 a b | |
14 | hg clone -r0 a b |
|
17 | requesting all changes | |
15 | hg --cwd a export tip > tip.patch |
|
18 | adding changesets | |
16 | hg --cwd b import ../tip.patch |
|
19 | adding manifests | |
17 | echo % message should be same |
|
20 | adding file changes | |
18 | hg --cwd b tip | grep 'second change' |
|
21 | added 1 changesets with 2 changes to 2 files | |
19 | echo % committer should be same |
|
22 | updating to branch default | |
20 | hg --cwd b tip | grep someone |
|
23 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
21 | rm -r b |
|
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 |
|
28 | message should be same | |
24 | cat > dummypatch.py <<EOF |
|
29 | ||
25 | print 'patching file a' |
|
30 | $ hg --cwd b tip | grep 'second change' | |
26 | file('a', 'wb').write('line2\n') |
|
31 | summary: second change | |
27 | EOF |
|
32 | ||
28 | chmod +x dummypatch.py |
|
33 | committer should be same | |
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 |
|
|||
34 |
|
34 | |||
35 | echo % import of plain diff should fail without message |
|
35 | $ hg --cwd b tip | grep someone | |
36 | hg clone -r0 a b |
|
36 | user: someone | |
37 | hg --cwd a diff -r0:1 > tip.patch |
|
37 | $ rm -r b | |
38 | hg --cwd b import ../tip.patch |
|
38 | ||
39 | rm -r b |
|
39 | ||
|
40 | import exported patch with external patcher | |||
40 |
|
41 | |||
41 | echo % import of plain diff should be ok with message |
|
42 | $ cat > dummypatch.py <<EOF | |
42 | hg clone -r0 a b |
|
43 | > print 'patching file a' | |
43 | hg --cwd a diff -r0:1 > tip.patch |
|
44 | > file('a', 'wb').write('line2\n') | |
44 | hg --cwd b import -mpatch ../tip.patch |
|
45 | > EOF | |
45 | rm -r b |
|
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 |
|
|
63 | import of plain diff should fail without message | |
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 |
|
|||
60 |
|
64 | |||
61 | echo % hg -R repo import |
|
65 | $ hg clone -r0 a b | |
62 | # put the clone in a subdir - having a directory named "a" |
|
66 | requesting all changes | |
63 | # used to hide a bug. |
|
67 | adding changesets | |
64 | mkdir dir |
|
68 | adding manifests | |
65 | hg clone -r0 a dir/b |
|
69 | adding file changes | |
66 | hg --cwd a export tip > dir/tip.patch |
|
70 | added 1 changesets with 2 changes to 2 files | |
67 | cd dir |
|
71 | updating to branch default | |
68 | hg -R b import tip.patch |
|
72 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
69 | cd .. |
|
73 | $ hg --cwd a diff -r0:1 > tip.patch | |
70 | rm -r dir |
|
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 |
|
80 | import of plain diff should be ok with message | |
73 | hg clone -r0 a b |
|
|||
74 | hg --cwd a export tip | hg --cwd b import - |
|
|||
75 | rm -r b |
|
|||
76 |
|
81 | |||
77 | echo % import two patches in one stream |
|
82 | $ hg clone -r0 a b | |
78 | hg init b |
|
83 | requesting all changes | |
79 | hg --cwd a export 0:tip | hg --cwd b import - |
|
84 | adding changesets | |
80 | hg --cwd a id |
|
85 | adding manifests | |
81 | hg --cwd b id |
|
86 | adding file changes | |
82 | rm -r b |
|
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 |
|
98 | $ hg clone -r0 a b | |
85 | hg clone -r0 a b |
|
99 | requesting all changes | |
86 | hg --cwd a export tip | hg --cwd b import -m 'override' - |
|
100 | adding changesets | |
87 | hg --cwd b tip | grep override |
|
101 | adding manifests | |
88 | rm -r b |
|
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 |
|
118 | ||
91 | import email.Message, sys |
|
119 | diff -r 80971e65b431 -r ca68f19f3a40 a | |
92 | msg = email.Message.Message() |
|
120 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
93 | msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) |
|
121 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |
94 | msg['Subject'] = 'email patch' |
|
122 | @@ -1,1 +1,2 @@ | |
95 | msg['From'] = 'email patcher' |
|
123 | line 1 | |
96 | sys.stdout.write(msg.as_string()) |
|
124 | +line 2 | |
97 | EOF |
|
|||
98 |
|
125 | |||
99 | echo % plain diff in email, subject, message body |
|
126 | $ rm -r b | |
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 |
|
|||
106 |
|
127 | |||
107 | echo % plain diff in email, no subject, message body |
|
128 | ||
108 | hg clone -r0 a b |
|
129 | import of plain diff should be ok with --no-commit | |
109 | grep -v '^Subject:' msg.patch | hg --cwd b import - |
|
|||
110 | rm -r b |
|
|||
111 |
|
130 | |||
112 | echo % plain diff in email, subject, no message body |
|
131 | $ hg clone -r0 a b | |
113 | hg clone -r0 a b |
|
132 | requesting all changes | |
114 | grep -v '^email ' msg.patch | hg --cwd b import - |
|
133 | adding changesets | |
115 | rm -r b |
|
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 |
|
152 | hg -R repo import | |
123 | hg clone -r0 a b |
|
153 | put the clone in a subdir - having a directory named "a" | |
124 | hg --cwd a export tip > tip.patch |
|
154 | used to hide a bug. | |
125 | python mkmsg.py | hg --cwd b import - |
|
|||
126 | hg --cwd b tip | grep second |
|
|||
127 | rm -r b |
|
|||
128 |
|
155 | |||
129 | # subject: duplicate detection, removal of [PATCH] |
|
156 | $ mkdir dir | |
130 | # The '---' tests the gitsendmail handling without proper mail headers |
|
157 | $ hg clone -r0 a dir/b | |
131 | cat > mkmsg2.py <<EOF |
|
158 | requesting all changes | |
132 | import email.Message, sys |
|
159 | adding changesets | |
133 | msg = email.Message.Message() |
|
160 | adding manifests | |
134 | msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) |
|
161 | adding file changes | |
135 | msg['Subject'] = '[PATCH] email patch' |
|
162 | added 1 changesets with 2 changes to 2 files | |
136 | msg['From'] = 'email patcher' |
|
163 | updating to branch default | |
137 | sys.stdout.write(msg.as_string()) |
|
164 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
138 | EOF |
|
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' |
|
173 | import from stdin | |
141 | hg clone -r0 a b |
|
174 | ||
142 | hg --cwd a diff -r0:1 > tip.patch |
|
175 | $ hg clone -r0 a b | |
143 | python mkmsg2.py | hg --cwd b import - |
|
176 | requesting all changes | |
144 | hg --cwd b tip --template '{desc}\n' |
|
177 | adding changesets | |
145 | rm -r b |
|
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 |
|
190 | $ hg init b | |
148 | # (issue963) |
|
191 | $ hg --cwd a export 0:tip | hg --cwd b import - | |
149 | echo '% import patch1 patch2; rollback' |
|
192 | applying patch from stdin | |
150 | echo line 3 >> a/a |
|
193 | applied 80971e65b431 | |
151 | hg --cwd a ci -m'third change' |
|
194 | $ hg --cwd a id | |
152 | hg --cwd a export -o '../patch%R' 1 2 |
|
195 | 1d4bd90af0e4 tip | |
153 | hg clone -qr0 a b |
|
196 | $ hg --cwd b id | |
154 | hg --cwd b parents --template 'parent: {rev}\n' |
|
197 | 1d4bd90af0e4 tip | |
155 | hg --cwd b import ../patch1 ../patch2 |
|
198 | $ rm -r b | |
156 | hg --cwd b rollback |
|
199 | ||
157 | hg --cwd b parents --template 'parent: {rev}\n' |
|
200 | ||
158 | rm -r b |
|
201 | override commit message | |
159 |
|
202 | |||
160 | # bug non regression test |
|
203 | $ hg clone -r0 a b | |
161 | # importing a patch in a subdirectory failed at the commit stage |
|
204 | requesting all changes | |
162 | echo line 2 >> a/d1/d2/a |
|
205 | adding changesets | |
163 | hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' |
|
206 | adding manifests | |
164 | echo % hg import in a subdirectory |
|
207 | adding file changes | |
165 | hg clone -r0 a b |
|
208 | added 1 changesets with 2 changes to 2 files | |
166 | hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch |
|
209 | updating to branch default | |
167 | dir=`pwd` |
|
210 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
168 | cd b/d1/d2 2>&1 > /dev/null |
|
211 | $ hg --cwd a export tip | hg --cwd b import -m 'override' - | |
169 | hg import ../../../tip.patch |
|
212 | applying patch from stdin | |
170 | cd "$dir" |
|
213 | $ hg --cwd b tip | grep override | |
171 | echo "% message should be 'subdir change'" |
|
214 | summary: override | |
172 | hg --cwd b tip | grep 'subdir change' |
|
215 | $ rm -r b | |
173 | echo "% committer should be 'someoneelse'" |
|
216 | ||
174 | hg --cwd b tip | grep someoneelse |
|
217 | $ cat > mkmsg.py <<EOF | |
175 | echo "% should be empty" |
|
218 | > import email.Message, sys | |
176 | hg --cwd b status |
|
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) |
|
227 | plain diff in email, subject, message body | |
180 | echo % test fuzziness |
|
228 | ||
181 | hg init fuzzy |
|
229 | $ hg clone -r0 a b | |
182 | cd fuzzy |
|
230 | requesting all changes | |
183 | echo line1 > a |
|
231 | adding changesets | |
184 | echo line0 >> a |
|
232 | adding manifests | |
185 | echo line3 >> a |
|
233 | adding file changes | |
186 | hg ci -Am adda |
|
234 | added 1 changesets with 2 changes to 2 files | |
187 | echo line1 > a |
|
235 | updating to branch default | |
188 | echo line2 >> a |
|
236 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
189 | echo line0 >> a |
|
237 | $ hg --cwd a diff -r0:1 > tip.patch | |
190 | echo line3 >> a |
|
238 | $ python mkmsg.py > msg.patch | |
191 | hg ci -m change a |
|
239 | $ hg --cwd b import ../msg.patch | |
192 | hg export tip > tip.patch |
|
240 | applying ../msg.patch | |
193 | hg up -C 0 |
|
241 | $ hg --cwd b tip | grep email | |
194 | echo line1 > a |
|
242 | user: email patcher | |
195 | echo line0 >> a |
|
243 | summary: email patch | |
196 | echo line1 >> a |
|
244 | $ rm -r b | |
197 | echo line0 >> a |
|
245 | ||
198 | hg ci -m brancha |
|
246 | ||
199 | hg import --no-commit -v tip.patch |
|
247 | plain diff in email, no subject, message body | |
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 .. |
|
|||
204 |
|
248 | |||
205 | # Test hunk touching empty files (issue906) |
|
249 | $ hg clone -r0 a b | |
206 | hg init empty |
|
250 | requesting all changes | |
207 | cd empty |
|
251 | adding changesets | |
208 | touch a |
|
252 | adding manifests | |
209 | touch b1 |
|
253 | adding file changes | |
210 | touch c1 |
|
254 | added 1 changesets with 2 changes to 2 files | |
211 | echo d > d |
|
255 | updating to branch default | |
212 | hg ci -Am init |
|
256 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
213 | echo a > a |
|
257 | $ grep -v '^Subject:' msg.patch | hg --cwd b import - | |
214 | echo b > b1 |
|
258 | applying patch from stdin | |
215 | hg mv b1 b2 |
|
259 | $ rm -r b | |
216 | echo c > c1 |
|
260 | ||
217 | hg copy c1 c2 |
|
261 | ||
218 | rm d |
|
262 | plain diff in email, subject, no message body | |
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 .. |
|
|||
231 |
|
263 | |||
232 | # Test importing a patch ending with a binary file removal |
|
264 | $ hg clone -r0 a b | |
233 | echo % test trailing binary removal |
|
265 | requesting all changes | |
234 | hg init binaryremoval |
|
266 | adding changesets | |
235 | cd binaryremoval |
|
267 | adding manifests | |
236 | echo a > a |
|
268 | adding file changes | |
237 | python -c "file('b', 'wb').write('a\x00b')" |
|
269 | added 1 changesets with 2 changes to 2 files | |
238 | hg ci -Am addall |
|
270 | updating to branch default | |
239 | hg rm a |
|
271 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
240 | hg rm b |
|
272 | $ grep -v '^email ' msg.patch | hg --cwd b import - | |
241 | hg st |
|
273 | applying patch from stdin | |
242 | hg ci -m remove |
|
274 | $ rm -r b | |
243 | hg export --git . > remove.diff |
|
275 | ||
244 | cat remove.diff | grep git |
|
276 | ||
245 | hg up -C 0 |
|
277 | plain diff in email, no subject, no message body, should fail | |
246 | hg import remove.diff |
|
|||
247 | hg manifest |
|
|||
248 | cd .. |
|
|||
249 |
|
278 | |||
250 | echo % 'test update+rename with common name (issue 927)' |
|
279 | $ hg clone -r0 a b | |
251 | hg init t |
|
280 | requesting all changes | |
252 | cd t |
|
281 | adding changesets | |
253 | touch a |
|
282 | adding manifests | |
254 | hg ci -Am t |
|
283 | adding file changes | |
255 | echo a > a |
|
284 | added 1 changesets with 2 changes to 2 files | |
256 | # Here, bfile.startswith(afile) |
|
285 | updating to branch default | |
257 | hg copy a a2 |
|
286 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
258 | hg ci -m copya |
|
287 | $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - | |
259 | hg export --git tip > copy.diff |
|
288 | applying patch from stdin | |
260 | hg up -C 0 |
|
289 | abort: empty commit message | |
261 | hg import copy.diff |
|
290 | $ rm -r b | |
262 | echo % view a |
|
291 | ||
263 | # a should contain an 'a' |
|
292 | ||
264 | cat a |
|
293 | hg export in email, should use patch header | |
265 | echo % view a2 |
|
|||
266 | # and a2 should have duplicated it |
|
|||
267 | cat a2 |
|
|||
268 | cd .. |
|
|||
269 |
|
294 | |||
270 | echo % 'test -p0' |
|
295 | $ hg clone -r0 a b | |
271 | hg init p0 |
|
296 | requesting all changes | |
272 | cd p0 |
|
297 | adding changesets | |
273 | echo a > a |
|
298 | adding manifests | |
274 | hg ci -Am t |
|
299 | adding file changes | |
275 | hg import -p0 - << EOF |
|
300 | added 1 changesets with 2 changes to 2 files | |
276 | foobar |
|
301 | updating to branch default | |
277 | --- a Sat Apr 12 22:43:58 2008 -0400 |
|
302 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
278 | +++ a Sat Apr 12 22:44:05 2008 -0400 |
|
303 | $ hg --cwd a export tip > tip.patch | |
279 | @@ -1,1 +1,1 @@ |
|
304 | $ python mkmsg.py | hg --cwd b import - | |
280 | -a |
|
305 | applying patch from stdin | |
281 | +bb |
|
306 | $ hg --cwd b tip | grep second | |
282 | EOF |
|
307 | summary: second change | |
283 | hg status |
|
308 | $ rm -r b | |
284 | cat a |
|
309 | ||
285 | cd .. |
|
|||
286 |
|
310 | |||
287 | echo % 'test paths outside repo root' |
|
311 | subject: duplicate detection, removal of [PATCH] | |
288 | mkdir outside |
|
312 | The '---' tests the gitsendmail handling without proper mail headers | |
289 | touch outside/foo |
|
313 | ||
290 | hg init inside |
|
314 | $ cat > mkmsg2.py <<EOF | |
291 | cd inside |
|
315 | > import email.Message, sys | |
292 | hg import - <<EOF |
|
316 | > msg = email.Message.Message() | |
293 | diff --git a/a b/b |
|
317 | > msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) | |
294 | rename from ../outside/foo |
|
318 | > msg['Subject'] = '[PATCH] email patch' | |
295 | rename to bar |
|
319 | > msg['From'] = 'email patcher' | |
296 | EOF |
|
320 | > sys.stdout.write(msg.as_string()) | |
297 | cd .. |
|
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.)' |
|
326 | $ hg clone -r0 a b | |
300 | hg init sim |
|
327 | requesting all changes | |
301 | cd sim |
|
328 | adding changesets | |
302 | echo 'this is a test' > a |
|
329 | adding manifests | |
303 | hg ci -Ama |
|
330 | adding file changes | |
304 | cat > ../rename.diff <<EOF |
|
331 | added 1 changesets with 2 changes to 2 files | |
305 | diff --git a/foo/a b/foo/a |
|
332 | updating to branch default | |
306 | deleted file mode 100644 |
|
333 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
307 | --- a/foo/a |
|
334 | $ hg --cwd a diff -r0:1 > tip.patch | |
308 | +++ /dev/null |
|
335 | $ python mkmsg2.py | hg --cwd b import - | |
309 | @@ -1,1 +0,0 @@ |
|
336 | applying patch from stdin | |
310 | -this is a test |
|
337 | $ hg --cwd b tip --template '{desc}\n' | |
311 | diff --git a/foo/b b/foo/b |
|
338 | email patch | |
312 | new file mode 100644 |
|
339 | ||
313 | --- /dev/null |
|
340 | next line | |
314 | +++ b/foo/b |
|
341 | --- | |
315 | @@ -0,0 +1,2 @@ |
|
342 | $ rm -r b | |
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 |
|
343 | |||
327 |
|
344 | |||
328 | echo '% add empty file from the end of patch (issue 1495)' |
|
345 | We weren't backing up the correct dirstate file when importing many patches | |
329 | hg init addemptyend |
|
346 | (issue963) | |
330 | cd addemptyend |
|
347 | import patch1 patch2; rollback | |
331 | touch a |
|
348 | ||
332 | hg addremove |
|
349 | $ echo line 3 >> a/a | |
333 | hg ci -m "commit" |
|
350 | $ hg --cwd a ci -m'third change' | |
334 | cat > a.patch <<EOF |
|
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 | diff --git a/a b/a |
|
463 | diff --git a/a b/a | |
336 | --- a/a |
|
464 | --- a/a | |
337 | +++ b/a |
|
465 | +++ b/a | |
338 | @@ -0,0 +1,1 @@ |
|
466 | @@ -0,0 +1,1 @@ | |
339 | +a |
|
467 | +a | |
340 | diff --git a/b b/b |
|
468 | diff --git a/b1 b/b2 | |
341 | new file mode 100644 |
|
469 | rename from b1 | |
342 | EOF |
|
470 | rename to b2 | |
343 | hg import --no-commit a.patch |
|
471 | --- a/b1 | |
344 | cd .. |
|
472 | +++ b/b2 | |
345 |
|
473 | @@ -0,0 +1,1 @@ | ||
346 | echo '% create file when source is not /dev/null' |
|
474 | +b | |
347 | cat > create.patch <<EOF |
|
475 | diff --git a/c1 b/c1 | |
348 | diff -Naur proj-orig/foo proj-new/foo |
|
476 | --- a/c1 | |
349 | --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 |
|
477 | +++ b/c1 | |
350 | +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
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 | @@ -0,0 +1,1 @@ |
|
485 | @@ -0,0 +1,1 @@ | |
352 | +a |
|
486 | +c | |
353 | EOF |
|
487 | diff --git a/d b/d | |
354 | # some people have patches like the following too |
|
488 | --- a/d | |
355 | cat > create2.patch <<EOF |
|
489 | +++ b/d | |
356 | diff -Naur proj-orig/foo proj-new/foo |
|
490 | @@ -1,1 +0,0 @@ | |
357 | --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 |
|
491 | -d | |
358 | +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
492 | $ hg ci -m empty | |
359 | @@ -0,0 +1,1 @@ |
|
493 | $ hg export --git tip > empty.diff | |
360 | +a |
|
494 | $ hg up -C 0 | |
361 | EOF |
|
495 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
362 | hg init oddcreate |
|
496 | $ hg import empty.diff | |
363 | cd oddcreate |
|
497 | applying empty.diff | |
364 | hg import --no-commit ../create.patch |
|
498 | $ for name in a b1 b2 c1 c2 d; do | |
365 | cat foo |
|
499 | > echo % $name file | |
366 | rm foo |
|
500 | > test -f $name && cat $name | |
367 | hg revert foo |
|
501 | > done | |
368 | hg import --no-commit ../create2.patch |
|
502 | % a file | |
369 | cat foo |
|
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)' |
|
613 | $ hg init sim | |
372 | hg init emailconfusion |
|
614 | $ cd sim | |
373 | cd emailconfusion |
|
615 | $ echo 'this is a test' > a | |
374 | cat > a.patch <<EOF |
|
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 | module: summary |
|
740 | module: summary | |
376 |
|
741 | |||
377 | description |
|
742 | description | |
378 |
|
743 | |||
379 |
|
744 | |||
380 | diff -r 000000000000 -r 9b4c1e343b55 test.txt |
|
745 | $ cd .. | |
381 | --- /dev/null |
|
746 | ||
382 | +++ b/a |
|
747 | ||
383 | @@ -0,0 +1,1 @@ |
|
748 | --- in commit message | |
384 | +a |
|
|||
385 | EOF |
|
|||
386 | hg import -d '0 0' a.patch |
|
|||
387 | hg parents -v |
|
|||
388 | cd .. |
|
|||
389 |
|
749 | |||
390 | echo % '--- in commit message' |
|
750 | $ hg init commitconfusion | |
391 |
|
|
751 | $ cd commitconfusion | |
392 | cd commitconfusion |
|
752 | $ cat > a.patch <<EOF | |
393 | 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 | module: summary |
|
796 | module: summary | |
395 |
|
797 | |||
396 | --- description |
|
798 | ||
|
799 | % tricky header splitting | |||
397 |
|
800 | |||
398 | diff --git a/a b/a |
|
801 | $ hg init trickyheaders | |
399 | new file mode 100644 |
|
802 | $ cd trickyheaders | |
400 | --- /dev/null |
|
803 | $ hg import -d '0 0' ../trickyheaders.patch | |
401 | +++ b/a |
|
804 | applying ../trickyheaders.patch | |
402 | @@ -0,0 +1,1 @@ |
|
805 | $ hg export --git tip | |
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 |
|
||||
414 | # HG changeset patch |
|
806 | # HG changeset patch | |
415 | # User User B |
|
807 | # User User B | |
416 | # Date 1266264441 18000 |
|
808 | # Date 0 0 | |
417 | # Branch stable |
|
809 | # Node ID eb56ab91903632294ac504838508cb370c0901d2 | |
418 | # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 |
|
|||
419 | # Parent 0000000000000000000000000000000000000000 |
|
810 | # Parent 0000000000000000000000000000000000000000 | |
420 | from: tricky! |
|
811 | from: tricky! | |
421 |
|
812 | |||
422 | That is not a header. |
|
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 | --- /dev/null |
|
817 | --- /dev/null | |
426 | +++ b/foo |
|
818 | +++ b/foo | |
427 | @@ -0,0 +1,1 @@ |
|
819 | @@ -0,0 +1,1 @@ | |
428 | +foo |
|
820 | +foo | |
429 | EOF |
|
821 | $ cd .. | |
430 |
|
822 | |||
431 | hg init trickyheaders |
|
823 | ||
432 | cd trickyheaders |
|
824 | issue2102 | |
433 | hg import -d '0 0' ../trickyheaders.patch |
|
|||
434 | hg export --git tip |
|
|||
435 | cd .. |
|
|||
436 |
|
825 | |||
437 |
|
|
826 | $ hg init issue2102 | |
438 |
|
|
827 | $ cd issue2102 | |
439 | cd issue2102 |
|
828 | $ mkdir -p src/cmd/gc | |
440 | mkdir -p src/cmd/gc |
|
829 | $ touch src/cmd/gc/mksys.bash | |
441 | touch src/cmd/gc/mksys.bash |
|
830 | $ hg ci -Am init | |
442 | hg ci -Am init |
|
831 | adding src/cmd/gc/mksys.bash | |
443 | hg import - <<EOF |
|
832 | $ hg import - <<EOF | |
444 | # HG changeset patch |
|
833 | > # HG changeset patch | |
445 | # User Rob Pike |
|
834 | > # User Rob Pike | |
446 | # Date 1216685449 25200 |
|
835 | > # Date 1216685449 25200 | |
447 | # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 |
|
836 | > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 | |
448 | # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 |
|
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 | help management of empty pkg and lib directories in perforce |
|
866 | help management of empty pkg and lib directories in perforce | |
450 |
|
867 | branch: default | ||
451 | R=gri |
|
868 | commit: (clean) | |
452 | DELTA=4 (4 added, 0 deleted, 0 changed) |
|
869 | update: (current) | |
453 | OCL=13328 |
|
870 | $ hg diff --git -c tip | |
454 | CL=13328 |
|
|||
455 |
|
||||
456 | diff --git a/lib/place-holder b/lib/place-holder |
|
871 | diff --git a/lib/place-holder b/lib/place-holder | |
457 | new file mode 100644 |
|
872 | new file mode 100644 | |
458 | --- /dev/null |
|
873 | --- /dev/null | |
@@ -470,28 +885,32 b' new file mode 100644' | |||||
470 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
885 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash | |
471 | old mode 100644 |
|
886 | old mode 100644 | |
472 | new mode 100755 |
|
887 | new mode 100755 | |
473 | EOF |
|
888 | $ cd .. | |
474 | hg sum |
|
889 | ||
475 | hg diff --git -c tip |
|
890 | ||
476 | cd .. |
|
891 | diff lines looking like headers | |
477 |
|
892 | |||
478 |
|
|
893 | $ hg init difflineslikeheaders | |
479 |
|
|
894 | $ cd difflineslikeheaders | |
480 | cd difflineslikeheaders |
|
895 | $ echo a >a | |
481 |
|
|
896 | $ echo b >b | |
482 |
|
|
897 | $ echo c >c | |
483 | echo c >c |
|
898 | $ hg ci -Am1 | |
484 | hg ci -Am1 |
|
899 | adding a | |
|
900 | adding b | |||
|
901 | adding c | |||
485 |
|
902 | |||
486 | echo "key: value" >>a |
|
903 | $ echo "key: value" >>a | |
487 | echo "key: value" >>b |
|
904 | $ echo "key: value" >>b | |
488 | echo "foo" >>c |
|
905 | $ echo "foo" >>c | |
489 | hg ci -m2 |
|
906 | $ hg ci -m2 | |
490 |
|
907 | |||
491 | hg up -C 0 |
|
908 | $ hg up -C 0 | |
492 | hg diff --git -c1 >want |
|
909 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
493 | hg diff -c1 | hg import --no-commit - |
|
910 | $ hg diff --git -c1 >want | |
494 | hg diff --git >have |
|
911 | $ hg diff -c1 | hg import --no-commit - | |
495 | diff want have |
|
912 | applying patch from stdin | |
496 | cd .. |
|
913 | $ hg diff --git >have | |
|
914 | $ diff want have | |||
|
915 | $ cd .. | |||
497 |
|
916 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now