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