Debian Codegraph @

tests/test-qrecord.t

raw
1 Create configuration
2
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
5
6 help record (no record)
7
8 $ hg help record
9 record extension - commands to interactively select changes for
10 commit/qrefresh (DEPRECATED)
11
12 The feature provided by this extension has been moved into core Mercurial as
13 'hg commit --interactive'.
14
15 (use 'hg help extensions' for information on enabling extensions)
16
17 help qrecord (no record)
18
19 $ hg help qrecord
20 'qrecord' is provided by the following extension:
21
22 record commands to interactively select changes for commit/qrefresh
23 (DEPRECATED)
24
25 (use 'hg help extensions' for information on enabling extensions)
26
27 $ echo "[extensions]" >> $HGRCPATH
28 $ echo "record=" >> $HGRCPATH
29
30 help record (record)
31
32 $ hg help record
33 hg record [OPTION]... [FILE]...
34
35 interactively select changes to commit
36
37 If a list of files is omitted, all changes reported by 'hg status' will be
38 candidates for recording.
39
40 See 'hg help dates' for a list of formats valid for -d/--date.
41
42 If using the text interface (see 'hg help config'), you will be prompted for
43 whether to record changes to each modified file, and for files with multiple
44 changes, for each change to use. For each query, the following responses are
45 possible:
46
47 y - record this change
48 n - skip this change
49 e - edit this change manually
50
51 s - skip remaining changes to this file
52 f - record remaining changes to this file
53
54 d - done, skip remaining changes and files
55 a - record all changes to all remaining files
56 q - quit, recording no changes
57
58 ? - display help
59
60 This command is not available when committing a merge.
61
62 (use 'hg help -e record' to show help for the record extension)
63
64 options ([+] can be repeated):
65
66 -A --addremove mark new/missing files as added/removed before
67 committing
68 --close-branch mark a branch head as closed
69 --amend amend the parent of the working directory
70 -s --secret use the secret phase for committing
71 --draft use the draft phase for committing
72 -e --edit invoke editor on commit messages
73 -I --include PATTERN [+] include names matching the given patterns
74 -X --exclude PATTERN [+] exclude names matching the given patterns
75 -m --message TEXT use text as commit message
76 -l --logfile FILE read commit message from file
77 -d --date DATE record the specified date as commit date
78 -u --user USER record the specified user as committer
79 -S --subrepos recurse into subrepositories
80 -w --ignore-all-space ignore white space when comparing lines
81 -b --ignore-space-change ignore changes in the amount of white space
82 -B --ignore-blank-lines ignore changes whose lines are all blank
83 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
84
85 (some details hidden, use --verbose to show complete help)
86
87 help (no mq, so no qrecord)
88
89 $ hg help qrecord
90 hg qrecord [OPTION]... PATCH [FILE]...
91
92 interactively record a new patch
93
94 See 'hg help qnew' & 'hg help record' for more information and usage.
95
96 (some details hidden, use --verbose to show complete help)
97
98 $ hg init a
99
100 qrecord (mq not present)
101
102 $ hg -R a qrecord
103 hg qrecord: invalid arguments
104 hg qrecord [OPTION]... PATCH [FILE]...
105
106 interactively record a new patch
107
108 (use 'hg qrecord -h' to show more help)
109 [10]
110
111 qrecord patch (mq not present)
112
113 $ hg -R a qrecord patch
114 abort: 'mq' extension not loaded
115 [255]
116
117 help (bad mq)
118
119 $ echo "mq=nonexistent" >> $HGRCPATH
120 $ hg help qrecord
121 *** failed to import extension "mq" from nonexistent: [Errno *] * (glob)
122 hg qrecord [OPTION]... PATCH [FILE]...
123
124 interactively record a new patch
125
126 See 'hg help qnew' & 'hg help record' for more information and usage.
127
128 (some details hidden, use --verbose to show complete help)
129
130 help (mq present)
131
132 $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp
133 $ mv hgrc.tmp $HGRCPATH
134
135 $ hg help qrecord
136 hg qrecord [OPTION]... PATCH [FILE]...
137
138 interactively record a new patch
139
140 See 'hg help qnew' & 'hg help record' for more information and usage.
141
142 options ([+] can be repeated):
143
144 -e --edit invoke editor on commit messages
145 -g --git use git extended diff format
146 -U --currentuser add "From: <current user>" to patch
147 -u --user USER add "From: <USER>" to patch
148 -D --currentdate add "Date: <current date>" to patch
149 -d --date DATE add "Date: <DATE>" to patch
150 -I --include PATTERN [+] include names matching the given patterns
151 -X --exclude PATTERN [+] exclude names matching the given patterns
152 -m --message TEXT use text as commit message
153 -l --logfile FILE read commit message from file
154 -w --ignore-all-space ignore white space when comparing lines
155 -b --ignore-space-change ignore changes in the amount of white space
156 -B --ignore-blank-lines ignore changes whose lines are all blank
157 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
158 --mq operate on patch repository
159
160 (some details hidden, use --verbose to show complete help)
161
162 $ cd a
163
164 Base commit
165
166 $ cat > 1.txt <<EOF
167 > 1
168 > 2
169 > 3
170 > 4
171 > 5
172 > EOF
173 $ cat > 2.txt <<EOF
174 > a
175 > b
176 > c
177 > d
178 > e
179 > f
180 > EOF
181
182 $ mkdir dir
183 $ cat > dir/a.txt <<EOF
184 > hello world
185 >
186 > someone
187 > up
188 > there
189 > loves
190 > me
191 > EOF
192
193 $ hg add 1.txt 2.txt dir/a.txt
194 $ hg commit -m 'initial checkin'
195
196 Changing files
197
198 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
199 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
200 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
201
202 $ mv -f 1.txt.new 1.txt
203 $ mv -f 2.txt.new 2.txt
204 $ mv -f dir/a.txt.new dir/a.txt
205
206 Whole diff
207
208 $ hg diff --nodates
209 diff -r 1057167b20ef 1.txt
210 --- a/1.txt
211 +++ b/1.txt
212 @@ -1,5 +1,5 @@
213 1
214 -2
215 +2 2
216 3
217 -4
218 +4 4
219 5
220 diff -r 1057167b20ef 2.txt
221 --- a/2.txt
222 +++ b/2.txt
223 @@ -1,5 +1,5 @@
224 a
225 -b
226 +b b
227 c
228 d
229 e
230 diff -r 1057167b20ef dir/a.txt
231 --- a/dir/a.txt
232 +++ b/dir/a.txt
233 @@ -1,4 +1,4 @@
234 -hello world
235 +hello world!
236
237 someone
238 up
239
240 qrecord with bad patch name, should abort before prompting
241
242 $ hg qrecord .hg
243 abort: patch name cannot begin with ".hg"
244 [255]
245 $ hg qrecord ' foo'
246 abort: patch name cannot begin or end with whitespace
247 [255]
248 $ hg qrecord 'foo '
249 abort: patch name cannot begin or end with whitespace
250 [255]
251
252 qrecord a.patch
253
254 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
255 > y
256 > y
257 > n
258 > y
259 > y
260 > n
261 > EOF
262 diff --git a/1.txt b/1.txt
263 2 hunks, 2 lines changed
264 examine changes to '1.txt'?
265 (enter ? for help) [Ynesfdaq?] y
266
267 @@ -1,3 +1,3 @@
268 1
269 -2
270 +2 2
271 3
272 record change 1/4 to '1.txt'?
273 (enter ? for help) [Ynesfdaq?] y
274
275 @@ -3,3 +3,3 @@
276 3
277 -4
278 +4 4
279 5
280 record change 2/4 to '1.txt'?
281 (enter ? for help) [Ynesfdaq?] n
282
283 diff --git a/2.txt b/2.txt
284 1 hunks, 1 lines changed
285 examine changes to '2.txt'?
286 (enter ? for help) [Ynesfdaq?] y
287
288 @@ -1,5 +1,5 @@
289 a
290 -b
291 +b b
292 c
293 d
294 e
295 record change 3/4 to '2.txt'?
296 (enter ? for help) [Ynesfdaq?] y
297
298 diff --git a/dir/a.txt b/dir/a.txt
299 1 hunks, 1 lines changed
300 examine changes to 'dir/a.txt'?
301 (enter ? for help) [Ynesfdaq?] n
302
303
304 After qrecord a.patch 'tip'"
305
306 $ hg tip -p
307 changeset: 1:5d1ca63427ee
308 tag: a.patch
309 tag: qbase
310 tag: qtip
311 tag: tip
312 user: test
313 date: Thu Jan 01 00:00:00 1970 +0000
314 summary: aaa
315
316 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
317 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
318 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
319 @@ -1,5 +1,5 @@
320 1
321 -2
322 +2 2
323 3
324 4
325 5
326 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
327 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
328 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
329 @@ -1,5 +1,5 @@
330 a
331 -b
332 +b b
333 c
334 d
335 e
336
337
338 After qrecord a.patch 'diff'"
339
340 $ hg diff --nodates
341 diff -r 5d1ca63427ee 1.txt
342 --- a/1.txt
343 +++ b/1.txt
344 @@ -1,5 +1,5 @@
345 1
346 2 2
347 3
348 -4
349 +4 4
350 5
351 diff -r 5d1ca63427ee dir/a.txt
352 --- a/dir/a.txt
353 +++ b/dir/a.txt
354 @@ -1,4 +1,4 @@
355 -hello world
356 +hello world!
357
358 someone
359 up
360
361 qrecord b.patch
362
363 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
364 > y
365 > y
366 > y
367 > y
368 > EOF
369 diff --git a/1.txt b/1.txt
370 1 hunks, 1 lines changed
371 examine changes to '1.txt'?
372 (enter ? for help) [Ynesfdaq?] y
373
374 @@ -1,5 +1,5 @@
375 1
376 2 2
377 3
378 -4
379 +4 4
380 5
381 record change 1/2 to '1.txt'?
382 (enter ? for help) [Ynesfdaq?] y
383
384 diff --git a/dir/a.txt b/dir/a.txt
385 1 hunks, 1 lines changed
386 examine changes to 'dir/a.txt'?
387 (enter ? for help) [Ynesfdaq?] y
388
389 @@ -1,4 +1,4 @@
390 -hello world
391 +hello world!
392
393 someone
394 up
395 record change 2/2 to 'dir/a.txt'?
396 (enter ? for help) [Ynesfdaq?] y
397
398
399 After qrecord b.patch 'tip'
400
401 $ hg tip -p
402 changeset: 2:b056198bf878
403 tag: b.patch
404 tag: qtip
405 tag: tip
406 user: test
407 date: Thu Jan 01 00:00:00 1970 +0000
408 summary: bbb
409
410 diff -r 5d1ca63427ee -r b056198bf878 1.txt
411 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
412 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
413 @@ -1,5 +1,5 @@
414 1
415 2 2
416 3
417 -4
418 +4 4
419 5
420 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
421 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
422 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
423 @@ -1,4 +1,4 @@
424 -hello world
425 +hello world!
426
427 someone
428 up
429
430
431 After qrecord b.patch 'diff'
432
433 $ hg diff --nodates
434
435 $ cd ..
436
437 qrecord should throw an error when histedit in process
438
439 $ hg init issue5981
440 $ cd issue5981
441 $ cat >> $HGRCPATH <<EOF
442 > [extensions]
443 > histedit=
444 > mq=
445 > EOF
446 $ echo > a
447 $ hg ci -Am 'foo bar'
448 adding a
449 $ hg log
450 changeset: 0:ea55e2ae468f
451 tag: tip
452 user: test
453 date: Thu Jan 01 00:00:00 1970 +0000
454 summary: foo bar
455
456 $ hg histedit tip --commands - 2>&1 <<EOF
457 > edit ea55e2ae468f foo bar
458 > EOF
459 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
460 Editing (ea55e2ae468f), commit as needed now to split the change
461 (to edit ea55e2ae468f, `hg histedit --continue` after making changes)
462 [240]
463 $ echo 'foo bar' > a
464 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
465 > y
466 > y
467 > n
468 > y
469 > y
470 > n
471 > EOF
472 abort: histedit in progress
473 (use 'hg histedit --continue' or 'hg histedit --abort')
474 [20]