##// END OF EJS Templates
tests: adjust quoting to keep Windows happy with recent $PYTHON change...
Matt Harbison -
r32976:d39639fb default
parent child Browse files
Show More
@@ -1,661 +1,661 b''
1 $ hg init
1 $ hg init
2
2
3
3
4 committing changes
4 committing changes
5
5
6 $ count=0
6 $ count=0
7 $ echo > a
7 $ echo > a
8 $ while test $count -lt 32 ; do
8 $ while test $count -lt 32 ; do
9 > echo 'a' >> a
9 > echo 'a' >> a
10 > test $count -eq 0 && hg add
10 > test $count -eq 0 && hg add
11 > hg ci -m "msg $count" -d "$count 0"
11 > hg ci -m "msg $count" -d "$count 0"
12 > count=`expr $count + 1`
12 > count=`expr $count + 1`
13 > done
13 > done
14 adding a
14 adding a
15
15
16
16
17 $ hg log
17 $ hg log
18 changeset: 31:58c80a7c8a40
18 changeset: 31:58c80a7c8a40
19 tag: tip
19 tag: tip
20 user: test
20 user: test
21 date: Thu Jan 01 00:00:31 1970 +0000
21 date: Thu Jan 01 00:00:31 1970 +0000
22 summary: msg 31
22 summary: msg 31
23
23
24 changeset: 30:ed2d2f24b11c
24 changeset: 30:ed2d2f24b11c
25 user: test
25 user: test
26 date: Thu Jan 01 00:00:30 1970 +0000
26 date: Thu Jan 01 00:00:30 1970 +0000
27 summary: msg 30
27 summary: msg 30
28
28
29 changeset: 29:b5bd63375ab9
29 changeset: 29:b5bd63375ab9
30 user: test
30 user: test
31 date: Thu Jan 01 00:00:29 1970 +0000
31 date: Thu Jan 01 00:00:29 1970 +0000
32 summary: msg 29
32 summary: msg 29
33
33
34 changeset: 28:8e0c2264c8af
34 changeset: 28:8e0c2264c8af
35 user: test
35 user: test
36 date: Thu Jan 01 00:00:28 1970 +0000
36 date: Thu Jan 01 00:00:28 1970 +0000
37 summary: msg 28
37 summary: msg 28
38
38
39 changeset: 27:288867a866e9
39 changeset: 27:288867a866e9
40 user: test
40 user: test
41 date: Thu Jan 01 00:00:27 1970 +0000
41 date: Thu Jan 01 00:00:27 1970 +0000
42 summary: msg 27
42 summary: msg 27
43
43
44 changeset: 26:3efc6fd51aeb
44 changeset: 26:3efc6fd51aeb
45 user: test
45 user: test
46 date: Thu Jan 01 00:00:26 1970 +0000
46 date: Thu Jan 01 00:00:26 1970 +0000
47 summary: msg 26
47 summary: msg 26
48
48
49 changeset: 25:02a84173a97a
49 changeset: 25:02a84173a97a
50 user: test
50 user: test
51 date: Thu Jan 01 00:00:25 1970 +0000
51 date: Thu Jan 01 00:00:25 1970 +0000
52 summary: msg 25
52 summary: msg 25
53
53
54 changeset: 24:10e0acd3809e
54 changeset: 24:10e0acd3809e
55 user: test
55 user: test
56 date: Thu Jan 01 00:00:24 1970 +0000
56 date: Thu Jan 01 00:00:24 1970 +0000
57 summary: msg 24
57 summary: msg 24
58
58
59 changeset: 23:5ec79163bff4
59 changeset: 23:5ec79163bff4
60 user: test
60 user: test
61 date: Thu Jan 01 00:00:23 1970 +0000
61 date: Thu Jan 01 00:00:23 1970 +0000
62 summary: msg 23
62 summary: msg 23
63
63
64 changeset: 22:06c7993750ce
64 changeset: 22:06c7993750ce
65 user: test
65 user: test
66 date: Thu Jan 01 00:00:22 1970 +0000
66 date: Thu Jan 01 00:00:22 1970 +0000
67 summary: msg 22
67 summary: msg 22
68
68
69 changeset: 21:e5db6aa3fe2a
69 changeset: 21:e5db6aa3fe2a
70 user: test
70 user: test
71 date: Thu Jan 01 00:00:21 1970 +0000
71 date: Thu Jan 01 00:00:21 1970 +0000
72 summary: msg 21
72 summary: msg 21
73
73
74 changeset: 20:7128fb4fdbc9
74 changeset: 20:7128fb4fdbc9
75 user: test
75 user: test
76 date: Thu Jan 01 00:00:20 1970 +0000
76 date: Thu Jan 01 00:00:20 1970 +0000
77 summary: msg 20
77 summary: msg 20
78
78
79 changeset: 19:52798545b482
79 changeset: 19:52798545b482
80 user: test
80 user: test
81 date: Thu Jan 01 00:00:19 1970 +0000
81 date: Thu Jan 01 00:00:19 1970 +0000
82 summary: msg 19
82 summary: msg 19
83
83
84 changeset: 18:86977a90077e
84 changeset: 18:86977a90077e
85 user: test
85 user: test
86 date: Thu Jan 01 00:00:18 1970 +0000
86 date: Thu Jan 01 00:00:18 1970 +0000
87 summary: msg 18
87 summary: msg 18
88
88
89 changeset: 17:03515f4a9080
89 changeset: 17:03515f4a9080
90 user: test
90 user: test
91 date: Thu Jan 01 00:00:17 1970 +0000
91 date: Thu Jan 01 00:00:17 1970 +0000
92 summary: msg 17
92 summary: msg 17
93
93
94 changeset: 16:a2e6ea4973e9
94 changeset: 16:a2e6ea4973e9
95 user: test
95 user: test
96 date: Thu Jan 01 00:00:16 1970 +0000
96 date: Thu Jan 01 00:00:16 1970 +0000
97 summary: msg 16
97 summary: msg 16
98
98
99 changeset: 15:e7fa0811edb0
99 changeset: 15:e7fa0811edb0
100 user: test
100 user: test
101 date: Thu Jan 01 00:00:15 1970 +0000
101 date: Thu Jan 01 00:00:15 1970 +0000
102 summary: msg 15
102 summary: msg 15
103
103
104 changeset: 14:ce8f0998e922
104 changeset: 14:ce8f0998e922
105 user: test
105 user: test
106 date: Thu Jan 01 00:00:14 1970 +0000
106 date: Thu Jan 01 00:00:14 1970 +0000
107 summary: msg 14
107 summary: msg 14
108
108
109 changeset: 13:9d7d07bc967c
109 changeset: 13:9d7d07bc967c
110 user: test
110 user: test
111 date: Thu Jan 01 00:00:13 1970 +0000
111 date: Thu Jan 01 00:00:13 1970 +0000
112 summary: msg 13
112 summary: msg 13
113
113
114 changeset: 12:1941b52820a5
114 changeset: 12:1941b52820a5
115 user: test
115 user: test
116 date: Thu Jan 01 00:00:12 1970 +0000
116 date: Thu Jan 01 00:00:12 1970 +0000
117 summary: msg 12
117 summary: msg 12
118
118
119 changeset: 11:7b4cd9578619
119 changeset: 11:7b4cd9578619
120 user: test
120 user: test
121 date: Thu Jan 01 00:00:11 1970 +0000
121 date: Thu Jan 01 00:00:11 1970 +0000
122 summary: msg 11
122 summary: msg 11
123
123
124 changeset: 10:7c5eff49a6b6
124 changeset: 10:7c5eff49a6b6
125 user: test
125 user: test
126 date: Thu Jan 01 00:00:10 1970 +0000
126 date: Thu Jan 01 00:00:10 1970 +0000
127 summary: msg 10
127 summary: msg 10
128
128
129 changeset: 9:eb44510ef29a
129 changeset: 9:eb44510ef29a
130 user: test
130 user: test
131 date: Thu Jan 01 00:00:09 1970 +0000
131 date: Thu Jan 01 00:00:09 1970 +0000
132 summary: msg 9
132 summary: msg 9
133
133
134 changeset: 8:453eb4dba229
134 changeset: 8:453eb4dba229
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:08 1970 +0000
136 date: Thu Jan 01 00:00:08 1970 +0000
137 summary: msg 8
137 summary: msg 8
138
138
139 changeset: 7:03750880c6b5
139 changeset: 7:03750880c6b5
140 user: test
140 user: test
141 date: Thu Jan 01 00:00:07 1970 +0000
141 date: Thu Jan 01 00:00:07 1970 +0000
142 summary: msg 7
142 summary: msg 7
143
143
144 changeset: 6:a3d5c6fdf0d3
144 changeset: 6:a3d5c6fdf0d3
145 user: test
145 user: test
146 date: Thu Jan 01 00:00:06 1970 +0000
146 date: Thu Jan 01 00:00:06 1970 +0000
147 summary: msg 6
147 summary: msg 6
148
148
149 changeset: 5:7874a09ea728
149 changeset: 5:7874a09ea728
150 user: test
150 user: test
151 date: Thu Jan 01 00:00:05 1970 +0000
151 date: Thu Jan 01 00:00:05 1970 +0000
152 summary: msg 5
152 summary: msg 5
153
153
154 changeset: 4:9b2ba8336a65
154 changeset: 4:9b2ba8336a65
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:04 1970 +0000
156 date: Thu Jan 01 00:00:04 1970 +0000
157 summary: msg 4
157 summary: msg 4
158
158
159 changeset: 3:b53bea5e2fcb
159 changeset: 3:b53bea5e2fcb
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:03 1970 +0000
161 date: Thu Jan 01 00:00:03 1970 +0000
162 summary: msg 3
162 summary: msg 3
163
163
164 changeset: 2:db07c04beaca
164 changeset: 2:db07c04beaca
165 user: test
165 user: test
166 date: Thu Jan 01 00:00:02 1970 +0000
166 date: Thu Jan 01 00:00:02 1970 +0000
167 summary: msg 2
167 summary: msg 2
168
168
169 changeset: 1:5cd978ea5149
169 changeset: 1:5cd978ea5149
170 user: test
170 user: test
171 date: Thu Jan 01 00:00:01 1970 +0000
171 date: Thu Jan 01 00:00:01 1970 +0000
172 summary: msg 1
172 summary: msg 1
173
173
174 changeset: 0:b99c7b9c8e11
174 changeset: 0:b99c7b9c8e11
175 user: test
175 user: test
176 date: Thu Jan 01 00:00:00 1970 +0000
176 date: Thu Jan 01 00:00:00 1970 +0000
177 summary: msg 0
177 summary: msg 0
178
178
179
179
180 $ hg up -C
180 $ hg up -C
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182
182
183 bisect test
183 bisect test
184
184
185 $ hg bisect -r
185 $ hg bisect -r
186 $ hg bisect -b
186 $ hg bisect -b
187 $ hg summary
187 $ hg summary
188 parent: 31:58c80a7c8a40 tip
188 parent: 31:58c80a7c8a40 tip
189 msg 31
189 msg 31
190 branch: default
190 branch: default
191 commit: (clean)
191 commit: (clean)
192 update: (current)
192 update: (current)
193 phases: 32 draft
193 phases: 32 draft
194 $ hg bisect -g 1
194 $ hg bisect -g 1
195 Testing changeset 16:a2e6ea4973e9 (30 changesets remaining, ~4 tests)
195 Testing changeset 16:a2e6ea4973e9 (30 changesets remaining, ~4 tests)
196 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
197 $ hg bisect -g
197 $ hg bisect -g
198 Testing changeset 23:5ec79163bff4 (15 changesets remaining, ~3 tests)
198 Testing changeset 23:5ec79163bff4 (15 changesets remaining, ~3 tests)
199 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
199 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
200
200
201 skip
201 skip
202
202
203 $ hg bisect -s
203 $ hg bisect -s
204 Testing changeset 24:10e0acd3809e (15 changesets remaining, ~3 tests)
204 Testing changeset 24:10e0acd3809e (15 changesets remaining, ~3 tests)
205 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
206 $ hg bisect -g
206 $ hg bisect -g
207 Testing changeset 27:288867a866e9 (7 changesets remaining, ~2 tests)
207 Testing changeset 27:288867a866e9 (7 changesets remaining, ~2 tests)
208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 $ hg bisect -g
209 $ hg bisect -g
210 Testing changeset 29:b5bd63375ab9 (4 changesets remaining, ~2 tests)
210 Testing changeset 29:b5bd63375ab9 (4 changesets remaining, ~2 tests)
211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 $ hg bisect -b
212 $ hg bisect -b
213 Testing changeset 28:8e0c2264c8af (2 changesets remaining, ~1 tests)
213 Testing changeset 28:8e0c2264c8af (2 changesets remaining, ~1 tests)
214 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 $ hg bisect -g
215 $ hg bisect -g
216 The first bad revision is:
216 The first bad revision is:
217 changeset: 29:b5bd63375ab9
217 changeset: 29:b5bd63375ab9
218 user: test
218 user: test
219 date: Thu Jan 01 00:00:29 1970 +0000
219 date: Thu Jan 01 00:00:29 1970 +0000
220 summary: msg 29
220 summary: msg 29
221
221
222
222
223 mark revsets instead of single revs
223 mark revsets instead of single revs
224
224
225 $ hg bisect -r
225 $ hg bisect -r
226 $ hg bisect -b "0::3"
226 $ hg bisect -b "0::3"
227 $ hg bisect -s "13::16"
227 $ hg bisect -s "13::16"
228 $ hg bisect -g "26::tip"
228 $ hg bisect -g "26::tip"
229 Testing changeset 12:1941b52820a5 (23 changesets remaining, ~4 tests)
229 Testing changeset 12:1941b52820a5 (23 changesets remaining, ~4 tests)
230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 $ cat .hg/bisect.state
231 $ cat .hg/bisect.state
232 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
232 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
233 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
233 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
234 bad db07c04beaca44cf24832541e7f4a2346a95275b
234 bad db07c04beaca44cf24832541e7f4a2346a95275b
235 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
235 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
236 current 1941b52820a544549596820a8ae006842b0e2c64
236 current 1941b52820a544549596820a8ae006842b0e2c64
237 good 3efc6fd51aeb8594398044c6c846ca59ae021203
237 good 3efc6fd51aeb8594398044c6c846ca59ae021203
238 good 288867a866e9adb7a29880b66936c874b80f4651
238 good 288867a866e9adb7a29880b66936c874b80f4651
239 good 8e0c2264c8af790daf3585ada0669d93dee09c83
239 good 8e0c2264c8af790daf3585ada0669d93dee09c83
240 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
240 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
241 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
241 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
242 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
242 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
243 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
243 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
244 skip ce8f0998e922c179e80819d5066fbe46e2998784
244 skip ce8f0998e922c179e80819d5066fbe46e2998784
245 skip e7fa0811edb063f6319531f0d0a865882138e180
245 skip e7fa0811edb063f6319531f0d0a865882138e180
246 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
246 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
247
247
248 bisect reverse test
248 bisect reverse test
249
249
250 $ hg bisect -r
250 $ hg bisect -r
251 $ hg bisect -b null
251 $ hg bisect -b null
252 $ hg bisect -g tip
252 $ hg bisect -g tip
253 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
253 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 $ hg bisect -g
255 $ hg bisect -g
256 Testing changeset 7:03750880c6b5 (16 changesets remaining, ~4 tests)
256 Testing changeset 7:03750880c6b5 (16 changesets remaining, ~4 tests)
257 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
258
258
259 skip
259 skip
260
260
261 $ hg bisect -s
261 $ hg bisect -s
262 Testing changeset 6:a3d5c6fdf0d3 (16 changesets remaining, ~4 tests)
262 Testing changeset 6:a3d5c6fdf0d3 (16 changesets remaining, ~4 tests)
263 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 $ hg bisect -g
264 $ hg bisect -g
265 Testing changeset 2:db07c04beaca (7 changesets remaining, ~2 tests)
265 Testing changeset 2:db07c04beaca (7 changesets remaining, ~2 tests)
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 $ hg bisect -g
267 $ hg bisect -g
268 Testing changeset 0:b99c7b9c8e11 (3 changesets remaining, ~1 tests)
268 Testing changeset 0:b99c7b9c8e11 (3 changesets remaining, ~1 tests)
269 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
270 $ hg bisect -b
270 $ hg bisect -b
271 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
271 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
272 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
273 $ hg bisect -g
273 $ hg bisect -g
274 The first good revision is:
274 The first good revision is:
275 changeset: 1:5cd978ea5149
275 changeset: 1:5cd978ea5149
276 user: test
276 user: test
277 date: Thu Jan 01 00:00:01 1970 +0000
277 date: Thu Jan 01 00:00:01 1970 +0000
278 summary: msg 1
278 summary: msg 1
279
279
280
280
281 $ hg bisect -r
281 $ hg bisect -r
282 $ hg bisect -g tip
282 $ hg bisect -g tip
283 $ hg bisect -b tip
283 $ hg bisect -b tip
284 abort: inconsistent state, 31:58c80a7c8a40 is good and bad
284 abort: inconsistent state, 31:58c80a7c8a40 is good and bad
285 [255]
285 [255]
286
286
287 $ hg bisect -r
287 $ hg bisect -r
288 $ hg bisect -g null
288 $ hg bisect -g null
289 $ hg bisect -bU tip
289 $ hg bisect -bU tip
290 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
290 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
291 $ hg id
291 $ hg id
292 5cd978ea5149
292 5cd978ea5149
293
293
294
294
295 Issue1228: hg bisect crashes when you skip the last rev in bisection
295 Issue1228: hg bisect crashes when you skip the last rev in bisection
296 Issue1182: hg bisect exception
296 Issue1182: hg bisect exception
297
297
298 $ hg bisect -r
298 $ hg bisect -r
299 $ hg bisect -b 4
299 $ hg bisect -b 4
300 $ hg bisect -g 0
300 $ hg bisect -g 0
301 Testing changeset 2:db07c04beaca (4 changesets remaining, ~2 tests)
301 Testing changeset 2:db07c04beaca (4 changesets remaining, ~2 tests)
302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
303 $ hg bisect -s
303 $ hg bisect -s
304 Testing changeset 1:5cd978ea5149 (4 changesets remaining, ~2 tests)
304 Testing changeset 1:5cd978ea5149 (4 changesets remaining, ~2 tests)
305 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
305 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
306 $ hg bisect -s
306 $ hg bisect -s
307 Testing changeset 3:b53bea5e2fcb (4 changesets remaining, ~2 tests)
307 Testing changeset 3:b53bea5e2fcb (4 changesets remaining, ~2 tests)
308 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
309 $ hg bisect -s
309 $ hg bisect -s
310 Due to skipped revisions, the first bad revision could be any of:
310 Due to skipped revisions, the first bad revision could be any of:
311 changeset: 1:5cd978ea5149
311 changeset: 1:5cd978ea5149
312 user: test
312 user: test
313 date: Thu Jan 01 00:00:01 1970 +0000
313 date: Thu Jan 01 00:00:01 1970 +0000
314 summary: msg 1
314 summary: msg 1
315
315
316 changeset: 2:db07c04beaca
316 changeset: 2:db07c04beaca
317 user: test
317 user: test
318 date: Thu Jan 01 00:00:02 1970 +0000
318 date: Thu Jan 01 00:00:02 1970 +0000
319 summary: msg 2
319 summary: msg 2
320
320
321 changeset: 3:b53bea5e2fcb
321 changeset: 3:b53bea5e2fcb
322 user: test
322 user: test
323 date: Thu Jan 01 00:00:03 1970 +0000
323 date: Thu Jan 01 00:00:03 1970 +0000
324 summary: msg 3
324 summary: msg 3
325
325
326 changeset: 4:9b2ba8336a65
326 changeset: 4:9b2ba8336a65
327 user: test
327 user: test
328 date: Thu Jan 01 00:00:04 1970 +0000
328 date: Thu Jan 01 00:00:04 1970 +0000
329 summary: msg 4
329 summary: msg 4
330
330
331
331
332
332
333 reproduce non converging bisect, issue1182
333 reproduce non converging bisect, issue1182
334
334
335 $ hg bisect -r
335 $ hg bisect -r
336 $ hg bisect -g 0
336 $ hg bisect -g 0
337 $ hg bisect -b 2
337 $ hg bisect -b 2
338 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
338 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
339 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
339 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
340 $ hg bisect -s
340 $ hg bisect -s
341 Due to skipped revisions, the first bad revision could be any of:
341 Due to skipped revisions, the first bad revision could be any of:
342 changeset: 1:5cd978ea5149
342 changeset: 1:5cd978ea5149
343 user: test
343 user: test
344 date: Thu Jan 01 00:00:01 1970 +0000
344 date: Thu Jan 01 00:00:01 1970 +0000
345 summary: msg 1
345 summary: msg 1
346
346
347 changeset: 2:db07c04beaca
347 changeset: 2:db07c04beaca
348 user: test
348 user: test
349 date: Thu Jan 01 00:00:02 1970 +0000
349 date: Thu Jan 01 00:00:02 1970 +0000
350 summary: msg 2
350 summary: msg 2
351
351
352
352
353
353
354 test no action
354 test no action
355
355
356 $ hg bisect -r
356 $ hg bisect -r
357 $ hg bisect
357 $ hg bisect
358 abort: cannot bisect (no known good revisions)
358 abort: cannot bisect (no known good revisions)
359 [255]
359 [255]
360
360
361
361
362 reproduce AssertionError, issue1445
362 reproduce AssertionError, issue1445
363
363
364 $ hg bisect -r
364 $ hg bisect -r
365 $ hg bisect -b 6
365 $ hg bisect -b 6
366 $ hg bisect -g 0
366 $ hg bisect -g 0
367 Testing changeset 3:b53bea5e2fcb (6 changesets remaining, ~2 tests)
367 Testing changeset 3:b53bea5e2fcb (6 changesets remaining, ~2 tests)
368 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
368 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
369 $ hg bisect -s
369 $ hg bisect -s
370 Testing changeset 2:db07c04beaca (6 changesets remaining, ~2 tests)
370 Testing changeset 2:db07c04beaca (6 changesets remaining, ~2 tests)
371 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
371 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 $ hg bisect -s
372 $ hg bisect -s
373 Testing changeset 4:9b2ba8336a65 (6 changesets remaining, ~2 tests)
373 Testing changeset 4:9b2ba8336a65 (6 changesets remaining, ~2 tests)
374 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
375 $ hg bisect -s
375 $ hg bisect -s
376 Testing changeset 1:5cd978ea5149 (6 changesets remaining, ~2 tests)
376 Testing changeset 1:5cd978ea5149 (6 changesets remaining, ~2 tests)
377 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
378 $ hg bisect -s
378 $ hg bisect -s
379 Testing changeset 5:7874a09ea728 (6 changesets remaining, ~2 tests)
379 Testing changeset 5:7874a09ea728 (6 changesets remaining, ~2 tests)
380 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
381 $ hg bisect -g
381 $ hg bisect -g
382 The first bad revision is:
382 The first bad revision is:
383 changeset: 6:a3d5c6fdf0d3
383 changeset: 6:a3d5c6fdf0d3
384 user: test
384 user: test
385 date: Thu Jan 01 00:00:06 1970 +0000
385 date: Thu Jan 01 00:00:06 1970 +0000
386 summary: msg 6
386 summary: msg 6
387
387
388 $ hg log -r "bisect(good)"
388 $ hg log -r "bisect(good)"
389 changeset: 0:b99c7b9c8e11
389 changeset: 0:b99c7b9c8e11
390 user: test
390 user: test
391 date: Thu Jan 01 00:00:00 1970 +0000
391 date: Thu Jan 01 00:00:00 1970 +0000
392 summary: msg 0
392 summary: msg 0
393
393
394 changeset: 5:7874a09ea728
394 changeset: 5:7874a09ea728
395 user: test
395 user: test
396 date: Thu Jan 01 00:00:05 1970 +0000
396 date: Thu Jan 01 00:00:05 1970 +0000
397 summary: msg 5
397 summary: msg 5
398
398
399 $ hg log -r "bisect(bad)"
399 $ hg log -r "bisect(bad)"
400 changeset: 6:a3d5c6fdf0d3
400 changeset: 6:a3d5c6fdf0d3
401 user: test
401 user: test
402 date: Thu Jan 01 00:00:06 1970 +0000
402 date: Thu Jan 01 00:00:06 1970 +0000
403 summary: msg 6
403 summary: msg 6
404
404
405 $ hg log -r "bisect(current)"
405 $ hg log -r "bisect(current)"
406 changeset: 5:7874a09ea728
406 changeset: 5:7874a09ea728
407 user: test
407 user: test
408 date: Thu Jan 01 00:00:05 1970 +0000
408 date: Thu Jan 01 00:00:05 1970 +0000
409 summary: msg 5
409 summary: msg 5
410
410
411 $ hg log -r "bisect(skip)"
411 $ hg log -r "bisect(skip)"
412 changeset: 1:5cd978ea5149
412 changeset: 1:5cd978ea5149
413 user: test
413 user: test
414 date: Thu Jan 01 00:00:01 1970 +0000
414 date: Thu Jan 01 00:00:01 1970 +0000
415 summary: msg 1
415 summary: msg 1
416
416
417 changeset: 2:db07c04beaca
417 changeset: 2:db07c04beaca
418 user: test
418 user: test
419 date: Thu Jan 01 00:00:02 1970 +0000
419 date: Thu Jan 01 00:00:02 1970 +0000
420 summary: msg 2
420 summary: msg 2
421
421
422 changeset: 3:b53bea5e2fcb
422 changeset: 3:b53bea5e2fcb
423 user: test
423 user: test
424 date: Thu Jan 01 00:00:03 1970 +0000
424 date: Thu Jan 01 00:00:03 1970 +0000
425 summary: msg 3
425 summary: msg 3
426
426
427 changeset: 4:9b2ba8336a65
427 changeset: 4:9b2ba8336a65
428 user: test
428 user: test
429 date: Thu Jan 01 00:00:04 1970 +0000
429 date: Thu Jan 01 00:00:04 1970 +0000
430 summary: msg 4
430 summary: msg 4
431
431
432
432
433 test legacy bisected() keyword
433 test legacy bisected() keyword
434
434
435 $ hg log -r "bisected(bad)"
435 $ hg log -r "bisected(bad)"
436 changeset: 6:a3d5c6fdf0d3
436 changeset: 6:a3d5c6fdf0d3
437 user: test
437 user: test
438 date: Thu Jan 01 00:00:06 1970 +0000
438 date: Thu Jan 01 00:00:06 1970 +0000
439 summary: msg 6
439 summary: msg 6
440
440
441
441
442 $ set +e
442 $ set +e
443
443
444 test invalid command
444 test invalid command
445 assuming that the shell returns 127 if command not found ...
445 assuming that the shell returns 127 if command not found ...
446
446
447 $ hg bisect -r
447 $ hg bisect -r
448 $ hg bisect --command 'exit 127'
448 $ hg bisect --command 'exit 127'
449 abort: failed to execute exit 127
449 abort: failed to execute exit 127
450 [255]
450 [255]
451
451
452
452
453 test bisecting command
453 test bisecting command
454
454
455 $ cat > script.py <<EOF
455 $ cat > script.py <<EOF
456 > #!$PYTHON
456 > #!$PYTHON
457 > import sys
457 > import sys
458 > from mercurial import ui, hg
458 > from mercurial import ui, hg
459 > repo = hg.repository(ui.ui.load(), '.')
459 > repo = hg.repository(ui.ui.load(), '.')
460 > if repo['.'].rev() < 6:
460 > if repo['.'].rev() < 6:
461 > sys.exit(1)
461 > sys.exit(1)
462 > EOF
462 > EOF
463 $ chmod +x script.py
463 $ chmod +x script.py
464 $ hg bisect -r
464 $ hg bisect -r
465 $ hg up -qr tip
465 $ hg up -qr tip
466 $ hg bisect --command "$PYTHON \"$TESTTMP/script.py\" and some parameters"
466 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
467 changeset 31:58c80a7c8a40: good
467 changeset 31:58c80a7c8a40: good
468 abort: cannot bisect (no known bad revisions)
468 abort: cannot bisect (no known bad revisions)
469 [255]
469 [255]
470 $ hg up -qr 0
470 $ hg up -qr 0
471 $ hg bisect --command "$PYTHON \"$TESTTMP/script.py\" and some parameters"
471 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
472 changeset 0:b99c7b9c8e11: bad
472 changeset 0:b99c7b9c8e11: bad
473 changeset 15:e7fa0811edb0: good
473 changeset 15:e7fa0811edb0: good
474 changeset 7:03750880c6b5: good
474 changeset 7:03750880c6b5: good
475 changeset 3:b53bea5e2fcb: bad
475 changeset 3:b53bea5e2fcb: bad
476 changeset 5:7874a09ea728: bad
476 changeset 5:7874a09ea728: bad
477 changeset 6:a3d5c6fdf0d3: good
477 changeset 6:a3d5c6fdf0d3: good
478 The first good revision is:
478 The first good revision is:
479 changeset: 6:a3d5c6fdf0d3
479 changeset: 6:a3d5c6fdf0d3
480 user: test
480 user: test
481 date: Thu Jan 01 00:00:06 1970 +0000
481 date: Thu Jan 01 00:00:06 1970 +0000
482 summary: msg 6
482 summary: msg 6
483
483
484
484
485
485
486 test bisecting via a command without updating the working dir, and
486 test bisecting via a command without updating the working dir, and
487 ensure that the bisect state file is updated before running a test
487 ensure that the bisect state file is updated before running a test
488 command
488 command
489
489
490 $ hg update null
490 $ hg update null
491 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
491 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
492 $ cat > script.sh <<'EOF'
492 $ cat > script.sh <<'EOF'
493 > #!/bin/sh
493 > #!/bin/sh
494 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
494 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
495 > current="`hg log -r \"bisect(current)\" --template {node}`"
495 > current="`hg log -r \"bisect(current)\" --template {node}`"
496 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
496 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
497 > rev="`hg log -r $HG_NODE --template {rev}`"
497 > rev="`hg log -r $HG_NODE --template {rev}`"
498 > test "$rev" -ge 6
498 > test "$rev" -ge 6
499 > EOF
499 > EOF
500 $ chmod +x script.sh
500 $ chmod +x script.sh
501 $ hg bisect -r
501 $ hg bisect -r
502 $ hg bisect --good tip --noupdate
502 $ hg bisect --good tip --noupdate
503 $ hg bisect --bad 0 --noupdate
503 $ hg bisect --bad 0 --noupdate
504 Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests)
504 Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests)
505 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" --noupdate
505 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" --noupdate
506 changeset 15:e7fa0811edb0: good
506 changeset 15:e7fa0811edb0: good
507 changeset 7:03750880c6b5: good
507 changeset 7:03750880c6b5: good
508 changeset 3:b53bea5e2fcb: bad
508 changeset 3:b53bea5e2fcb: bad
509 changeset 5:7874a09ea728: bad
509 changeset 5:7874a09ea728: bad
510 changeset 6:a3d5c6fdf0d3: good
510 changeset 6:a3d5c6fdf0d3: good
511 The first good revision is:
511 The first good revision is:
512 changeset: 6:a3d5c6fdf0d3
512 changeset: 6:a3d5c6fdf0d3
513 user: test
513 user: test
514 date: Thu Jan 01 00:00:06 1970 +0000
514 date: Thu Jan 01 00:00:06 1970 +0000
515 summary: msg 6
515 summary: msg 6
516
516
517
517
518 ensure that we still don't have a working dir
518 ensure that we still don't have a working dir
519
519
520 $ hg parents
520 $ hg parents
521
521
522
522
523 test the same case, this time with updating
523 test the same case, this time with updating
524
524
525 $ cat > script.sh <<'EOF'
525 $ cat > script.sh <<'EOF'
526 > #!/bin/sh
526 > #!/bin/sh
527 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
527 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
528 > current="`hg log -r \"bisect(current)\" --template {node}`"
528 > current="`hg log -r \"bisect(current)\" --template {node}`"
529 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
529 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
530 > rev="`hg log -r . --template {rev}`"
530 > rev="`hg log -r . --template {rev}`"
531 > test "$rev" -ge 6
531 > test "$rev" -ge 6
532 > EOF
532 > EOF
533 $ chmod +x script.sh
533 $ chmod +x script.sh
534 $ hg bisect -r
534 $ hg bisect -r
535 $ hg up -qr tip
535 $ hg up -qr tip
536 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
536 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
537 changeset 31:58c80a7c8a40: good
537 changeset 31:58c80a7c8a40: good
538 abort: cannot bisect (no known bad revisions)
538 abort: cannot bisect (no known bad revisions)
539 [255]
539 [255]
540 $ hg up -qr 0
540 $ hg up -qr 0
541 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
541 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
542 changeset 0:b99c7b9c8e11: bad
542 changeset 0:b99c7b9c8e11: bad
543 changeset 15:e7fa0811edb0: good
543 changeset 15:e7fa0811edb0: good
544 changeset 7:03750880c6b5: good
544 changeset 7:03750880c6b5: good
545 changeset 3:b53bea5e2fcb: bad
545 changeset 3:b53bea5e2fcb: bad
546 changeset 5:7874a09ea728: bad
546 changeset 5:7874a09ea728: bad
547 changeset 6:a3d5c6fdf0d3: good
547 changeset 6:a3d5c6fdf0d3: good
548 The first good revision is:
548 The first good revision is:
549 changeset: 6:a3d5c6fdf0d3
549 changeset: 6:a3d5c6fdf0d3
550 user: test
550 user: test
551 date: Thu Jan 01 00:00:06 1970 +0000
551 date: Thu Jan 01 00:00:06 1970 +0000
552 summary: msg 6
552 summary: msg 6
553
553
554 $ hg graft -q 15
554 $ hg graft -q 15
555 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
555 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
556 abort: unresolved conflicts, can't continue
556 abort: unresolved conflicts, can't continue
557 (use 'hg resolve' and 'hg graft --continue')
557 (use 'hg resolve' and 'hg graft --continue')
558 [255]
558 [255]
559 $ hg bisect --reset
559 $ hg bisect --reset
560 $ hg up -C .
560 $ hg up -C .
561 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
561 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
562
562
563 Check that bisect does not break on obsolete changesets
563 Check that bisect does not break on obsolete changesets
564 =========================================================
564 =========================================================
565
565
566 $ cat >> $HGRCPATH << EOF
566 $ cat >> $HGRCPATH << EOF
567 > [experimental]
567 > [experimental]
568 > evolution=createmarkers
568 > evolution=createmarkers
569 > EOF
569 > EOF
570
570
571 tip is obsolete
571 tip is obsolete
572 ---------------------
572 ---------------------
573
573
574 $ hg debugobsolete `hg id --debug -i -r tip`
574 $ hg debugobsolete `hg id --debug -i -r tip`
575 $ hg bisect --reset
575 $ hg bisect --reset
576 $ hg bisect --good 15
576 $ hg bisect --good 15
577 $ hg bisect --bad 30
577 $ hg bisect --bad 30
578 Testing changeset 22:06c7993750ce (15 changesets remaining, ~3 tests)
578 Testing changeset 22:06c7993750ce (15 changesets remaining, ~3 tests)
579 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
579 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
580 $ hg bisect --command true
580 $ hg bisect --command true
581 changeset 22:06c7993750ce: good
581 changeset 22:06c7993750ce: good
582 changeset 26:3efc6fd51aeb: good
582 changeset 26:3efc6fd51aeb: good
583 changeset 28:8e0c2264c8af: good
583 changeset 28:8e0c2264c8af: good
584 changeset 29:b5bd63375ab9: good
584 changeset 29:b5bd63375ab9: good
585 The first bad revision is:
585 The first bad revision is:
586 changeset: 30:ed2d2f24b11c
586 changeset: 30:ed2d2f24b11c
587 tag: tip
587 tag: tip
588 user: test
588 user: test
589 date: Thu Jan 01 00:00:30 1970 +0000
589 date: Thu Jan 01 00:00:30 1970 +0000
590 summary: msg 30
590 summary: msg 30
591
591
592
592
593 Changeset in the bad:good range is obsolete
593 Changeset in the bad:good range is obsolete
594 ---------------------------------------------
594 ---------------------------------------------
595
595
596 $ hg up 30
596 $ hg up 30
597 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
597 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
598 $ echo 'a' >> a
598 $ echo 'a' >> a
599 $ hg ci -m "msg 32" -d "32 0"
599 $ hg ci -m "msg 32" -d "32 0"
600 $ hg bisect --reset
600 $ hg bisect --reset
601 $ hg bisect --good .
601 $ hg bisect --good .
602 $ hg bisect --bad 25
602 $ hg bisect --bad 25
603 Testing changeset 28:8e0c2264c8af (6 changesets remaining, ~2 tests)
603 Testing changeset 28:8e0c2264c8af (6 changesets remaining, ~2 tests)
604 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
604 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
605 $ hg bisect --command true
605 $ hg bisect --command true
606 changeset 28:8e0c2264c8af: good
606 changeset 28:8e0c2264c8af: good
607 changeset 26:3efc6fd51aeb: good
607 changeset 26:3efc6fd51aeb: good
608 The first good revision is:
608 The first good revision is:
609 changeset: 26:3efc6fd51aeb
609 changeset: 26:3efc6fd51aeb
610 user: test
610 user: test
611 date: Thu Jan 01 00:00:26 1970 +0000
611 date: Thu Jan 01 00:00:26 1970 +0000
612 summary: msg 26
612 summary: msg 26
613
613
614 Test the validation message when exclusive options are used:
614 Test the validation message when exclusive options are used:
615
615
616 $ hg bisect -r
616 $ hg bisect -r
617 $ hg bisect -b -c false
617 $ hg bisect -b -c false
618 abort: --bad and --command are incompatible
618 abort: --bad and --command are incompatible
619 [255]
619 [255]
620 $ hg bisect -b -e
620 $ hg bisect -b -e
621 abort: --bad and --extend are incompatible
621 abort: --bad and --extend are incompatible
622 [255]
622 [255]
623 $ hg bisect -b -g
623 $ hg bisect -b -g
624 abort: --bad and --good are incompatible
624 abort: --bad and --good are incompatible
625 [255]
625 [255]
626 $ hg bisect -b -r
626 $ hg bisect -b -r
627 abort: --bad and --reset are incompatible
627 abort: --bad and --reset are incompatible
628 [255]
628 [255]
629 $ hg bisect -b -s
629 $ hg bisect -b -s
630 abort: --bad and --skip are incompatible
630 abort: --bad and --skip are incompatible
631 [255]
631 [255]
632 $ hg bisect -c false -e
632 $ hg bisect -c false -e
633 abort: --command and --extend are incompatible
633 abort: --command and --extend are incompatible
634 [255]
634 [255]
635 $ hg bisect -c false -g
635 $ hg bisect -c false -g
636 abort: --command and --good are incompatible
636 abort: --command and --good are incompatible
637 [255]
637 [255]
638 $ hg bisect -c false -r
638 $ hg bisect -c false -r
639 abort: --command and --reset are incompatible
639 abort: --command and --reset are incompatible
640 [255]
640 [255]
641 $ hg bisect -c false -s
641 $ hg bisect -c false -s
642 abort: --command and --skip are incompatible
642 abort: --command and --skip are incompatible
643 [255]
643 [255]
644 $ hg bisect -e -g
644 $ hg bisect -e -g
645 abort: --extend and --good are incompatible
645 abort: --extend and --good are incompatible
646 [255]
646 [255]
647 $ hg bisect -e -r
647 $ hg bisect -e -r
648 abort: --extend and --reset are incompatible
648 abort: --extend and --reset are incompatible
649 [255]
649 [255]
650 $ hg bisect -e -s
650 $ hg bisect -e -s
651 abort: --extend and --skip are incompatible
651 abort: --extend and --skip are incompatible
652 [255]
652 [255]
653 $ hg bisect -g -r
653 $ hg bisect -g -r
654 abort: --good and --reset are incompatible
654 abort: --good and --reset are incompatible
655 [255]
655 [255]
656 $ hg bisect -g -s
656 $ hg bisect -g -s
657 abort: --good and --skip are incompatible
657 abort: --good and --skip are incompatible
658 [255]
658 [255]
659 $ hg bisect -r -s
659 $ hg bisect -r -s
660 abort: --reset and --skip are incompatible
660 abort: --reset and --skip are incompatible
661 [255]
661 [255]
@@ -1,1812 +1,1812 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 import with no args:
13 import with no args:
14
14
15 $ hg --cwd a import
15 $ hg --cwd a import
16 abort: need at least one patch to import
16 abort: need at least one patch to import
17 [255]
17 [255]
18
18
19 generate patches for the test
19 generate patches for the test
20
20
21 $ hg --cwd a export tip > exported-tip.patch
21 $ hg --cwd a export tip > exported-tip.patch
22 $ hg --cwd a diff -r0:1 > diffed-tip.patch
22 $ hg --cwd a diff -r0:1 > diffed-tip.patch
23
23
24
24
25 import exported patch
25 import exported patch
26 (this also tests that editor is not invoked, if the patch contains the
26 (this also tests that editor is not invoked, if the patch contains the
27 commit message and '--edit' is not specified)
27 commit message and '--edit' is not specified)
28
28
29 $ hg clone -r0 a b
29 $ hg clone -r0 a b
30 adding changesets
30 adding changesets
31 adding manifests
31 adding manifests
32 adding file changes
32 adding file changes
33 added 1 changesets with 2 changes to 2 files
33 added 1 changesets with 2 changes to 2 files
34 updating to branch default
34 updating to branch default
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch
36 $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch
37 applying ../exported-tip.patch
37 applying ../exported-tip.patch
38
38
39 message and committer and date should be same
39 message and committer and date should be same
40
40
41 $ hg --cwd b tip
41 $ hg --cwd b tip
42 changeset: 1:1d4bd90af0e4
42 changeset: 1:1d4bd90af0e4
43 tag: tip
43 tag: tip
44 user: someone
44 user: someone
45 date: Thu Jan 01 00:00:01 1970 +0000
45 date: Thu Jan 01 00:00:01 1970 +0000
46 summary: second change
46 summary: second change
47
47
48 $ rm -r b
48 $ rm -r b
49
49
50
50
51 import exported patch with external patcher
51 import exported patch with external patcher
52 (this also tests that editor is invoked, if the '--edit' is specified,
52 (this also tests that editor is invoked, if the '--edit' is specified,
53 regardless of the commit message in the patch)
53 regardless of the commit message in the patch)
54
54
55 $ cat > dummypatch.py <<EOF
55 $ cat > dummypatch.py <<EOF
56 > from __future__ import print_function
56 > from __future__ import print_function
57 > print('patching file a')
57 > print('patching file a')
58 > file('a', 'wb').write('line2\n')
58 > file('a', 'wb').write('line2\n')
59 > EOF
59 > EOF
60 $ hg clone -r0 a b
60 $ hg clone -r0 a b
61 adding changesets
61 adding changesets
62 adding manifests
62 adding manifests
63 adding file changes
63 adding file changes
64 added 1 changesets with 2 changes to 2 files
64 added 1 changesets with 2 changes to 2 files
65 updating to branch default
65 updating to branch default
66 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 $ HGEDITOR=cat hg --config ui.patch='$PYTHON ../dummypatch.py' --cwd b import --edit ../exported-tip.patch
67 $ HGEDITOR=cat hg --config ui.patch="$PYTHON ../dummypatch.py" --cwd b import --edit ../exported-tip.patch
68 applying ../exported-tip.patch
68 applying ../exported-tip.patch
69 second change
69 second change
70
70
71
71
72 HG: Enter commit message. Lines beginning with 'HG:' are removed.
72 HG: Enter commit message. Lines beginning with 'HG:' are removed.
73 HG: Leave message empty to abort commit.
73 HG: Leave message empty to abort commit.
74 HG: --
74 HG: --
75 HG: user: someone
75 HG: user: someone
76 HG: branch 'default'
76 HG: branch 'default'
77 HG: changed a
77 HG: changed a
78 $ cat b/a
78 $ cat b/a
79 line2
79 line2
80 $ rm -r b
80 $ rm -r b
81
81
82
82
83 import of plain diff should fail without message
83 import of plain diff should fail without message
84 (this also tests that editor is invoked, if the patch doesn't contain
84 (this also tests that editor is invoked, if the patch doesn't contain
85 the commit message, regardless of '--edit')
85 the commit message, regardless of '--edit')
86
86
87 $ hg clone -r0 a b
87 $ hg clone -r0 a b
88 adding changesets
88 adding changesets
89 adding manifests
89 adding manifests
90 adding file changes
90 adding file changes
91 added 1 changesets with 2 changes to 2 files
91 added 1 changesets with 2 changes to 2 files
92 updating to branch default
92 updating to branch default
93 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 $ cat > $TESTTMP/editor.sh <<EOF
94 $ cat > $TESTTMP/editor.sh <<EOF
95 > env | grep HGEDITFORM
95 > env | grep HGEDITFORM
96 > cat \$1
96 > cat \$1
97 > EOF
97 > EOF
98 $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch
98 $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch
99 applying ../diffed-tip.patch
99 applying ../diffed-tip.patch
100 HGEDITFORM=import.normal.normal
100 HGEDITFORM=import.normal.normal
101
101
102
102
103 HG: Enter commit message. Lines beginning with 'HG:' are removed.
103 HG: Enter commit message. Lines beginning with 'HG:' are removed.
104 HG: Leave message empty to abort commit.
104 HG: Leave message empty to abort commit.
105 HG: --
105 HG: --
106 HG: user: test
106 HG: user: test
107 HG: branch 'default'
107 HG: branch 'default'
108 HG: changed a
108 HG: changed a
109 abort: empty commit message
109 abort: empty commit message
110 [255]
110 [255]
111
111
112 Test avoiding editor invocation at applying the patch with --exact,
112 Test avoiding editor invocation at applying the patch with --exact,
113 even if commit message is empty
113 even if commit message is empty
114
114
115 $ echo a >> b/a
115 $ echo a >> b/a
116 $ hg --cwd b commit -m ' '
116 $ hg --cwd b commit -m ' '
117 $ hg --cwd b tip -T "{node}\n"
117 $ hg --cwd b tip -T "{node}\n"
118 d8804f3f5396d800812f579c8452796a5993bdb2
118 d8804f3f5396d800812f579c8452796a5993bdb2
119 $ hg --cwd b export -o ../empty-log.diff .
119 $ hg --cwd b export -o ../empty-log.diff .
120 $ hg --cwd b update -q -C ".^1"
120 $ hg --cwd b update -q -C ".^1"
121 $ hg --cwd b --config extensions.strip= strip -q tip
121 $ hg --cwd b --config extensions.strip= strip -q tip
122 $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff
122 $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff
123 applying ../empty-log.diff
123 applying ../empty-log.diff
124 $ hg --cwd b tip -T "{node}\n"
124 $ hg --cwd b tip -T "{node}\n"
125 d8804f3f5396d800812f579c8452796a5993bdb2
125 d8804f3f5396d800812f579c8452796a5993bdb2
126
126
127 $ rm -r b
127 $ rm -r b
128
128
129
129
130 import of plain diff should be ok with message
130 import of plain diff should be ok with message
131
131
132 $ hg clone -r0 a b
132 $ hg clone -r0 a b
133 adding changesets
133 adding changesets
134 adding manifests
134 adding manifests
135 adding file changes
135 adding file changes
136 added 1 changesets with 2 changes to 2 files
136 added 1 changesets with 2 changes to 2 files
137 updating to branch default
137 updating to branch default
138 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 $ hg --cwd b import -mpatch ../diffed-tip.patch
139 $ hg --cwd b import -mpatch ../diffed-tip.patch
140 applying ../diffed-tip.patch
140 applying ../diffed-tip.patch
141 $ rm -r b
141 $ rm -r b
142
142
143
143
144 import of plain diff with specific date and user
144 import of plain diff with specific date and user
145 (this also tests that editor is not invoked, if
145 (this also tests that editor is not invoked, if
146 '--message'/'--logfile' is specified and '--edit' is not)
146 '--message'/'--logfile' is specified and '--edit' is not)
147
147
148 $ hg clone -r0 a b
148 $ hg clone -r0 a b
149 adding changesets
149 adding changesets
150 adding manifests
150 adding manifests
151 adding file changes
151 adding file changes
152 added 1 changesets with 2 changes to 2 files
152 added 1 changesets with 2 changes to 2 files
153 updating to branch default
153 updating to branch default
154 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
155 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
156 applying ../diffed-tip.patch
156 applying ../diffed-tip.patch
157 $ hg -R b tip -pv
157 $ hg -R b tip -pv
158 changeset: 1:ca68f19f3a40
158 changeset: 1:ca68f19f3a40
159 tag: tip
159 tag: tip
160 user: user@nowhere.net
160 user: user@nowhere.net
161 date: Thu Jan 01 00:00:01 1970 +0000
161 date: Thu Jan 01 00:00:01 1970 +0000
162 files: a
162 files: a
163 description:
163 description:
164 patch
164 patch
165
165
166
166
167 diff -r 80971e65b431 -r ca68f19f3a40 a
167 diff -r 80971e65b431 -r ca68f19f3a40 a
168 --- a/a Thu Jan 01 00:00:00 1970 +0000
168 --- a/a Thu Jan 01 00:00:00 1970 +0000
169 +++ b/a Thu Jan 01 00:00:01 1970 +0000
169 +++ b/a Thu Jan 01 00:00:01 1970 +0000
170 @@ -1,1 +1,2 @@
170 @@ -1,1 +1,2 @@
171 line 1
171 line 1
172 +line 2
172 +line 2
173
173
174 $ rm -r b
174 $ rm -r b
175
175
176
176
177 import of plain diff should be ok with --no-commit
177 import of plain diff should be ok with --no-commit
178 (this also tests that editor is not invoked, if '--no-commit' is
178 (this also tests that editor is not invoked, if '--no-commit' is
179 specified, regardless of '--edit')
179 specified, regardless of '--edit')
180
180
181 $ hg clone -r0 a b
181 $ hg clone -r0 a b
182 adding changesets
182 adding changesets
183 adding manifests
183 adding manifests
184 adding file changes
184 adding file changes
185 added 1 changesets with 2 changes to 2 files
185 added 1 changesets with 2 changes to 2 files
186 updating to branch default
186 updating to branch default
187 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
188 $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch
188 $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch
189 applying ../diffed-tip.patch
189 applying ../diffed-tip.patch
190 $ hg --cwd b diff --nodates
190 $ hg --cwd b diff --nodates
191 diff -r 80971e65b431 a
191 diff -r 80971e65b431 a
192 --- a/a
192 --- a/a
193 +++ b/a
193 +++ b/a
194 @@ -1,1 +1,2 @@
194 @@ -1,1 +1,2 @@
195 line 1
195 line 1
196 +line 2
196 +line 2
197 $ rm -r b
197 $ rm -r b
198
198
199
199
200 import of malformed plain diff should fail
200 import of malformed plain diff should fail
201
201
202 $ hg clone -r0 a b
202 $ hg clone -r0 a b
203 adding changesets
203 adding changesets
204 adding manifests
204 adding manifests
205 adding file changes
205 adding file changes
206 added 1 changesets with 2 changes to 2 files
206 added 1 changesets with 2 changes to 2 files
207 updating to branch default
207 updating to branch default
208 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
209 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
210 $ hg --cwd b import -mpatch ../broken.patch
210 $ hg --cwd b import -mpatch ../broken.patch
211 applying ../broken.patch
211 applying ../broken.patch
212 abort: bad hunk #1
212 abort: bad hunk #1
213 [255]
213 [255]
214 $ rm -r b
214 $ rm -r b
215
215
216
216
217 hg -R repo import
217 hg -R repo import
218 put the clone in a subdir - having a directory named "a"
218 put the clone in a subdir - having a directory named "a"
219 used to hide a bug.
219 used to hide a bug.
220
220
221 $ mkdir dir
221 $ mkdir dir
222 $ hg clone -r0 a dir/b
222 $ hg clone -r0 a dir/b
223 adding changesets
223 adding changesets
224 adding manifests
224 adding manifests
225 adding file changes
225 adding file changes
226 added 1 changesets with 2 changes to 2 files
226 added 1 changesets with 2 changes to 2 files
227 updating to branch default
227 updating to branch default
228 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 $ cd dir
229 $ cd dir
230 $ hg -R b import ../exported-tip.patch
230 $ hg -R b import ../exported-tip.patch
231 applying ../exported-tip.patch
231 applying ../exported-tip.patch
232 $ cd ..
232 $ cd ..
233 $ rm -r dir
233 $ rm -r dir
234
234
235
235
236 import from stdin
236 import from stdin
237
237
238 $ hg clone -r0 a b
238 $ hg clone -r0 a b
239 adding changesets
239 adding changesets
240 adding manifests
240 adding manifests
241 adding file changes
241 adding file changes
242 added 1 changesets with 2 changes to 2 files
242 added 1 changesets with 2 changes to 2 files
243 updating to branch default
243 updating to branch default
244 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
245 $ hg --cwd b import - < exported-tip.patch
245 $ hg --cwd b import - < exported-tip.patch
246 applying patch from stdin
246 applying patch from stdin
247 $ rm -r b
247 $ rm -r b
248
248
249
249
250 import two patches in one stream
250 import two patches in one stream
251
251
252 $ hg init b
252 $ hg init b
253 $ hg --cwd a export 0:tip | hg --cwd b import -
253 $ hg --cwd a export 0:tip | hg --cwd b import -
254 applying patch from stdin
254 applying patch from stdin
255 $ hg --cwd a id
255 $ hg --cwd a id
256 1d4bd90af0e4 tip
256 1d4bd90af0e4 tip
257 $ hg --cwd b id
257 $ hg --cwd b id
258 1d4bd90af0e4 tip
258 1d4bd90af0e4 tip
259 $ rm -r b
259 $ rm -r b
260
260
261
261
262 override commit message
262 override commit message
263
263
264 $ hg clone -r0 a b
264 $ hg clone -r0 a b
265 adding changesets
265 adding changesets
266 adding manifests
266 adding manifests
267 adding file changes
267 adding file changes
268 added 1 changesets with 2 changes to 2 files
268 added 1 changesets with 2 changes to 2 files
269 updating to branch default
269 updating to branch default
270 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
270 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 $ hg --cwd b import -m 'override' - < exported-tip.patch
271 $ hg --cwd b import -m 'override' - < exported-tip.patch
272 applying patch from stdin
272 applying patch from stdin
273 $ hg --cwd b tip | grep override
273 $ hg --cwd b tip | grep override
274 summary: override
274 summary: override
275 $ rm -r b
275 $ rm -r b
276
276
277 $ cat > mkmsg.py <<EOF
277 $ cat > mkmsg.py <<EOF
278 > import email.Message, sys
278 > import email.Message, sys
279 > msg = email.Message.Message()
279 > msg = email.Message.Message()
280 > patch = open(sys.argv[1], 'rb').read()
280 > patch = open(sys.argv[1], 'rb').read()
281 > msg.set_payload('email commit message\n' + patch)
281 > msg.set_payload('email commit message\n' + patch)
282 > msg['Subject'] = 'email patch'
282 > msg['Subject'] = 'email patch'
283 > msg['From'] = 'email patcher'
283 > msg['From'] = 'email patcher'
284 > file(sys.argv[2], 'wb').write(msg.as_string())
284 > file(sys.argv[2], 'wb').write(msg.as_string())
285 > EOF
285 > EOF
286
286
287
287
288 plain diff in email, subject, message body
288 plain diff in email, subject, message body
289
289
290 $ hg clone -r0 a b
290 $ hg clone -r0 a b
291 adding changesets
291 adding changesets
292 adding manifests
292 adding manifests
293 adding file changes
293 adding file changes
294 added 1 changesets with 2 changes to 2 files
294 added 1 changesets with 2 changes to 2 files
295 updating to branch default
295 updating to branch default
296 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
297 $ $PYTHON mkmsg.py diffed-tip.patch msg.patch
297 $ $PYTHON mkmsg.py diffed-tip.patch msg.patch
298 $ hg --cwd b import ../msg.patch
298 $ hg --cwd b import ../msg.patch
299 applying ../msg.patch
299 applying ../msg.patch
300 $ hg --cwd b tip | grep email
300 $ hg --cwd b tip | grep email
301 user: email patcher
301 user: email patcher
302 summary: email patch
302 summary: email patch
303 $ rm -r b
303 $ rm -r b
304
304
305
305
306 plain diff in email, no subject, message body
306 plain diff in email, no subject, message body
307
307
308 $ hg clone -r0 a b
308 $ hg clone -r0 a b
309 adding changesets
309 adding changesets
310 adding manifests
310 adding manifests
311 adding file changes
311 adding file changes
312 added 1 changesets with 2 changes to 2 files
312 added 1 changesets with 2 changes to 2 files
313 updating to branch default
313 updating to branch default
314 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
315 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
315 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
316 applying patch from stdin
316 applying patch from stdin
317 $ rm -r b
317 $ rm -r b
318
318
319
319
320 plain diff in email, subject, no message body
320 plain diff in email, subject, no message body
321
321
322 $ hg clone -r0 a b
322 $ hg clone -r0 a b
323 adding changesets
323 adding changesets
324 adding manifests
324 adding manifests
325 adding file changes
325 adding file changes
326 added 1 changesets with 2 changes to 2 files
326 added 1 changesets with 2 changes to 2 files
327 updating to branch default
327 updating to branch default
328 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
328 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
329 $ grep -v '^email ' msg.patch | hg --cwd b import -
329 $ grep -v '^email ' msg.patch | hg --cwd b import -
330 applying patch from stdin
330 applying patch from stdin
331 $ rm -r b
331 $ rm -r b
332
332
333
333
334 plain diff in email, no subject, no message body, should fail
334 plain diff in email, no subject, no message body, should fail
335
335
336 $ hg clone -r0 a b
336 $ hg clone -r0 a b
337 adding changesets
337 adding changesets
338 adding manifests
338 adding manifests
339 adding file changes
339 adding file changes
340 added 1 changesets with 2 changes to 2 files
340 added 1 changesets with 2 changes to 2 files
341 updating to branch default
341 updating to branch default
342 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
343 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
343 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
344 applying patch from stdin
344 applying patch from stdin
345 abort: empty commit message
345 abort: empty commit message
346 [255]
346 [255]
347 $ rm -r b
347 $ rm -r b
348
348
349
349
350 hg export in email, should use patch header
350 hg export in email, should use patch header
351
351
352 $ hg clone -r0 a b
352 $ hg clone -r0 a b
353 adding changesets
353 adding changesets
354 adding manifests
354 adding manifests
355 adding file changes
355 adding file changes
356 added 1 changesets with 2 changes to 2 files
356 added 1 changesets with 2 changes to 2 files
357 updating to branch default
357 updating to branch default
358 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
358 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
359 $ $PYTHON mkmsg.py exported-tip.patch msg.patch
359 $ $PYTHON mkmsg.py exported-tip.patch msg.patch
360 $ cat msg.patch | hg --cwd b import -
360 $ cat msg.patch | hg --cwd b import -
361 applying patch from stdin
361 applying patch from stdin
362 $ hg --cwd b tip | grep second
362 $ hg --cwd b tip | grep second
363 summary: second change
363 summary: second change
364 $ rm -r b
364 $ rm -r b
365
365
366
366
367 subject: duplicate detection, removal of [PATCH]
367 subject: duplicate detection, removal of [PATCH]
368 The '---' tests the gitsendmail handling without proper mail headers
368 The '---' tests the gitsendmail handling without proper mail headers
369
369
370 $ cat > mkmsg2.py <<EOF
370 $ cat > mkmsg2.py <<EOF
371 > import email.Message, sys
371 > import email.Message, sys
372 > msg = email.Message.Message()
372 > msg = email.Message.Message()
373 > patch = open(sys.argv[1], 'rb').read()
373 > patch = open(sys.argv[1], 'rb').read()
374 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
374 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
375 > msg['Subject'] = '[PATCH] email patch'
375 > msg['Subject'] = '[PATCH] email patch'
376 > msg['From'] = 'email patcher'
376 > msg['From'] = 'email patcher'
377 > file(sys.argv[2], 'wb').write(msg.as_string())
377 > file(sys.argv[2], 'wb').write(msg.as_string())
378 > EOF
378 > EOF
379
379
380
380
381 plain diff in email, [PATCH] subject, message body with subject
381 plain diff in email, [PATCH] subject, message body with subject
382
382
383 $ hg clone -r0 a b
383 $ hg clone -r0 a b
384 adding changesets
384 adding changesets
385 adding manifests
385 adding manifests
386 adding file changes
386 adding file changes
387 added 1 changesets with 2 changes to 2 files
387 added 1 changesets with 2 changes to 2 files
388 updating to branch default
388 updating to branch default
389 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 $ $PYTHON mkmsg2.py diffed-tip.patch msg.patch
390 $ $PYTHON mkmsg2.py diffed-tip.patch msg.patch
391 $ cat msg.patch | hg --cwd b import -
391 $ cat msg.patch | hg --cwd b import -
392 applying patch from stdin
392 applying patch from stdin
393 $ hg --cwd b tip --template '{desc}\n'
393 $ hg --cwd b tip --template '{desc}\n'
394 email patch
394 email patch
395
395
396 next line
396 next line
397 $ rm -r b
397 $ rm -r b
398
398
399
399
400 Issue963: Parent of working dir incorrect after import of multiple
400 Issue963: Parent of working dir incorrect after import of multiple
401 patches and rollback
401 patches and rollback
402
402
403 We weren't backing up the correct dirstate file when importing many
403 We weren't backing up the correct dirstate file when importing many
404 patches: import patch1 patch2; rollback
404 patches: import patch1 patch2; rollback
405
405
406 $ echo line 3 >> a/a
406 $ echo line 3 >> a/a
407 $ hg --cwd a ci -m'third change'
407 $ hg --cwd a ci -m'third change'
408 $ hg --cwd a export -o '../patch%R' 1 2
408 $ hg --cwd a export -o '../patch%R' 1 2
409 $ hg clone -qr0 a b
409 $ hg clone -qr0 a b
410 $ hg --cwd b parents --template 'parent: {rev}\n'
410 $ hg --cwd b parents --template 'parent: {rev}\n'
411 parent: 0
411 parent: 0
412 $ hg --cwd b import -v ../patch1 ../patch2
412 $ hg --cwd b import -v ../patch1 ../patch2
413 applying ../patch1
413 applying ../patch1
414 patching file a
414 patching file a
415 committing files:
415 committing files:
416 a
416 a
417 committing manifest
417 committing manifest
418 committing changelog
418 committing changelog
419 created 1d4bd90af0e4
419 created 1d4bd90af0e4
420 applying ../patch2
420 applying ../patch2
421 patching file a
421 patching file a
422 committing files:
422 committing files:
423 a
423 a
424 committing manifest
424 committing manifest
425 committing changelog
425 committing changelog
426 created 6d019af21222
426 created 6d019af21222
427 $ hg --cwd b rollback
427 $ hg --cwd b rollback
428 repository tip rolled back to revision 0 (undo import)
428 repository tip rolled back to revision 0 (undo import)
429 working directory now based on revision 0
429 working directory now based on revision 0
430 $ hg --cwd b parents --template 'parent: {rev}\n'
430 $ hg --cwd b parents --template 'parent: {rev}\n'
431 parent: 0
431 parent: 0
432
432
433 Test that "hg rollback" doesn't restore dirstate to one at the
433 Test that "hg rollback" doesn't restore dirstate to one at the
434 beginning of the rolled back transaction in not-"parent-gone" case.
434 beginning of the rolled back transaction in not-"parent-gone" case.
435
435
436 invoking pretxncommit hook will cause marking '.hg/dirstate' as a file
436 invoking pretxncommit hook will cause marking '.hg/dirstate' as a file
437 to be restored when rolling back, after DirstateTransactionPlan (see wiki
437 to be restored when rolling back, after DirstateTransactionPlan (see wiki
438 page for detail).
438 page for detail).
439
439
440 $ hg --cwd b branch -q foobar
440 $ hg --cwd b branch -q foobar
441 $ hg --cwd b commit -m foobar
441 $ hg --cwd b commit -m foobar
442 $ hg --cwd b update 0 -q
442 $ hg --cwd b update 0 -q
443 $ hg --cwd b import ../patch1 ../patch2 --config hooks.pretxncommit=true
443 $ hg --cwd b import ../patch1 ../patch2 --config hooks.pretxncommit=true
444 applying ../patch1
444 applying ../patch1
445 applying ../patch2
445 applying ../patch2
446 $ hg --cwd b update -q 1
446 $ hg --cwd b update -q 1
447 $ hg --cwd b rollback -q
447 $ hg --cwd b rollback -q
448 $ hg --cwd b parents --template 'parent: {rev}\n'
448 $ hg --cwd b parents --template 'parent: {rev}\n'
449 parent: 1
449 parent: 1
450
450
451 $ hg --cwd b update -q -C 0
451 $ hg --cwd b update -q -C 0
452 $ hg --cwd b --config extensions.strip= strip -q 1
452 $ hg --cwd b --config extensions.strip= strip -q 1
453
453
454 Test visibility of in-memory dirstate changes inside transaction to
454 Test visibility of in-memory dirstate changes inside transaction to
455 external process
455 external process
456
456
457 $ echo foo > a/foo
457 $ echo foo > a/foo
458 $ hg --cwd a commit -A -m 'adding foo' foo
458 $ hg --cwd a commit -A -m 'adding foo' foo
459 $ hg --cwd a export -o '../patch%R' 3
459 $ hg --cwd a export -o '../patch%R' 3
460
460
461 $ cat > $TESTTMP/checkvisibility.sh <<EOF
461 $ cat > $TESTTMP/checkvisibility.sh <<EOF
462 > echo "===="
462 > echo "===="
463 > hg parents --template "VISIBLE {rev}:{node|short}\n"
463 > hg parents --template "VISIBLE {rev}:{node|short}\n"
464 > hg status -amr
464 > hg status -amr
465 > # test that pending changes are hidden
465 > # test that pending changes are hidden
466 > unset HG_PENDING
466 > unset HG_PENDING
467 > hg parents --template "ACTUAL {rev}:{node|short}\n"
467 > hg parents --template "ACTUAL {rev}:{node|short}\n"
468 > hg status -amr
468 > hg status -amr
469 > echo "===="
469 > echo "===="
470 > EOF
470 > EOF
471
471
472 == test visibility to external editor
472 == test visibility to external editor
473
473
474 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
474 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
475 ====
475 ====
476 VISIBLE 0:80971e65b431
476 VISIBLE 0:80971e65b431
477 ACTUAL 0:80971e65b431
477 ACTUAL 0:80971e65b431
478 ====
478 ====
479
479
480 $ HGEDITOR="sh $TESTTMP/checkvisibility.sh" hg --cwd b import -v --edit ../patch1 ../patch2 ../patch3
480 $ HGEDITOR="sh $TESTTMP/checkvisibility.sh" hg --cwd b import -v --edit ../patch1 ../patch2 ../patch3
481 applying ../patch1
481 applying ../patch1
482 patching file a
482 patching file a
483 ====
483 ====
484 VISIBLE 0:80971e65b431
484 VISIBLE 0:80971e65b431
485 M a
485 M a
486 ACTUAL 0:80971e65b431
486 ACTUAL 0:80971e65b431
487 M a
487 M a
488 ====
488 ====
489 committing files:
489 committing files:
490 a
490 a
491 committing manifest
491 committing manifest
492 committing changelog
492 committing changelog
493 created 1d4bd90af0e4
493 created 1d4bd90af0e4
494 applying ../patch2
494 applying ../patch2
495 patching file a
495 patching file a
496 ====
496 ====
497 VISIBLE 1:1d4bd90af0e4
497 VISIBLE 1:1d4bd90af0e4
498 M a
498 M a
499 ACTUAL 0:80971e65b431
499 ACTUAL 0:80971e65b431
500 M a
500 M a
501 ====
501 ====
502 committing files:
502 committing files:
503 a
503 a
504 committing manifest
504 committing manifest
505 committing changelog
505 committing changelog
506 created 6d019af21222
506 created 6d019af21222
507 applying ../patch3
507 applying ../patch3
508 patching file foo
508 patching file foo
509 adding foo
509 adding foo
510 ====
510 ====
511 VISIBLE 2:6d019af21222
511 VISIBLE 2:6d019af21222
512 A foo
512 A foo
513 ACTUAL 0:80971e65b431
513 ACTUAL 0:80971e65b431
514 M a
514 M a
515 ====
515 ====
516 committing files:
516 committing files:
517 foo
517 foo
518 committing manifest
518 committing manifest
519 committing changelog
519 committing changelog
520 created 55e3f75b2378
520 created 55e3f75b2378
521
521
522 $ hg --cwd b rollback -q
522 $ hg --cwd b rollback -q
523
523
524 (content of file "a" is already changed and it should be recognized as
524 (content of file "a" is already changed and it should be recognized as
525 "M", even though dirstate is restored to one before "hg import")
525 "M", even though dirstate is restored to one before "hg import")
526
526
527 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
527 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
528 ====
528 ====
529 VISIBLE 0:80971e65b431
529 VISIBLE 0:80971e65b431
530 M a
530 M a
531 ACTUAL 0:80971e65b431
531 ACTUAL 0:80971e65b431
532 M a
532 M a
533 ====
533 ====
534 $ hg --cwd b revert --no-backup a
534 $ hg --cwd b revert --no-backup a
535 $ rm -f b/foo
535 $ rm -f b/foo
536
536
537 == test visibility to precommit external hook
537 == test visibility to precommit external hook
538
538
539 $ cat >> b/.hg/hgrc <<EOF
539 $ cat >> b/.hg/hgrc <<EOF
540 > [hooks]
540 > [hooks]
541 > precommit.visibility = sh $TESTTMP/checkvisibility.sh
541 > precommit.visibility = sh $TESTTMP/checkvisibility.sh
542 > EOF
542 > EOF
543
543
544 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
544 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
545 ====
545 ====
546 VISIBLE 0:80971e65b431
546 VISIBLE 0:80971e65b431
547 ACTUAL 0:80971e65b431
547 ACTUAL 0:80971e65b431
548 ====
548 ====
549
549
550 $ hg --cwd b import ../patch1 ../patch2 ../patch3
550 $ hg --cwd b import ../patch1 ../patch2 ../patch3
551 applying ../patch1
551 applying ../patch1
552 ====
552 ====
553 VISIBLE 0:80971e65b431
553 VISIBLE 0:80971e65b431
554 M a
554 M a
555 ACTUAL 0:80971e65b431
555 ACTUAL 0:80971e65b431
556 M a
556 M a
557 ====
557 ====
558 applying ../patch2
558 applying ../patch2
559 ====
559 ====
560 VISIBLE 1:1d4bd90af0e4
560 VISIBLE 1:1d4bd90af0e4
561 M a
561 M a
562 ACTUAL 0:80971e65b431
562 ACTUAL 0:80971e65b431
563 M a
563 M a
564 ====
564 ====
565 applying ../patch3
565 applying ../patch3
566 ====
566 ====
567 VISIBLE 2:6d019af21222
567 VISIBLE 2:6d019af21222
568 A foo
568 A foo
569 ACTUAL 0:80971e65b431
569 ACTUAL 0:80971e65b431
570 M a
570 M a
571 ====
571 ====
572
572
573 $ hg --cwd b rollback -q
573 $ hg --cwd b rollback -q
574 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
574 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
575 ====
575 ====
576 VISIBLE 0:80971e65b431
576 VISIBLE 0:80971e65b431
577 M a
577 M a
578 ACTUAL 0:80971e65b431
578 ACTUAL 0:80971e65b431
579 M a
579 M a
580 ====
580 ====
581 $ hg --cwd b revert --no-backup a
581 $ hg --cwd b revert --no-backup a
582 $ rm -f b/foo
582 $ rm -f b/foo
583
583
584 $ cat >> b/.hg/hgrc <<EOF
584 $ cat >> b/.hg/hgrc <<EOF
585 > [hooks]
585 > [hooks]
586 > precommit.visibility =
586 > precommit.visibility =
587 > EOF
587 > EOF
588
588
589 == test visibility to pretxncommit external hook
589 == test visibility to pretxncommit external hook
590
590
591 $ cat >> b/.hg/hgrc <<EOF
591 $ cat >> b/.hg/hgrc <<EOF
592 > [hooks]
592 > [hooks]
593 > pretxncommit.visibility = sh $TESTTMP/checkvisibility.sh
593 > pretxncommit.visibility = sh $TESTTMP/checkvisibility.sh
594 > EOF
594 > EOF
595
595
596 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
596 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
597 ====
597 ====
598 VISIBLE 0:80971e65b431
598 VISIBLE 0:80971e65b431
599 ACTUAL 0:80971e65b431
599 ACTUAL 0:80971e65b431
600 ====
600 ====
601
601
602 $ hg --cwd b import ../patch1 ../patch2 ../patch3
602 $ hg --cwd b import ../patch1 ../patch2 ../patch3
603 applying ../patch1
603 applying ../patch1
604 ====
604 ====
605 VISIBLE 0:80971e65b431
605 VISIBLE 0:80971e65b431
606 M a
606 M a
607 ACTUAL 0:80971e65b431
607 ACTUAL 0:80971e65b431
608 M a
608 M a
609 ====
609 ====
610 applying ../patch2
610 applying ../patch2
611 ====
611 ====
612 VISIBLE 1:1d4bd90af0e4
612 VISIBLE 1:1d4bd90af0e4
613 M a
613 M a
614 ACTUAL 0:80971e65b431
614 ACTUAL 0:80971e65b431
615 M a
615 M a
616 ====
616 ====
617 applying ../patch3
617 applying ../patch3
618 ====
618 ====
619 VISIBLE 2:6d019af21222
619 VISIBLE 2:6d019af21222
620 A foo
620 A foo
621 ACTUAL 0:80971e65b431
621 ACTUAL 0:80971e65b431
622 M a
622 M a
623 ====
623 ====
624
624
625 $ hg --cwd b rollback -q
625 $ hg --cwd b rollback -q
626 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
626 $ (cd b && sh "$TESTTMP/checkvisibility.sh")
627 ====
627 ====
628 VISIBLE 0:80971e65b431
628 VISIBLE 0:80971e65b431
629 M a
629 M a
630 ACTUAL 0:80971e65b431
630 ACTUAL 0:80971e65b431
631 M a
631 M a
632 ====
632 ====
633 $ hg --cwd b revert --no-backup a
633 $ hg --cwd b revert --no-backup a
634 $ rm -f b/foo
634 $ rm -f b/foo
635
635
636 $ cat >> b/.hg/hgrc <<EOF
636 $ cat >> b/.hg/hgrc <<EOF
637 > [hooks]
637 > [hooks]
638 > pretxncommit.visibility =
638 > pretxncommit.visibility =
639 > EOF
639 > EOF
640
640
641 $ rm -r b
641 $ rm -r b
642
642
643
643
644 importing a patch in a subdirectory failed at the commit stage
644 importing a patch in a subdirectory failed at the commit stage
645
645
646 $ echo line 2 >> a/d1/d2/a
646 $ echo line 2 >> a/d1/d2/a
647 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
647 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
648
648
649 hg import in a subdirectory
649 hg import in a subdirectory
650
650
651 $ hg clone -r0 a b
651 $ hg clone -r0 a b
652 adding changesets
652 adding changesets
653 adding manifests
653 adding manifests
654 adding file changes
654 adding file changes
655 added 1 changesets with 2 changes to 2 files
655 added 1 changesets with 2 changes to 2 files
656 updating to branch default
656 updating to branch default
657 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
657 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
658 $ hg --cwd a export tip > tmp
658 $ hg --cwd a export tip > tmp
659 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
659 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
660 $ dir=`pwd`
660 $ dir=`pwd`
661 $ cd b/d1/d2 2>&1 > /dev/null
661 $ cd b/d1/d2 2>&1 > /dev/null
662 $ hg import ../../../subdir-tip.patch
662 $ hg import ../../../subdir-tip.patch
663 applying ../../../subdir-tip.patch
663 applying ../../../subdir-tip.patch
664 $ cd "$dir"
664 $ cd "$dir"
665
665
666 message should be 'subdir change'
666 message should be 'subdir change'
667 committer should be 'someoneelse'
667 committer should be 'someoneelse'
668
668
669 $ hg --cwd b tip
669 $ hg --cwd b tip
670 changeset: 1:3577f5aea227
670 changeset: 1:3577f5aea227
671 tag: tip
671 tag: tip
672 user: someoneelse
672 user: someoneelse
673 date: Thu Jan 01 00:00:01 1970 +0000
673 date: Thu Jan 01 00:00:01 1970 +0000
674 summary: subdir change
674 summary: subdir change
675
675
676
676
677 should be empty
677 should be empty
678
678
679 $ hg --cwd b status
679 $ hg --cwd b status
680
680
681
681
682 Test fuzziness (ambiguous patch location, fuzz=2)
682 Test fuzziness (ambiguous patch location, fuzz=2)
683
683
684 $ hg init fuzzy
684 $ hg init fuzzy
685 $ cd fuzzy
685 $ cd fuzzy
686 $ echo line1 > a
686 $ echo line1 > a
687 $ echo line0 >> a
687 $ echo line0 >> a
688 $ echo line3 >> a
688 $ echo line3 >> a
689 $ hg ci -Am adda
689 $ hg ci -Am adda
690 adding a
690 adding a
691 $ echo line1 > a
691 $ echo line1 > a
692 $ echo line2 >> a
692 $ echo line2 >> a
693 $ echo line0 >> a
693 $ echo line0 >> a
694 $ echo line3 >> a
694 $ echo line3 >> a
695 $ hg ci -m change a
695 $ hg ci -m change a
696 $ hg export tip > fuzzy-tip.patch
696 $ hg export tip > fuzzy-tip.patch
697 $ hg up -C 0
697 $ hg up -C 0
698 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
698 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
699 $ echo line1 > a
699 $ echo line1 > a
700 $ echo line0 >> a
700 $ echo line0 >> a
701 $ echo line1 >> a
701 $ echo line1 >> a
702 $ echo line0 >> a
702 $ echo line0 >> a
703 $ hg ci -m brancha
703 $ hg ci -m brancha
704 created new head
704 created new head
705 $ hg import --config patch.fuzz=0 -v fuzzy-tip.patch
705 $ hg import --config patch.fuzz=0 -v fuzzy-tip.patch
706 applying fuzzy-tip.patch
706 applying fuzzy-tip.patch
707 patching file a
707 patching file a
708 Hunk #1 FAILED at 0
708 Hunk #1 FAILED at 0
709 1 out of 1 hunks FAILED -- saving rejects to file a.rej
709 1 out of 1 hunks FAILED -- saving rejects to file a.rej
710 abort: patch failed to apply
710 abort: patch failed to apply
711 [255]
711 [255]
712 $ hg import --no-commit -v fuzzy-tip.patch
712 $ hg import --no-commit -v fuzzy-tip.patch
713 applying fuzzy-tip.patch
713 applying fuzzy-tip.patch
714 patching file a
714 patching file a
715 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
715 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
716 applied to working directory
716 applied to working directory
717 $ hg revert -a
717 $ hg revert -a
718 reverting a
718 reverting a
719
719
720
720
721 import with --no-commit should have written .hg/last-message.txt
721 import with --no-commit should have written .hg/last-message.txt
722
722
723 $ cat .hg/last-message.txt
723 $ cat .hg/last-message.txt
724 change (no-eol)
724 change (no-eol)
725
725
726
726
727 test fuzziness with eol=auto
727 test fuzziness with eol=auto
728
728
729 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
729 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
730 applying fuzzy-tip.patch
730 applying fuzzy-tip.patch
731 patching file a
731 patching file a
732 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
732 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
733 applied to working directory
733 applied to working directory
734 $ cd ..
734 $ cd ..
735
735
736
736
737 Test hunk touching empty files (issue906)
737 Test hunk touching empty files (issue906)
738
738
739 $ hg init empty
739 $ hg init empty
740 $ cd empty
740 $ cd empty
741 $ touch a
741 $ touch a
742 $ touch b1
742 $ touch b1
743 $ touch c1
743 $ touch c1
744 $ echo d > d
744 $ echo d > d
745 $ hg ci -Am init
745 $ hg ci -Am init
746 adding a
746 adding a
747 adding b1
747 adding b1
748 adding c1
748 adding c1
749 adding d
749 adding d
750 $ echo a > a
750 $ echo a > a
751 $ echo b > b1
751 $ echo b > b1
752 $ hg mv b1 b2
752 $ hg mv b1 b2
753 $ echo c > c1
753 $ echo c > c1
754 $ hg copy c1 c2
754 $ hg copy c1 c2
755 $ rm d
755 $ rm d
756 $ touch d
756 $ touch d
757 $ hg diff --git
757 $ hg diff --git
758 diff --git a/a b/a
758 diff --git a/a b/a
759 --- a/a
759 --- a/a
760 +++ b/a
760 +++ b/a
761 @@ -0,0 +1,1 @@
761 @@ -0,0 +1,1 @@
762 +a
762 +a
763 diff --git a/b1 b/b2
763 diff --git a/b1 b/b2
764 rename from b1
764 rename from b1
765 rename to b2
765 rename to b2
766 --- a/b1
766 --- a/b1
767 +++ b/b2
767 +++ b/b2
768 @@ -0,0 +1,1 @@
768 @@ -0,0 +1,1 @@
769 +b
769 +b
770 diff --git a/c1 b/c1
770 diff --git a/c1 b/c1
771 --- a/c1
771 --- a/c1
772 +++ b/c1
772 +++ b/c1
773 @@ -0,0 +1,1 @@
773 @@ -0,0 +1,1 @@
774 +c
774 +c
775 diff --git a/c1 b/c2
775 diff --git a/c1 b/c2
776 copy from c1
776 copy from c1
777 copy to c2
777 copy to c2
778 --- a/c1
778 --- a/c1
779 +++ b/c2
779 +++ b/c2
780 @@ -0,0 +1,1 @@
780 @@ -0,0 +1,1 @@
781 +c
781 +c
782 diff --git a/d b/d
782 diff --git a/d b/d
783 --- a/d
783 --- a/d
784 +++ b/d
784 +++ b/d
785 @@ -1,1 +0,0 @@
785 @@ -1,1 +0,0 @@
786 -d
786 -d
787 $ hg ci -m empty
787 $ hg ci -m empty
788 $ hg export --git tip > empty.diff
788 $ hg export --git tip > empty.diff
789 $ hg up -C 0
789 $ hg up -C 0
790 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
790 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
791 $ hg import empty.diff
791 $ hg import empty.diff
792 applying empty.diff
792 applying empty.diff
793 $ for name in a b1 b2 c1 c2 d; do
793 $ for name in a b1 b2 c1 c2 d; do
794 > echo % $name file
794 > echo % $name file
795 > test -f $name && cat $name
795 > test -f $name && cat $name
796 > done
796 > done
797 % a file
797 % a file
798 a
798 a
799 % b1 file
799 % b1 file
800 % b2 file
800 % b2 file
801 b
801 b
802 % c1 file
802 % c1 file
803 c
803 c
804 % c2 file
804 % c2 file
805 c
805 c
806 % d file
806 % d file
807 $ cd ..
807 $ cd ..
808
808
809
809
810 Test importing a patch ending with a binary file removal
810 Test importing a patch ending with a binary file removal
811
811
812 $ hg init binaryremoval
812 $ hg init binaryremoval
813 $ cd binaryremoval
813 $ cd binaryremoval
814 $ echo a > a
814 $ echo a > a
815 $ $PYTHON -c "file('b', 'wb').write('a\x00b')"
815 $ $PYTHON -c "file('b', 'wb').write('a\x00b')"
816 $ hg ci -Am addall
816 $ hg ci -Am addall
817 adding a
817 adding a
818 adding b
818 adding b
819 $ hg rm a
819 $ hg rm a
820 $ hg rm b
820 $ hg rm b
821 $ hg st
821 $ hg st
822 R a
822 R a
823 R b
823 R b
824 $ hg ci -m remove
824 $ hg ci -m remove
825 $ hg export --git . > remove.diff
825 $ hg export --git . > remove.diff
826 $ cat remove.diff | grep git
826 $ cat remove.diff | grep git
827 diff --git a/a b/a
827 diff --git a/a b/a
828 diff --git a/b b/b
828 diff --git a/b b/b
829 $ hg up -C 0
829 $ hg up -C 0
830 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
830 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
831 $ hg import remove.diff
831 $ hg import remove.diff
832 applying remove.diff
832 applying remove.diff
833 $ hg manifest
833 $ hg manifest
834 $ cd ..
834 $ cd ..
835
835
836
836
837 Issue927: test update+rename with common name
837 Issue927: test update+rename with common name
838
838
839 $ hg init t
839 $ hg init t
840 $ cd t
840 $ cd t
841 $ touch a
841 $ touch a
842 $ hg ci -Am t
842 $ hg ci -Am t
843 adding a
843 adding a
844 $ echo a > a
844 $ echo a > a
845
845
846 Here, bfile.startswith(afile)
846 Here, bfile.startswith(afile)
847
847
848 $ hg copy a a2
848 $ hg copy a a2
849 $ hg ci -m copya
849 $ hg ci -m copya
850 $ hg export --git tip > copy.diff
850 $ hg export --git tip > copy.diff
851 $ hg up -C 0
851 $ hg up -C 0
852 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
852 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
853 $ hg import copy.diff
853 $ hg import copy.diff
854 applying copy.diff
854 applying copy.diff
855
855
856 a should contain an 'a'
856 a should contain an 'a'
857
857
858 $ cat a
858 $ cat a
859 a
859 a
860
860
861 and a2 should have duplicated it
861 and a2 should have duplicated it
862
862
863 $ cat a2
863 $ cat a2
864 a
864 a
865 $ cd ..
865 $ cd ..
866
866
867
867
868 test -p0
868 test -p0
869
869
870 $ hg init p0
870 $ hg init p0
871 $ cd p0
871 $ cd p0
872 $ echo a > a
872 $ echo a > a
873 $ hg ci -Am t
873 $ hg ci -Am t
874 adding a
874 adding a
875 $ hg import -p foo
875 $ hg import -p foo
876 abort: invalid value 'foo' for option -p, expected int
876 abort: invalid value 'foo' for option -p, expected int
877 [255]
877 [255]
878 $ hg import -p0 - << EOF
878 $ hg import -p0 - << EOF
879 > foobar
879 > foobar
880 > --- a Sat Apr 12 22:43:58 2008 -0400
880 > --- a Sat Apr 12 22:43:58 2008 -0400
881 > +++ a Sat Apr 12 22:44:05 2008 -0400
881 > +++ a Sat Apr 12 22:44:05 2008 -0400
882 > @@ -1,1 +1,1 @@
882 > @@ -1,1 +1,1 @@
883 > -a
883 > -a
884 > +bb
884 > +bb
885 > EOF
885 > EOF
886 applying patch from stdin
886 applying patch from stdin
887 $ hg status
887 $ hg status
888 $ cat a
888 $ cat a
889 bb
889 bb
890
890
891 test --prefix
891 test --prefix
892
892
893 $ mkdir -p dir/dir2
893 $ mkdir -p dir/dir2
894 $ echo b > dir/dir2/b
894 $ echo b > dir/dir2/b
895 $ hg ci -Am b
895 $ hg ci -Am b
896 adding dir/dir2/b
896 adding dir/dir2/b
897 $ hg import -p2 --prefix dir - << EOF
897 $ hg import -p2 --prefix dir - << EOF
898 > foobar
898 > foobar
899 > --- drop1/drop2/dir2/b
899 > --- drop1/drop2/dir2/b
900 > +++ drop1/drop2/dir2/b
900 > +++ drop1/drop2/dir2/b
901 > @@ -1,1 +1,1 @@
901 > @@ -1,1 +1,1 @@
902 > -b
902 > -b
903 > +cc
903 > +cc
904 > EOF
904 > EOF
905 applying patch from stdin
905 applying patch from stdin
906 $ hg status
906 $ hg status
907 $ cat dir/dir2/b
907 $ cat dir/dir2/b
908 cc
908 cc
909 $ cd ..
909 $ cd ..
910
910
911
911
912 test paths outside repo root
912 test paths outside repo root
913
913
914 $ mkdir outside
914 $ mkdir outside
915 $ touch outside/foo
915 $ touch outside/foo
916 $ hg init inside
916 $ hg init inside
917 $ cd inside
917 $ cd inside
918 $ hg import - <<EOF
918 $ hg import - <<EOF
919 > diff --git a/a b/b
919 > diff --git a/a b/b
920 > rename from ../outside/foo
920 > rename from ../outside/foo
921 > rename to bar
921 > rename to bar
922 > EOF
922 > EOF
923 applying patch from stdin
923 applying patch from stdin
924 abort: path contains illegal component: ../outside/foo (glob)
924 abort: path contains illegal component: ../outside/foo (glob)
925 [255]
925 [255]
926 $ cd ..
926 $ cd ..
927
927
928
928
929 test import with similarity and git and strip (issue295 et al.)
929 test import with similarity and git and strip (issue295 et al.)
930
930
931 $ hg init sim
931 $ hg init sim
932 $ cd sim
932 $ cd sim
933 $ echo 'this is a test' > a
933 $ echo 'this is a test' > a
934 $ hg ci -Ama
934 $ hg ci -Ama
935 adding a
935 adding a
936 $ cat > ../rename.diff <<EOF
936 $ cat > ../rename.diff <<EOF
937 > diff --git a/foo/a b/foo/a
937 > diff --git a/foo/a b/foo/a
938 > deleted file mode 100644
938 > deleted file mode 100644
939 > --- a/foo/a
939 > --- a/foo/a
940 > +++ /dev/null
940 > +++ /dev/null
941 > @@ -1,1 +0,0 @@
941 > @@ -1,1 +0,0 @@
942 > -this is a test
942 > -this is a test
943 > diff --git a/foo/b b/foo/b
943 > diff --git a/foo/b b/foo/b
944 > new file mode 100644
944 > new file mode 100644
945 > --- /dev/null
945 > --- /dev/null
946 > +++ b/foo/b
946 > +++ b/foo/b
947 > @@ -0,0 +1,2 @@
947 > @@ -0,0 +1,2 @@
948 > +this is a test
948 > +this is a test
949 > +foo
949 > +foo
950 > EOF
950 > EOF
951 $ hg import --no-commit -v -s 1 ../rename.diff -p2
951 $ hg import --no-commit -v -s 1 ../rename.diff -p2
952 applying ../rename.diff
952 applying ../rename.diff
953 patching file a
953 patching file a
954 patching file b
954 patching file b
955 adding b
955 adding b
956 recording removal of a as rename to b (88% similar)
956 recording removal of a as rename to b (88% similar)
957 applied to working directory
957 applied to working directory
958 $ hg st -C
958 $ hg st -C
959 A b
959 A b
960 a
960 a
961 R a
961 R a
962 $ hg revert -a
962 $ hg revert -a
963 undeleting a
963 undeleting a
964 forgetting b
964 forgetting b
965 $ rm b
965 $ rm b
966 $ hg import --no-commit -v -s 100 ../rename.diff -p2
966 $ hg import --no-commit -v -s 100 ../rename.diff -p2
967 applying ../rename.diff
967 applying ../rename.diff
968 patching file a
968 patching file a
969 patching file b
969 patching file b
970 adding b
970 adding b
971 applied to working directory
971 applied to working directory
972 $ hg st -C
972 $ hg st -C
973 A b
973 A b
974 R a
974 R a
975 $ cd ..
975 $ cd ..
976
976
977
977
978 Issue1495: add empty file from the end of patch
978 Issue1495: add empty file from the end of patch
979
979
980 $ hg init addemptyend
980 $ hg init addemptyend
981 $ cd addemptyend
981 $ cd addemptyend
982 $ touch a
982 $ touch a
983 $ hg addremove
983 $ hg addremove
984 adding a
984 adding a
985 $ hg ci -m "commit"
985 $ hg ci -m "commit"
986 $ cat > a.patch <<EOF
986 $ cat > a.patch <<EOF
987 > add a, b
987 > add a, b
988 > diff --git a/a b/a
988 > diff --git a/a b/a
989 > --- a/a
989 > --- a/a
990 > +++ b/a
990 > +++ b/a
991 > @@ -0,0 +1,1 @@
991 > @@ -0,0 +1,1 @@
992 > +a
992 > +a
993 > diff --git a/b b/b
993 > diff --git a/b b/b
994 > new file mode 100644
994 > new file mode 100644
995 > EOF
995 > EOF
996 $ hg import --no-commit a.patch
996 $ hg import --no-commit a.patch
997 applying a.patch
997 applying a.patch
998
998
999 apply a good patch followed by an empty patch (mainly to ensure
999 apply a good patch followed by an empty patch (mainly to ensure
1000 that dirstate is *not* updated when import crashes)
1000 that dirstate is *not* updated when import crashes)
1001 $ hg update -q -C .
1001 $ hg update -q -C .
1002 $ rm b
1002 $ rm b
1003 $ touch empty.patch
1003 $ touch empty.patch
1004 $ hg import a.patch empty.patch
1004 $ hg import a.patch empty.patch
1005 applying a.patch
1005 applying a.patch
1006 applying empty.patch
1006 applying empty.patch
1007 transaction abort!
1007 transaction abort!
1008 rollback completed
1008 rollback completed
1009 abort: empty.patch: no diffs found
1009 abort: empty.patch: no diffs found
1010 [255]
1010 [255]
1011 $ hg tip --template '{rev} {desc|firstline}\n'
1011 $ hg tip --template '{rev} {desc|firstline}\n'
1012 0 commit
1012 0 commit
1013 $ hg -q status
1013 $ hg -q status
1014 M a
1014 M a
1015 $ cd ..
1015 $ cd ..
1016
1016
1017 create file when source is not /dev/null
1017 create file when source is not /dev/null
1018
1018
1019 $ cat > create.patch <<EOF
1019 $ cat > create.patch <<EOF
1020 > diff -Naur proj-orig/foo proj-new/foo
1020 > diff -Naur proj-orig/foo proj-new/foo
1021 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
1021 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
1022 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
1022 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
1023 > @@ -0,0 +1,1 @@
1023 > @@ -0,0 +1,1 @@
1024 > +a
1024 > +a
1025 > EOF
1025 > EOF
1026
1026
1027 some people have patches like the following too
1027 some people have patches like the following too
1028
1028
1029 $ cat > create2.patch <<EOF
1029 $ cat > create2.patch <<EOF
1030 > diff -Naur proj-orig/foo proj-new/foo
1030 > diff -Naur proj-orig/foo proj-new/foo
1031 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
1031 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
1032 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
1032 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
1033 > @@ -0,0 +1,1 @@
1033 > @@ -0,0 +1,1 @@
1034 > +a
1034 > +a
1035 > EOF
1035 > EOF
1036 $ hg init oddcreate
1036 $ hg init oddcreate
1037 $ cd oddcreate
1037 $ cd oddcreate
1038 $ hg import --no-commit ../create.patch
1038 $ hg import --no-commit ../create.patch
1039 applying ../create.patch
1039 applying ../create.patch
1040 $ cat foo
1040 $ cat foo
1041 a
1041 a
1042 $ rm foo
1042 $ rm foo
1043 $ hg revert foo
1043 $ hg revert foo
1044 $ hg import --no-commit ../create2.patch
1044 $ hg import --no-commit ../create2.patch
1045 applying ../create2.patch
1045 applying ../create2.patch
1046 $ cat foo
1046 $ cat foo
1047 a
1047 a
1048
1048
1049 $ cd ..
1049 $ cd ..
1050
1050
1051 Issue1859: first line mistaken for email headers
1051 Issue1859: first line mistaken for email headers
1052
1052
1053 $ hg init emailconfusion
1053 $ hg init emailconfusion
1054 $ cd emailconfusion
1054 $ cd emailconfusion
1055 $ cat > a.patch <<EOF
1055 $ cat > a.patch <<EOF
1056 > module: summary
1056 > module: summary
1057 >
1057 >
1058 > description
1058 > description
1059 >
1059 >
1060 >
1060 >
1061 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
1061 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
1062 > --- /dev/null
1062 > --- /dev/null
1063 > +++ b/a
1063 > +++ b/a
1064 > @@ -0,0 +1,1 @@
1064 > @@ -0,0 +1,1 @@
1065 > +a
1065 > +a
1066 > EOF
1066 > EOF
1067 $ hg import -d '0 0' a.patch
1067 $ hg import -d '0 0' a.patch
1068 applying a.patch
1068 applying a.patch
1069 $ hg parents -v
1069 $ hg parents -v
1070 changeset: 0:5a681217c0ad
1070 changeset: 0:5a681217c0ad
1071 tag: tip
1071 tag: tip
1072 user: test
1072 user: test
1073 date: Thu Jan 01 00:00:00 1970 +0000
1073 date: Thu Jan 01 00:00:00 1970 +0000
1074 files: a
1074 files: a
1075 description:
1075 description:
1076 module: summary
1076 module: summary
1077
1077
1078 description
1078 description
1079
1079
1080
1080
1081 $ cd ..
1081 $ cd ..
1082
1082
1083
1083
1084 in commit message
1084 in commit message
1085
1085
1086 $ hg init commitconfusion
1086 $ hg init commitconfusion
1087 $ cd commitconfusion
1087 $ cd commitconfusion
1088 $ cat > a.patch <<EOF
1088 $ cat > a.patch <<EOF
1089 > module: summary
1089 > module: summary
1090 >
1090 >
1091 > --- description
1091 > --- description
1092 >
1092 >
1093 > diff --git a/a b/a
1093 > diff --git a/a b/a
1094 > new file mode 100644
1094 > new file mode 100644
1095 > --- /dev/null
1095 > --- /dev/null
1096 > +++ b/a
1096 > +++ b/a
1097 > @@ -0,0 +1,1 @@
1097 > @@ -0,0 +1,1 @@
1098 > +a
1098 > +a
1099 > EOF
1099 > EOF
1100 > hg import -d '0 0' a.patch
1100 > hg import -d '0 0' a.patch
1101 > hg parents -v
1101 > hg parents -v
1102 > cd ..
1102 > cd ..
1103 >
1103 >
1104 > echo '% tricky header splitting'
1104 > echo '% tricky header splitting'
1105 > cat > trickyheaders.patch <<EOF
1105 > cat > trickyheaders.patch <<EOF
1106 > From: User A <user@a>
1106 > From: User A <user@a>
1107 > Subject: [PATCH] from: tricky!
1107 > Subject: [PATCH] from: tricky!
1108 >
1108 >
1109 > # HG changeset patch
1109 > # HG changeset patch
1110 > # User User B
1110 > # User User B
1111 > # Date 1266264441 18000
1111 > # Date 1266264441 18000
1112 > # Branch stable
1112 > # Branch stable
1113 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
1113 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
1114 > # Parent 0000000000000000000000000000000000000000
1114 > # Parent 0000000000000000000000000000000000000000
1115 > from: tricky!
1115 > from: tricky!
1116 >
1116 >
1117 > That is not a header.
1117 > That is not a header.
1118 >
1118 >
1119 > diff -r 000000000000 -r f2be6a1170ac foo
1119 > diff -r 000000000000 -r f2be6a1170ac foo
1120 > --- /dev/null
1120 > --- /dev/null
1121 > +++ b/foo
1121 > +++ b/foo
1122 > @@ -0,0 +1,1 @@
1122 > @@ -0,0 +1,1 @@
1123 > +foo
1123 > +foo
1124 > EOF
1124 > EOF
1125 applying a.patch
1125 applying a.patch
1126 changeset: 0:f34d9187897d
1126 changeset: 0:f34d9187897d
1127 tag: tip
1127 tag: tip
1128 user: test
1128 user: test
1129 date: Thu Jan 01 00:00:00 1970 +0000
1129 date: Thu Jan 01 00:00:00 1970 +0000
1130 files: a
1130 files: a
1131 description:
1131 description:
1132 module: summary
1132 module: summary
1133
1133
1134
1134
1135 % tricky header splitting
1135 % tricky header splitting
1136
1136
1137 $ hg init trickyheaders
1137 $ hg init trickyheaders
1138 $ cd trickyheaders
1138 $ cd trickyheaders
1139 $ hg import -d '0 0' ../trickyheaders.patch
1139 $ hg import -d '0 0' ../trickyheaders.patch
1140 applying ../trickyheaders.patch
1140 applying ../trickyheaders.patch
1141 $ hg export --git tip
1141 $ hg export --git tip
1142 # HG changeset patch
1142 # HG changeset patch
1143 # User User B
1143 # User User B
1144 # Date 0 0
1144 # Date 0 0
1145 # Thu Jan 01 00:00:00 1970 +0000
1145 # Thu Jan 01 00:00:00 1970 +0000
1146 # Node ID eb56ab91903632294ac504838508cb370c0901d2
1146 # Node ID eb56ab91903632294ac504838508cb370c0901d2
1147 # Parent 0000000000000000000000000000000000000000
1147 # Parent 0000000000000000000000000000000000000000
1148 from: tricky!
1148 from: tricky!
1149
1149
1150 That is not a header.
1150 That is not a header.
1151
1151
1152 diff --git a/foo b/foo
1152 diff --git a/foo b/foo
1153 new file mode 100644
1153 new file mode 100644
1154 --- /dev/null
1154 --- /dev/null
1155 +++ b/foo
1155 +++ b/foo
1156 @@ -0,0 +1,1 @@
1156 @@ -0,0 +1,1 @@
1157 +foo
1157 +foo
1158 $ cd ..
1158 $ cd ..
1159
1159
1160
1160
1161 Issue2102: hg export and hg import speak different languages
1161 Issue2102: hg export and hg import speak different languages
1162
1162
1163 $ hg init issue2102
1163 $ hg init issue2102
1164 $ cd issue2102
1164 $ cd issue2102
1165 $ mkdir -p src/cmd/gc
1165 $ mkdir -p src/cmd/gc
1166 $ touch src/cmd/gc/mksys.bash
1166 $ touch src/cmd/gc/mksys.bash
1167 $ hg ci -Am init
1167 $ hg ci -Am init
1168 adding src/cmd/gc/mksys.bash
1168 adding src/cmd/gc/mksys.bash
1169 $ hg import - <<EOF
1169 $ hg import - <<EOF
1170 > # HG changeset patch
1170 > # HG changeset patch
1171 > # User Rob Pike
1171 > # User Rob Pike
1172 > # Date 1216685449 25200
1172 > # Date 1216685449 25200
1173 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
1173 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
1174 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
1174 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
1175 > help management of empty pkg and lib directories in perforce
1175 > help management of empty pkg and lib directories in perforce
1176 >
1176 >
1177 > R=gri
1177 > R=gri
1178 > DELTA=4 (4 added, 0 deleted, 0 changed)
1178 > DELTA=4 (4 added, 0 deleted, 0 changed)
1179 > OCL=13328
1179 > OCL=13328
1180 > CL=13328
1180 > CL=13328
1181 >
1181 >
1182 > diff --git a/lib/place-holder b/lib/place-holder
1182 > diff --git a/lib/place-holder b/lib/place-holder
1183 > new file mode 100644
1183 > new file mode 100644
1184 > --- /dev/null
1184 > --- /dev/null
1185 > +++ b/lib/place-holder
1185 > +++ b/lib/place-holder
1186 > @@ -0,0 +1,2 @@
1186 > @@ -0,0 +1,2 @@
1187 > +perforce does not maintain empty directories.
1187 > +perforce does not maintain empty directories.
1188 > +this file helps.
1188 > +this file helps.
1189 > diff --git a/pkg/place-holder b/pkg/place-holder
1189 > diff --git a/pkg/place-holder b/pkg/place-holder
1190 > new file mode 100644
1190 > new file mode 100644
1191 > --- /dev/null
1191 > --- /dev/null
1192 > +++ b/pkg/place-holder
1192 > +++ b/pkg/place-holder
1193 > @@ -0,0 +1,2 @@
1193 > @@ -0,0 +1,2 @@
1194 > +perforce does not maintain empty directories.
1194 > +perforce does not maintain empty directories.
1195 > +this file helps.
1195 > +this file helps.
1196 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1196 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1197 > old mode 100644
1197 > old mode 100644
1198 > new mode 100755
1198 > new mode 100755
1199 > EOF
1199 > EOF
1200 applying patch from stdin
1200 applying patch from stdin
1201
1201
1202 #if execbit
1202 #if execbit
1203
1203
1204 $ hg sum
1204 $ hg sum
1205 parent: 1:d59915696727 tip
1205 parent: 1:d59915696727 tip
1206 help management of empty pkg and lib directories in perforce
1206 help management of empty pkg and lib directories in perforce
1207 branch: default
1207 branch: default
1208 commit: (clean)
1208 commit: (clean)
1209 update: (current)
1209 update: (current)
1210 phases: 2 draft
1210 phases: 2 draft
1211
1211
1212 $ hg diff --git -c tip
1212 $ hg diff --git -c tip
1213 diff --git a/lib/place-holder b/lib/place-holder
1213 diff --git a/lib/place-holder b/lib/place-holder
1214 new file mode 100644
1214 new file mode 100644
1215 --- /dev/null
1215 --- /dev/null
1216 +++ b/lib/place-holder
1216 +++ b/lib/place-holder
1217 @@ -0,0 +1,2 @@
1217 @@ -0,0 +1,2 @@
1218 +perforce does not maintain empty directories.
1218 +perforce does not maintain empty directories.
1219 +this file helps.
1219 +this file helps.
1220 diff --git a/pkg/place-holder b/pkg/place-holder
1220 diff --git a/pkg/place-holder b/pkg/place-holder
1221 new file mode 100644
1221 new file mode 100644
1222 --- /dev/null
1222 --- /dev/null
1223 +++ b/pkg/place-holder
1223 +++ b/pkg/place-holder
1224 @@ -0,0 +1,2 @@
1224 @@ -0,0 +1,2 @@
1225 +perforce does not maintain empty directories.
1225 +perforce does not maintain empty directories.
1226 +this file helps.
1226 +this file helps.
1227 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1227 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
1228 old mode 100644
1228 old mode 100644
1229 new mode 100755
1229 new mode 100755
1230
1230
1231 #else
1231 #else
1232
1232
1233 $ hg sum
1233 $ hg sum
1234 parent: 1:28f089cc9ccc tip
1234 parent: 1:28f089cc9ccc tip
1235 help management of empty pkg and lib directories in perforce
1235 help management of empty pkg and lib directories in perforce
1236 branch: default
1236 branch: default
1237 commit: (clean)
1237 commit: (clean)
1238 update: (current)
1238 update: (current)
1239 phases: 2 draft
1239 phases: 2 draft
1240
1240
1241 $ hg diff --git -c tip
1241 $ hg diff --git -c tip
1242 diff --git a/lib/place-holder b/lib/place-holder
1242 diff --git a/lib/place-holder b/lib/place-holder
1243 new file mode 100644
1243 new file mode 100644
1244 --- /dev/null
1244 --- /dev/null
1245 +++ b/lib/place-holder
1245 +++ b/lib/place-holder
1246 @@ -0,0 +1,2 @@
1246 @@ -0,0 +1,2 @@
1247 +perforce does not maintain empty directories.
1247 +perforce does not maintain empty directories.
1248 +this file helps.
1248 +this file helps.
1249 diff --git a/pkg/place-holder b/pkg/place-holder
1249 diff --git a/pkg/place-holder b/pkg/place-holder
1250 new file mode 100644
1250 new file mode 100644
1251 --- /dev/null
1251 --- /dev/null
1252 +++ b/pkg/place-holder
1252 +++ b/pkg/place-holder
1253 @@ -0,0 +1,2 @@
1253 @@ -0,0 +1,2 @@
1254 +perforce does not maintain empty directories.
1254 +perforce does not maintain empty directories.
1255 +this file helps.
1255 +this file helps.
1256
1256
1257 /* The mode change for mksys.bash is missing here, because on platforms */
1257 /* The mode change for mksys.bash is missing here, because on platforms */
1258 /* that don't support execbits, mode changes in patches are ignored when */
1258 /* that don't support execbits, mode changes in patches are ignored when */
1259 /* they are imported. This is obviously also the reason for why the hash */
1259 /* they are imported. This is obviously also the reason for why the hash */
1260 /* in the created changeset is different to the one you see above the */
1260 /* in the created changeset is different to the one you see above the */
1261 /* #else clause */
1261 /* #else clause */
1262
1262
1263 #endif
1263 #endif
1264 $ cd ..
1264 $ cd ..
1265
1265
1266
1266
1267 diff lines looking like headers
1267 diff lines looking like headers
1268
1268
1269 $ hg init difflineslikeheaders
1269 $ hg init difflineslikeheaders
1270 $ cd difflineslikeheaders
1270 $ cd difflineslikeheaders
1271 $ echo a >a
1271 $ echo a >a
1272 $ echo b >b
1272 $ echo b >b
1273 $ echo c >c
1273 $ echo c >c
1274 $ hg ci -Am1
1274 $ hg ci -Am1
1275 adding a
1275 adding a
1276 adding b
1276 adding b
1277 adding c
1277 adding c
1278
1278
1279 $ echo "key: value" >>a
1279 $ echo "key: value" >>a
1280 $ echo "key: value" >>b
1280 $ echo "key: value" >>b
1281 $ echo "foo" >>c
1281 $ echo "foo" >>c
1282 $ hg ci -m2
1282 $ hg ci -m2
1283
1283
1284 $ hg up -C 0
1284 $ hg up -C 0
1285 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1285 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1286 $ hg diff --git -c1 >want
1286 $ hg diff --git -c1 >want
1287 $ hg diff -c1 | hg import --no-commit -
1287 $ hg diff -c1 | hg import --no-commit -
1288 applying patch from stdin
1288 applying patch from stdin
1289 $ hg diff --git >have
1289 $ hg diff --git >have
1290 $ diff want have
1290 $ diff want have
1291 $ cd ..
1291 $ cd ..
1292
1292
1293 import a unified diff with no lines of context (diff -U0)
1293 import a unified diff with no lines of context (diff -U0)
1294
1294
1295 $ hg init diffzero
1295 $ hg init diffzero
1296 $ cd diffzero
1296 $ cd diffzero
1297 $ cat > f << EOF
1297 $ cat > f << EOF
1298 > c2
1298 > c2
1299 > c4
1299 > c4
1300 > c5
1300 > c5
1301 > EOF
1301 > EOF
1302 $ hg commit -Am0
1302 $ hg commit -Am0
1303 adding f
1303 adding f
1304
1304
1305 $ hg import --no-commit - << EOF
1305 $ hg import --no-commit - << EOF
1306 > # HG changeset patch
1306 > # HG changeset patch
1307 > # User test
1307 > # User test
1308 > # Date 0 0
1308 > # Date 0 0
1309 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
1309 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
1310 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
1310 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
1311 > 1
1311 > 1
1312 > diff -r 8679a12a975b -r f4974ab632f3 f
1312 > diff -r 8679a12a975b -r f4974ab632f3 f
1313 > --- a/f Thu Jan 01 00:00:00 1970 +0000
1313 > --- a/f Thu Jan 01 00:00:00 1970 +0000
1314 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
1314 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
1315 > @@ -0,0 +1,1 @@
1315 > @@ -0,0 +1,1 @@
1316 > +c1
1316 > +c1
1317 > @@ -1,0 +3,1 @@
1317 > @@ -1,0 +3,1 @@
1318 > +c3
1318 > +c3
1319 > @@ -3,1 +4,0 @@
1319 > @@ -3,1 +4,0 @@
1320 > -c5
1320 > -c5
1321 > EOF
1321 > EOF
1322 applying patch from stdin
1322 applying patch from stdin
1323
1323
1324 $ cat f
1324 $ cat f
1325 c1
1325 c1
1326 c2
1326 c2
1327 c3
1327 c3
1328 c4
1328 c4
1329
1329
1330 $ cd ..
1330 $ cd ..
1331
1331
1332 no segfault while importing a unified diff which start line is zero but chunk
1332 no segfault while importing a unified diff which start line is zero but chunk
1333 size is non-zero
1333 size is non-zero
1334
1334
1335 $ hg init startlinezero
1335 $ hg init startlinezero
1336 $ cd startlinezero
1336 $ cd startlinezero
1337 $ echo foo > foo
1337 $ echo foo > foo
1338 $ hg commit -Amfoo
1338 $ hg commit -Amfoo
1339 adding foo
1339 adding foo
1340
1340
1341 $ hg import --no-commit - << EOF
1341 $ hg import --no-commit - << EOF
1342 > diff a/foo b/foo
1342 > diff a/foo b/foo
1343 > --- a/foo
1343 > --- a/foo
1344 > +++ b/foo
1344 > +++ b/foo
1345 > @@ -0,1 +0,1 @@
1345 > @@ -0,1 +0,1 @@
1346 > foo
1346 > foo
1347 > EOF
1347 > EOF
1348 applying patch from stdin
1348 applying patch from stdin
1349
1349
1350 $ cd ..
1350 $ cd ..
1351
1351
1352 Test corner case involving fuzz and skew
1352 Test corner case involving fuzz and skew
1353
1353
1354 $ hg init morecornercases
1354 $ hg init morecornercases
1355 $ cd morecornercases
1355 $ cd morecornercases
1356
1356
1357 $ cat > 01-no-context-beginning-of-file.diff <<EOF
1357 $ cat > 01-no-context-beginning-of-file.diff <<EOF
1358 > diff --git a/a b/a
1358 > diff --git a/a b/a
1359 > --- a/a
1359 > --- a/a
1360 > +++ b/a
1360 > +++ b/a
1361 > @@ -1,0 +1,1 @@
1361 > @@ -1,0 +1,1 @@
1362 > +line
1362 > +line
1363 > EOF
1363 > EOF
1364
1364
1365 $ cat > 02-no-context-middle-of-file.diff <<EOF
1365 $ cat > 02-no-context-middle-of-file.diff <<EOF
1366 > diff --git a/a b/a
1366 > diff --git a/a b/a
1367 > --- a/a
1367 > --- a/a
1368 > +++ b/a
1368 > +++ b/a
1369 > @@ -1,1 +1,1 @@
1369 > @@ -1,1 +1,1 @@
1370 > -2
1370 > -2
1371 > +add some skew
1371 > +add some skew
1372 > @@ -2,0 +2,1 @@
1372 > @@ -2,0 +2,1 @@
1373 > +line
1373 > +line
1374 > EOF
1374 > EOF
1375
1375
1376 $ cat > 03-no-context-end-of-file.diff <<EOF
1376 $ cat > 03-no-context-end-of-file.diff <<EOF
1377 > diff --git a/a b/a
1377 > diff --git a/a b/a
1378 > --- a/a
1378 > --- a/a
1379 > +++ b/a
1379 > +++ b/a
1380 > @@ -10,0 +10,1 @@
1380 > @@ -10,0 +10,1 @@
1381 > +line
1381 > +line
1382 > EOF
1382 > EOF
1383
1383
1384 $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
1384 $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
1385 > diff --git a/a b/a
1385 > diff --git a/a b/a
1386 > --- a/a
1386 > --- a/a
1387 > +++ b/a
1387 > +++ b/a
1388 > @@ -1,1 +1,1 @@
1388 > @@ -1,1 +1,1 @@
1389 > -2
1389 > -2
1390 > +add some skew
1390 > +add some skew
1391 > @@ -2,2 +2,3 @@
1391 > @@ -2,2 +2,3 @@
1392 > not matching, should fuzz
1392 > not matching, should fuzz
1393 > ... a bit
1393 > ... a bit
1394 > +line
1394 > +line
1395 > EOF
1395 > EOF
1396
1396
1397 $ cat > a <<EOF
1397 $ cat > a <<EOF
1398 > 1
1398 > 1
1399 > 2
1399 > 2
1400 > 3
1400 > 3
1401 > 4
1401 > 4
1402 > EOF
1402 > EOF
1403 $ hg ci -Am adda a
1403 $ hg ci -Am adda a
1404 $ for p in *.diff; do
1404 $ for p in *.diff; do
1405 > hg import -v --no-commit $p
1405 > hg import -v --no-commit $p
1406 > cat a
1406 > cat a
1407 > hg revert -aqC a
1407 > hg revert -aqC a
1408 > # patch -p1 < $p
1408 > # patch -p1 < $p
1409 > # cat a
1409 > # cat a
1410 > # hg revert -aC a
1410 > # hg revert -aC a
1411 > done
1411 > done
1412 applying 01-no-context-beginning-of-file.diff
1412 applying 01-no-context-beginning-of-file.diff
1413 patching file a
1413 patching file a
1414 applied to working directory
1414 applied to working directory
1415 1
1415 1
1416 line
1416 line
1417 2
1417 2
1418 3
1418 3
1419 4
1419 4
1420 applying 02-no-context-middle-of-file.diff
1420 applying 02-no-context-middle-of-file.diff
1421 patching file a
1421 patching file a
1422 Hunk #1 succeeded at 2 (offset 1 lines).
1422 Hunk #1 succeeded at 2 (offset 1 lines).
1423 Hunk #2 succeeded at 4 (offset 1 lines).
1423 Hunk #2 succeeded at 4 (offset 1 lines).
1424 applied to working directory
1424 applied to working directory
1425 1
1425 1
1426 add some skew
1426 add some skew
1427 3
1427 3
1428 line
1428 line
1429 4
1429 4
1430 applying 03-no-context-end-of-file.diff
1430 applying 03-no-context-end-of-file.diff
1431 patching file a
1431 patching file a
1432 Hunk #1 succeeded at 5 (offset -6 lines).
1432 Hunk #1 succeeded at 5 (offset -6 lines).
1433 applied to working directory
1433 applied to working directory
1434 1
1434 1
1435 2
1435 2
1436 3
1436 3
1437 4
1437 4
1438 line
1438 line
1439 applying 04-middle-of-file-completely-fuzzed.diff
1439 applying 04-middle-of-file-completely-fuzzed.diff
1440 patching file a
1440 patching file a
1441 Hunk #1 succeeded at 2 (offset 1 lines).
1441 Hunk #1 succeeded at 2 (offset 1 lines).
1442 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
1442 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
1443 applied to working directory
1443 applied to working directory
1444 1
1444 1
1445 add some skew
1445 add some skew
1446 3
1446 3
1447 4
1447 4
1448 line
1448 line
1449 $ cd ..
1449 $ cd ..
1450
1450
1451 Test partial application
1451 Test partial application
1452 ------------------------
1452 ------------------------
1453
1453
1454 prepare a stack of patches depending on each other
1454 prepare a stack of patches depending on each other
1455
1455
1456 $ hg init partial
1456 $ hg init partial
1457 $ cd partial
1457 $ cd partial
1458 $ cat << EOF > a
1458 $ cat << EOF > a
1459 > one
1459 > one
1460 > two
1460 > two
1461 > three
1461 > three
1462 > four
1462 > four
1463 > five
1463 > five
1464 > six
1464 > six
1465 > seven
1465 > seven
1466 > EOF
1466 > EOF
1467 $ hg add a
1467 $ hg add a
1468 $ echo 'b' > b
1468 $ echo 'b' > b
1469 $ hg add b
1469 $ hg add b
1470 $ hg commit -m 'initial' -u Babar
1470 $ hg commit -m 'initial' -u Babar
1471 $ cat << EOF > a
1471 $ cat << EOF > a
1472 > one
1472 > one
1473 > two
1473 > two
1474 > 3
1474 > 3
1475 > four
1475 > four
1476 > five
1476 > five
1477 > six
1477 > six
1478 > seven
1478 > seven
1479 > EOF
1479 > EOF
1480 $ hg commit -m 'three' -u Celeste
1480 $ hg commit -m 'three' -u Celeste
1481 $ cat << EOF > a
1481 $ cat << EOF > a
1482 > one
1482 > one
1483 > two
1483 > two
1484 > 3
1484 > 3
1485 > 4
1485 > 4
1486 > five
1486 > five
1487 > six
1487 > six
1488 > seven
1488 > seven
1489 > EOF
1489 > EOF
1490 $ hg commit -m 'four' -u Rataxes
1490 $ hg commit -m 'four' -u Rataxes
1491 $ cat << EOF > a
1491 $ cat << EOF > a
1492 > one
1492 > one
1493 > two
1493 > two
1494 > 3
1494 > 3
1495 > 4
1495 > 4
1496 > 5
1496 > 5
1497 > six
1497 > six
1498 > seven
1498 > seven
1499 > EOF
1499 > EOF
1500 $ echo bb >> b
1500 $ echo bb >> b
1501 $ hg commit -m 'five' -u Arthur
1501 $ hg commit -m 'five' -u Arthur
1502 $ echo 'Babar' > jungle
1502 $ echo 'Babar' > jungle
1503 $ hg add jungle
1503 $ hg add jungle
1504 $ hg ci -m 'jungle' -u Zephir
1504 $ hg ci -m 'jungle' -u Zephir
1505 $ echo 'Celeste' >> jungle
1505 $ echo 'Celeste' >> jungle
1506 $ hg ci -m 'extended jungle' -u Cornelius
1506 $ hg ci -m 'extended jungle' -u Cornelius
1507 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1507 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1508 @ extended jungle [Cornelius] 1: +1/-0
1508 @ extended jungle [Cornelius] 1: +1/-0
1509 |
1509 |
1510 o jungle [Zephir] 1: +1/-0
1510 o jungle [Zephir] 1: +1/-0
1511 |
1511 |
1512 o five [Arthur] 2: +2/-1
1512 o five [Arthur] 2: +2/-1
1513 |
1513 |
1514 o four [Rataxes] 1: +1/-1
1514 o four [Rataxes] 1: +1/-1
1515 |
1515 |
1516 o three [Celeste] 1: +1/-1
1516 o three [Celeste] 1: +1/-1
1517 |
1517 |
1518 o initial [Babar] 2: +8/-0
1518 o initial [Babar] 2: +8/-0
1519
1519
1520 Adding those config options should not change the output of diffstat. Bugfix #4755.
1520 Adding those config options should not change the output of diffstat. Bugfix #4755.
1521
1521
1522 $ hg log -r . --template '{diffstat}\n'
1522 $ hg log -r . --template '{diffstat}\n'
1523 1: +1/-0
1523 1: +1/-0
1524 $ hg log -r . --template '{diffstat}\n' --config diff.git=1 \
1524 $ hg log -r . --template '{diffstat}\n' --config diff.git=1 \
1525 > --config diff.noprefix=1
1525 > --config diff.noprefix=1
1526 1: +1/-0
1526 1: +1/-0
1527
1527
1528 Importing with some success and some errors:
1528 Importing with some success and some errors:
1529
1529
1530 $ hg update --rev 'desc(initial)'
1530 $ hg update --rev 'desc(initial)'
1531 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1531 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1532 $ hg export --rev 'desc(five)' | hg import --partial -
1532 $ hg export --rev 'desc(five)' | hg import --partial -
1533 applying patch from stdin
1533 applying patch from stdin
1534 patching file a
1534 patching file a
1535 Hunk #1 FAILED at 1
1535 Hunk #1 FAILED at 1
1536 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1536 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1537 patch applied partially
1537 patch applied partially
1538 (fix the .rej files and run `hg commit --amend`)
1538 (fix the .rej files and run `hg commit --amend`)
1539 [1]
1539 [1]
1540
1540
1541 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1541 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1542 @ five [Arthur] 1: +1/-0
1542 @ five [Arthur] 1: +1/-0
1543 |
1543 |
1544 | o extended jungle [Cornelius] 1: +1/-0
1544 | o extended jungle [Cornelius] 1: +1/-0
1545 | |
1545 | |
1546 | o jungle [Zephir] 1: +1/-0
1546 | o jungle [Zephir] 1: +1/-0
1547 | |
1547 | |
1548 | o five [Arthur] 2: +2/-1
1548 | o five [Arthur] 2: +2/-1
1549 | |
1549 | |
1550 | o four [Rataxes] 1: +1/-1
1550 | o four [Rataxes] 1: +1/-1
1551 | |
1551 | |
1552 | o three [Celeste] 1: +1/-1
1552 | o three [Celeste] 1: +1/-1
1553 |/
1553 |/
1554 o initial [Babar] 2: +8/-0
1554 o initial [Babar] 2: +8/-0
1555
1555
1556 $ hg export
1556 $ hg export
1557 # HG changeset patch
1557 # HG changeset patch
1558 # User Arthur
1558 # User Arthur
1559 # Date 0 0
1559 # Date 0 0
1560 # Thu Jan 01 00:00:00 1970 +0000
1560 # Thu Jan 01 00:00:00 1970 +0000
1561 # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
1561 # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
1562 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1562 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1563 five
1563 five
1564
1564
1565 diff -r 8e4f0351909e -r 26e6446bb252 b
1565 diff -r 8e4f0351909e -r 26e6446bb252 b
1566 --- a/b Thu Jan 01 00:00:00 1970 +0000
1566 --- a/b Thu Jan 01 00:00:00 1970 +0000
1567 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1567 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1568 @@ -1,1 +1,2 @@
1568 @@ -1,1 +1,2 @@
1569 b
1569 b
1570 +bb
1570 +bb
1571 $ hg status -c .
1571 $ hg status -c .
1572 C a
1572 C a
1573 C b
1573 C b
1574 $ ls
1574 $ ls
1575 a
1575 a
1576 a.rej
1576 a.rej
1577 b
1577 b
1578
1578
1579 Importing with zero success:
1579 Importing with zero success:
1580
1580
1581 $ hg update --rev 'desc(initial)'
1581 $ hg update --rev 'desc(initial)'
1582 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1582 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1583 $ hg export --rev 'desc(four)' | hg import --partial -
1583 $ hg export --rev 'desc(four)' | hg import --partial -
1584 applying patch from stdin
1584 applying patch from stdin
1585 patching file a
1585 patching file a
1586 Hunk #1 FAILED at 0
1586 Hunk #1 FAILED at 0
1587 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1587 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1588 patch applied partially
1588 patch applied partially
1589 (fix the .rej files and run `hg commit --amend`)
1589 (fix the .rej files and run `hg commit --amend`)
1590 [1]
1590 [1]
1591
1591
1592 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1592 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1593 @ four [Rataxes] 0: +0/-0
1593 @ four [Rataxes] 0: +0/-0
1594 |
1594 |
1595 | o five [Arthur] 1: +1/-0
1595 | o five [Arthur] 1: +1/-0
1596 |/
1596 |/
1597 | o extended jungle [Cornelius] 1: +1/-0
1597 | o extended jungle [Cornelius] 1: +1/-0
1598 | |
1598 | |
1599 | o jungle [Zephir] 1: +1/-0
1599 | o jungle [Zephir] 1: +1/-0
1600 | |
1600 | |
1601 | o five [Arthur] 2: +2/-1
1601 | o five [Arthur] 2: +2/-1
1602 | |
1602 | |
1603 | o four [Rataxes] 1: +1/-1
1603 | o four [Rataxes] 1: +1/-1
1604 | |
1604 | |
1605 | o three [Celeste] 1: +1/-1
1605 | o three [Celeste] 1: +1/-1
1606 |/
1606 |/
1607 o initial [Babar] 2: +8/-0
1607 o initial [Babar] 2: +8/-0
1608
1608
1609 $ hg export
1609 $ hg export
1610 # HG changeset patch
1610 # HG changeset patch
1611 # User Rataxes
1611 # User Rataxes
1612 # Date 0 0
1612 # Date 0 0
1613 # Thu Jan 01 00:00:00 1970 +0000
1613 # Thu Jan 01 00:00:00 1970 +0000
1614 # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
1614 # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
1615 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1615 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1616 four
1616 four
1617
1617
1618 $ hg status -c .
1618 $ hg status -c .
1619 C a
1619 C a
1620 C b
1620 C b
1621 $ ls
1621 $ ls
1622 a
1622 a
1623 a.rej
1623 a.rej
1624 b
1624 b
1625
1625
1626 Importing with unknown file:
1626 Importing with unknown file:
1627
1627
1628 $ hg update --rev 'desc(initial)'
1628 $ hg update --rev 'desc(initial)'
1629 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1629 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1630 $ hg export --rev 'desc("extended jungle")' | hg import --partial -
1630 $ hg export --rev 'desc("extended jungle")' | hg import --partial -
1631 applying patch from stdin
1631 applying patch from stdin
1632 unable to find 'jungle' for patching
1632 unable to find 'jungle' for patching
1633 (use '--prefix' to apply patch relative to the current directory)
1633 (use '--prefix' to apply patch relative to the current directory)
1634 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
1634 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
1635 patch applied partially
1635 patch applied partially
1636 (fix the .rej files and run `hg commit --amend`)
1636 (fix the .rej files and run `hg commit --amend`)
1637 [1]
1637 [1]
1638
1638
1639 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1639 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1640 @ extended jungle [Cornelius] 0: +0/-0
1640 @ extended jungle [Cornelius] 0: +0/-0
1641 |
1641 |
1642 | o four [Rataxes] 0: +0/-0
1642 | o four [Rataxes] 0: +0/-0
1643 |/
1643 |/
1644 | o five [Arthur] 1: +1/-0
1644 | o five [Arthur] 1: +1/-0
1645 |/
1645 |/
1646 | o extended jungle [Cornelius] 1: +1/-0
1646 | o extended jungle [Cornelius] 1: +1/-0
1647 | |
1647 | |
1648 | o jungle [Zephir] 1: +1/-0
1648 | o jungle [Zephir] 1: +1/-0
1649 | |
1649 | |
1650 | o five [Arthur] 2: +2/-1
1650 | o five [Arthur] 2: +2/-1
1651 | |
1651 | |
1652 | o four [Rataxes] 1: +1/-1
1652 | o four [Rataxes] 1: +1/-1
1653 | |
1653 | |
1654 | o three [Celeste] 1: +1/-1
1654 | o three [Celeste] 1: +1/-1
1655 |/
1655 |/
1656 o initial [Babar] 2: +8/-0
1656 o initial [Babar] 2: +8/-0
1657
1657
1658 $ hg export
1658 $ hg export
1659 # HG changeset patch
1659 # HG changeset patch
1660 # User Cornelius
1660 # User Cornelius
1661 # Date 0 0
1661 # Date 0 0
1662 # Thu Jan 01 00:00:00 1970 +0000
1662 # Thu Jan 01 00:00:00 1970 +0000
1663 # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
1663 # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
1664 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1664 # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
1665 extended jungle
1665 extended jungle
1666
1666
1667 $ hg status -c .
1667 $ hg status -c .
1668 C a
1668 C a
1669 C b
1669 C b
1670 $ ls
1670 $ ls
1671 a
1671 a
1672 a.rej
1672 a.rej
1673 b
1673 b
1674 jungle.rej
1674 jungle.rej
1675
1675
1676 Importing multiple failing patches:
1676 Importing multiple failing patches:
1677
1677
1678 $ hg update --rev 'desc(initial)'
1678 $ hg update --rev 'desc(initial)'
1679 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1679 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1680 $ echo 'B' > b # just to make another commit
1680 $ echo 'B' > b # just to make another commit
1681 $ hg commit -m "a new base"
1681 $ hg commit -m "a new base"
1682 created new head
1682 created new head
1683 $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial -
1683 $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial -
1684 applying patch from stdin
1684 applying patch from stdin
1685 patching file a
1685 patching file a
1686 Hunk #1 FAILED at 0
1686 Hunk #1 FAILED at 0
1687 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1687 1 out of 1 hunks FAILED -- saving rejects to file a.rej
1688 patch applied partially
1688 patch applied partially
1689 (fix the .rej files and run `hg commit --amend`)
1689 (fix the .rej files and run `hg commit --amend`)
1690 [1]
1690 [1]
1691 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1691 $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
1692 @ four [Rataxes] 0: +0/-0
1692 @ four [Rataxes] 0: +0/-0
1693 |
1693 |
1694 o a new base [test] 1: +1/-1
1694 o a new base [test] 1: +1/-1
1695 |
1695 |
1696 | o extended jungle [Cornelius] 0: +0/-0
1696 | o extended jungle [Cornelius] 0: +0/-0
1697 |/
1697 |/
1698 | o four [Rataxes] 0: +0/-0
1698 | o four [Rataxes] 0: +0/-0
1699 |/
1699 |/
1700 | o five [Arthur] 1: +1/-0
1700 | o five [Arthur] 1: +1/-0
1701 |/
1701 |/
1702 | o extended jungle [Cornelius] 1: +1/-0
1702 | o extended jungle [Cornelius] 1: +1/-0
1703 | |
1703 | |
1704 | o jungle [Zephir] 1: +1/-0
1704 | o jungle [Zephir] 1: +1/-0
1705 | |
1705 | |
1706 | o five [Arthur] 2: +2/-1
1706 | o five [Arthur] 2: +2/-1
1707 | |
1707 | |
1708 | o four [Rataxes] 1: +1/-1
1708 | o four [Rataxes] 1: +1/-1
1709 | |
1709 | |
1710 | o three [Celeste] 1: +1/-1
1710 | o three [Celeste] 1: +1/-1
1711 |/
1711 |/
1712 o initial [Babar] 2: +8/-0
1712 o initial [Babar] 2: +8/-0
1713
1713
1714 $ hg export
1714 $ hg export
1715 # HG changeset patch
1715 # HG changeset patch
1716 # User Rataxes
1716 # User Rataxes
1717 # Date 0 0
1717 # Date 0 0
1718 # Thu Jan 01 00:00:00 1970 +0000
1718 # Thu Jan 01 00:00:00 1970 +0000
1719 # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
1719 # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
1720 # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
1720 # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
1721 four
1721 four
1722
1722
1723 $ hg status -c .
1723 $ hg status -c .
1724 C a
1724 C a
1725 C b
1725 C b
1726
1726
1727 Importing some extra header
1727 Importing some extra header
1728 ===========================
1728 ===========================
1729
1729
1730 $ cat > $TESTTMP/parseextra.py <<EOF
1730 $ cat > $TESTTMP/parseextra.py <<EOF
1731 > import mercurial.patch
1731 > import mercurial.patch
1732 > import mercurial.cmdutil
1732 > import mercurial.cmdutil
1733 >
1733 >
1734 > def processfoo(repo, data, extra, opts):
1734 > def processfoo(repo, data, extra, opts):
1735 > if 'foo' in data:
1735 > if 'foo' in data:
1736 > extra['foo'] = data['foo']
1736 > extra['foo'] = data['foo']
1737 > def postimport(ctx):
1737 > def postimport(ctx):
1738 > if 'foo' in ctx.extra():
1738 > if 'foo' in ctx.extra():
1739 > ctx.repo().ui.write('imported-foo: %s\n' % ctx.extra()['foo'])
1739 > ctx.repo().ui.write('imported-foo: %s\n' % ctx.extra()['foo'])
1740 >
1740 >
1741 > mercurial.patch.patchheadermap.append(('Foo', 'foo'))
1741 > mercurial.patch.patchheadermap.append(('Foo', 'foo'))
1742 > mercurial.cmdutil.extrapreimport.append('foo')
1742 > mercurial.cmdutil.extrapreimport.append('foo')
1743 > mercurial.cmdutil.extrapreimportmap['foo'] = processfoo
1743 > mercurial.cmdutil.extrapreimportmap['foo'] = processfoo
1744 > mercurial.cmdutil.extrapostimport.append('foo')
1744 > mercurial.cmdutil.extrapostimport.append('foo')
1745 > mercurial.cmdutil.extrapostimportmap['foo'] = postimport
1745 > mercurial.cmdutil.extrapostimportmap['foo'] = postimport
1746 > EOF
1746 > EOF
1747 $ cat >> $HGRCPATH <<EOF
1747 $ cat >> $HGRCPATH <<EOF
1748 > [extensions]
1748 > [extensions]
1749 > parseextra=$TESTTMP/parseextra.py
1749 > parseextra=$TESTTMP/parseextra.py
1750 > EOF
1750 > EOF
1751 $ hg up -C tip
1751 $ hg up -C tip
1752 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1752 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1753 $ cat > $TESTTMP/foo.patch <<EOF
1753 $ cat > $TESTTMP/foo.patch <<EOF
1754 > # HG changeset patch
1754 > # HG changeset patch
1755 > # User Rataxes
1755 > # User Rataxes
1756 > # Date 0 0
1756 > # Date 0 0
1757 > # Thu Jan 01 00:00:00 1970 +0000
1757 > # Thu Jan 01 00:00:00 1970 +0000
1758 > # Foo bar
1758 > # Foo bar
1759 > height
1759 > height
1760 >
1760 >
1761 > --- a/a Thu Jan 01 00:00:00 1970 +0000
1761 > --- a/a Thu Jan 01 00:00:00 1970 +0000
1762 > +++ b/a Wed Oct 07 09:17:44 2015 +0000
1762 > +++ b/a Wed Oct 07 09:17:44 2015 +0000
1763 > @@ -5,3 +5,4 @@
1763 > @@ -5,3 +5,4 @@
1764 > five
1764 > five
1765 > six
1765 > six
1766 > seven
1766 > seven
1767 > +heigt
1767 > +heigt
1768 > EOF
1768 > EOF
1769 $ hg import $TESTTMP/foo.patch
1769 $ hg import $TESTTMP/foo.patch
1770 applying $TESTTMP/foo.patch
1770 applying $TESTTMP/foo.patch
1771 imported-foo: bar
1771 imported-foo: bar
1772 $ hg log --debug -r . | grep extra
1772 $ hg log --debug -r . | grep extra
1773 extra: branch=default
1773 extra: branch=default
1774 extra: foo=bar
1774 extra: foo=bar
1775
1775
1776 Warn the user that paths are relative to the root of
1776 Warn the user that paths are relative to the root of
1777 repository when file not found for patching
1777 repository when file not found for patching
1778
1778
1779 $ mkdir filedir
1779 $ mkdir filedir
1780 $ echo "file1" >> filedir/file1
1780 $ echo "file1" >> filedir/file1
1781 $ hg add filedir/file1
1781 $ hg add filedir/file1
1782 $ hg commit -m "file1"
1782 $ hg commit -m "file1"
1783 $ cd filedir
1783 $ cd filedir
1784 $ hg import -p 2 - <<EOF
1784 $ hg import -p 2 - <<EOF
1785 > # HG changeset patch
1785 > # HG changeset patch
1786 > # User test
1786 > # User test
1787 > # Date 0 0
1787 > # Date 0 0
1788 > file2
1788 > file2
1789 >
1789 >
1790 > diff --git a/filedir/file1 b/filedir/file1
1790 > diff --git a/filedir/file1 b/filedir/file1
1791 > --- a/filedir/file1
1791 > --- a/filedir/file1
1792 > +++ b/filedir/file1
1792 > +++ b/filedir/file1
1793 > @@ -1,1 +1,2 @@
1793 > @@ -1,1 +1,2 @@
1794 > file1
1794 > file1
1795 > +file2
1795 > +file2
1796 > EOF
1796 > EOF
1797 applying patch from stdin
1797 applying patch from stdin
1798 unable to find 'file1' for patching
1798 unable to find 'file1' for patching
1799 (use '--prefix' to apply patch relative to the current directory)
1799 (use '--prefix' to apply patch relative to the current directory)
1800 1 out of 1 hunks FAILED -- saving rejects to file file1.rej
1800 1 out of 1 hunks FAILED -- saving rejects to file file1.rej
1801 abort: patch failed to apply
1801 abort: patch failed to apply
1802 [255]
1802 [255]
1803
1803
1804 test import crash (issue5375)
1804 test import crash (issue5375)
1805 $ cd ..
1805 $ cd ..
1806 $ hg init repo
1806 $ hg init repo
1807 $ cd repo
1807 $ cd repo
1808 $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import -
1808 $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import -
1809 applying patch from stdin
1809 applying patch from stdin
1810 a not tracked!
1810 a not tracked!
1811 abort: source file 'a' does not exist
1811 abort: source file 'a' does not exist
1812 [255]
1812 [255]
General Comments 0
You need to be logged in to leave comments. Login now