##// END OF EJS Templates
test-commit-interactive-curses: remove unused import of parsers
Yuya Nishihara -
r32198:2bf62ca7 default
parent child Browse files
Show More
@@ -1,426 +1,426
1 #require tic
1 #require tic
2
2
3 Set up a repo
3 Set up a repo
4
4
5 $ cp $HGRCPATH $HGRCPATH.pretest
5 $ cp $HGRCPATH $HGRCPATH.pretest
6 $ cat <<EOF >> $HGRCPATH
6 $ cat <<EOF >> $HGRCPATH
7 > [ui]
7 > [ui]
8 > interactive = true
8 > interactive = true
9 > interface = curses
9 > interface = curses
10 > [experimental]
10 > [experimental]
11 > crecordtest = testModeCommands
11 > crecordtest = testModeCommands
12 > EOF
12 > EOF
13
13
14 Record with noeol at eof (issue5268)
14 Record with noeol at eof (issue5268)
15 $ hg init noeol
15 $ hg init noeol
16 $ cd noeol
16 $ cd noeol
17 $ printf '0' > a
17 $ printf '0' > a
18 $ printf '0\n' > b
18 $ printf '0\n' > b
19 $ hg ci -Aqm initial
19 $ hg ci -Aqm initial
20 $ printf '1\n0' > a
20 $ printf '1\n0' > a
21 $ printf '1\n0\n' > b
21 $ printf '1\n0\n' > b
22 $ cat <<EOF >testModeCommands
22 $ cat <<EOF >testModeCommands
23 > c
23 > c
24 > EOF
24 > EOF
25 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0"
25 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0"
26 $ cd ..
26 $ cd ..
27
27
28 Normal repo
28 Normal repo
29 $ hg init a
29 $ hg init a
30 $ cd a
30 $ cd a
31
31
32 Committing some changes but stopping on the way
32 Committing some changes but stopping on the way
33
33
34 $ echo "a" > a
34 $ echo "a" > a
35 $ hg add a
35 $ hg add a
36 $ cat <<EOF >testModeCommands
36 $ cat <<EOF >testModeCommands
37 > TOGGLE
37 > TOGGLE
38 > X
38 > X
39 > EOF
39 > EOF
40 $ hg commit -i -m "a" -d "0 0"
40 $ hg commit -i -m "a" -d "0 0"
41 no changes to record
41 no changes to record
42 [1]
42 [1]
43 $ hg tip
43 $ hg tip
44 changeset: -1:000000000000
44 changeset: -1:000000000000
45 tag: tip
45 tag: tip
46 user:
46 user:
47 date: Thu Jan 01 00:00:00 1970 +0000
47 date: Thu Jan 01 00:00:00 1970 +0000
48
48
49
49
50 Committing some changes
50 Committing some changes
51
51
52 $ cat <<EOF >testModeCommands
52 $ cat <<EOF >testModeCommands
53 > X
53 > X
54 > EOF
54 > EOF
55 $ hg commit -i -m "a" -d "0 0"
55 $ hg commit -i -m "a" -d "0 0"
56 $ hg tip
56 $ hg tip
57 changeset: 0:cb9a9f314b8b
57 changeset: 0:cb9a9f314b8b
58 tag: tip
58 tag: tip
59 user: test
59 user: test
60 date: Thu Jan 01 00:00:00 1970 +0000
60 date: Thu Jan 01 00:00:00 1970 +0000
61 summary: a
61 summary: a
62
62
63 Check that commit -i works with no changes
63 Check that commit -i works with no changes
64 $ hg commit -i
64 $ hg commit -i
65 no changes to record
65 no changes to record
66 [1]
66 [1]
67
67
68 Committing only one file
68 Committing only one file
69
69
70 $ echo "a" >> a
70 $ echo "a" >> a
71 >>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
71 >>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
72 $ hg add b
72 $ hg add b
73 $ cat <<EOF >testModeCommands
73 $ cat <<EOF >testModeCommands
74 > TOGGLE
74 > TOGGLE
75 > KEY_DOWN
75 > KEY_DOWN
76 > X
76 > X
77 > EOF
77 > EOF
78 $ hg commit -i -m "one file" -d "0 0"
78 $ hg commit -i -m "one file" -d "0 0"
79 $ hg tip
79 $ hg tip
80 changeset: 1:fb2705a663ea
80 changeset: 1:fb2705a663ea
81 tag: tip
81 tag: tip
82 user: test
82 user: test
83 date: Thu Jan 01 00:00:00 1970 +0000
83 date: Thu Jan 01 00:00:00 1970 +0000
84 summary: one file
84 summary: one file
85
85
86 $ hg cat -r tip a
86 $ hg cat -r tip a
87 a
87 a
88 $ cat a
88 $ cat a
89 a
89 a
90 a
90 a
91
91
92 Committing only one hunk while aborting edition of hunk
92 Committing only one hunk while aborting edition of hunk
93
93
94 - Untoggle all the hunks, go down to the second file
94 - Untoggle all the hunks, go down to the second file
95 - unfold it
95 - unfold it
96 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
96 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
97 - toggle the second hunk
97 - toggle the second hunk
98 - toggle on and off the amend mode (to check that it toggles off)
98 - toggle on and off the amend mode (to check that it toggles off)
99 - edit the hunk and quit the editor immediately with non-zero status
99 - edit the hunk and quit the editor immediately with non-zero status
100 - commit
100 - commit
101
101
102 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
102 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
103 $ echo "x" > c
103 $ echo "x" > c
104 $ cat b >> c
104 $ cat b >> c
105 $ echo "y" >> c
105 $ echo "y" >> c
106 $ mv c b
106 $ mv c b
107 $ cat <<EOF >testModeCommands
107 $ cat <<EOF >testModeCommands
108 > A
108 > A
109 > KEY_DOWN
109 > KEY_DOWN
110 > f
110 > f
111 > KEY_DOWN
111 > KEY_DOWN
112 > KEY_DOWN
112 > KEY_DOWN
113 > KEY_DOWN
113 > KEY_DOWN
114 > KEY_DOWN
114 > KEY_DOWN
115 > TOGGLE
115 > TOGGLE
116 > a
116 > a
117 > a
117 > a
118 > e
118 > e
119 > X
119 > X
120 > EOF
120 > EOF
121 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
121 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
122 editor ran
122 editor ran
123 $ rm editor.sh
123 $ rm editor.sh
124 $ hg tip
124 $ hg tip
125 changeset: 2:7d10dfe755a8
125 changeset: 2:7d10dfe755a8
126 tag: tip
126 tag: tip
127 user: test
127 user: test
128 date: Thu Jan 01 00:00:00 1970 +0000
128 date: Thu Jan 01 00:00:00 1970 +0000
129 summary: one hunk
129 summary: one hunk
130
130
131 $ hg cat -r tip b
131 $ hg cat -r tip b
132 1
132 1
133 2
133 2
134 3
134 3
135 4
135 4
136 5
136 5
137 6
137 6
138 7
138 7
139 8
139 8
140 9
140 9
141 10
141 10
142 y
142 y
143 $ cat b
143 $ cat b
144 x
144 x
145 1
145 1
146 2
146 2
147 3
147 3
148 4
148 4
149 5
149 5
150 6
150 6
151 7
151 7
152 8
152 8
153 9
153 9
154 10
154 10
155 y
155 y
156 $ hg commit -m "other hunks"
156 $ hg commit -m "other hunks"
157 $ hg tip
157 $ hg tip
158 changeset: 3:a6735021574d
158 changeset: 3:a6735021574d
159 tag: tip
159 tag: tip
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:00 1970 +0000
161 date: Thu Jan 01 00:00:00 1970 +0000
162 summary: other hunks
162 summary: other hunks
163
163
164 $ hg cat -r tip b
164 $ hg cat -r tip b
165 x
165 x
166 1
166 1
167 2
167 2
168 3
168 3
169 4
169 4
170 5
170 5
171 6
171 6
172 7
172 7
173 8
173 8
174 9
174 9
175 10
175 10
176 y
176 y
177
177
178 Newly added files can be selected with the curses interface
178 Newly added files can be selected with the curses interface
179
179
180 $ hg update -C .
180 $ hg update -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 $ echo "hello" > x
182 $ echo "hello" > x
183 $ hg add x
183 $ hg add x
184 $ cat <<EOF >testModeCommands
184 $ cat <<EOF >testModeCommands
185 > TOGGLE
185 > TOGGLE
186 > TOGGLE
186 > TOGGLE
187 > X
187 > X
188 > EOF
188 > EOF
189 $ hg st
189 $ hg st
190 A x
190 A x
191 ? testModeCommands
191 ? testModeCommands
192 $ hg commit -i -m "newly added file" -d "0 0"
192 $ hg commit -i -m "newly added file" -d "0 0"
193 $ hg st
193 $ hg st
194 ? testModeCommands
194 ? testModeCommands
195
195
196 Amend option works
196 Amend option works
197 $ echo "hello world" > x
197 $ echo "hello world" > x
198 $ hg diff -c .
198 $ hg diff -c .
199 diff -r a6735021574d -r 2b0e9be4d336 x
199 diff -r a6735021574d -r 2b0e9be4d336 x
200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
201 +++ b/x Thu Jan 01 00:00:00 1970 +0000
201 +++ b/x Thu Jan 01 00:00:00 1970 +0000
202 @@ -0,0 +1,1 @@
202 @@ -0,0 +1,1 @@
203 +hello
203 +hello
204 $ cat <<EOF >testModeCommands
204 $ cat <<EOF >testModeCommands
205 > a
205 > a
206 > X
206 > X
207 > EOF
207 > EOF
208 $ hg commit -i -m "newly added file" -d "0 0"
208 $ hg commit -i -m "newly added file" -d "0 0"
209 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend-backup.hg (glob)
209 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend-backup.hg (glob)
210 $ hg diff -c .
210 $ hg diff -c .
211 diff -r a6735021574d -r c1d239d165ae x
211 diff -r a6735021574d -r c1d239d165ae x
212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
213 +++ b/x Thu Jan 01 00:00:00 1970 +0000
213 +++ b/x Thu Jan 01 00:00:00 1970 +0000
214 @@ -0,0 +1,1 @@
214 @@ -0,0 +1,1 @@
215 +hello world
215 +hello world
216
216
217 Editing a hunk puts you back on that hunk when done editing (issue5041)
217 Editing a hunk puts you back on that hunk when done editing (issue5041)
218 To do that, we change two lines in a file, pretend to edit the second line,
218 To do that, we change two lines in a file, pretend to edit the second line,
219 exit, toggle the line selected at the end of the edit and commit.
219 exit, toggle the line selected at the end of the edit and commit.
220 The first line should be recorded if we were put on the second line at the end
220 The first line should be recorded if we were put on the second line at the end
221 of the edit.
221 of the edit.
222
222
223 $ hg update -C .
223 $ hg update -C .
224 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 $ echo "foo" > x
225 $ echo "foo" > x
226 $ echo "hello world" >> x
226 $ echo "hello world" >> x
227 $ echo "bar" >> x
227 $ echo "bar" >> x
228 $ cat <<EOF >testModeCommands
228 $ cat <<EOF >testModeCommands
229 > f
229 > f
230 > KEY_DOWN
230 > KEY_DOWN
231 > KEY_DOWN
231 > KEY_DOWN
232 > KEY_DOWN
232 > KEY_DOWN
233 > KEY_DOWN
233 > KEY_DOWN
234 > e
234 > e
235 > TOGGLE
235 > TOGGLE
236 > X
236 > X
237 > EOF
237 > EOF
238 $ printf "printf 'editor ran\n'; exit 0" > editor.sh
238 $ printf "printf 'editor ran\n'; exit 0" > editor.sh
239 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0"
239 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0"
240 editor ran
240 editor ran
241 $ hg cat -r . x
241 $ hg cat -r . x
242 foo
242 foo
243 hello world
243 hello world
244
244
245 Testing the review option. The entire final filtered patch should show
245 Testing the review option. The entire final filtered patch should show
246 up in the editor and be editable. We will unselect the second file and
246 up in the editor and be editable. We will unselect the second file and
247 the first hunk of the third file. During review, we will decide that
247 the first hunk of the third file. During review, we will decide that
248 "lower" sounds better than "bottom", and the final commit should
248 "lower" sounds better than "bottom", and the final commit should
249 reflect this edition.
249 reflect this edition.
250
250
251 $ hg update -C .
251 $ hg update -C .
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 $ echo "top" > c
253 $ echo "top" > c
254 $ cat x >> c
254 $ cat x >> c
255 $ echo "bottom" >> c
255 $ echo "bottom" >> c
256 $ mv c x
256 $ mv c x
257 $ echo "third a" >> a
257 $ echo "third a" >> a
258 $ echo "we will unselect this" >> b
258 $ echo "we will unselect this" >> b
259
259
260 $ cat > editor.sh <<EOF
260 $ cat > editor.sh <<EOF
261 > cat "\$1"
261 > cat "\$1"
262 > cat "\$1" | sed s/bottom/lower/ > tmp
262 > cat "\$1" | sed s/bottom/lower/ > tmp
263 > mv tmp "\$1"
263 > mv tmp "\$1"
264 > EOF
264 > EOF
265 $ cat > testModeCommands <<EOF
265 $ cat > testModeCommands <<EOF
266 > KEY_DOWN
266 > KEY_DOWN
267 > TOGGLE
267 > TOGGLE
268 > KEY_DOWN
268 > KEY_DOWN
269 > f
269 > f
270 > KEY_DOWN
270 > KEY_DOWN
271 > TOGGLE
271 > TOGGLE
272 > R
272 > R
273 > EOF
273 > EOF
274
274
275 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0"
275 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0"
276 # To remove '-' lines, make them ' ' lines (context).
276 # To remove '-' lines, make them ' ' lines (context).
277 # To remove '+' lines, delete them.
277 # To remove '+' lines, delete them.
278 # Lines starting with # will be removed from the patch.
278 # Lines starting with # will be removed from the patch.
279 #
279 #
280 # If the patch applies cleanly, the edited patch will immediately
280 # If the patch applies cleanly, the edited patch will immediately
281 # be finalised. If it does not apply cleanly, rejects files will be
281 # be finalised. If it does not apply cleanly, rejects files will be
282 # generated. You can use those when you try again.
282 # generated. You can use those when you try again.
283 diff --git a/a b/a
283 diff --git a/a b/a
284 --- a/a
284 --- a/a
285 +++ b/a
285 +++ b/a
286 @@ -1,2 +1,3 @@
286 @@ -1,2 +1,3 @@
287 a
287 a
288 a
288 a
289 +third a
289 +third a
290 diff --git a/x b/x
290 diff --git a/x b/x
291 --- a/x
291 --- a/x
292 +++ b/x
292 +++ b/x
293 @@ -1,2 +1,3 @@
293 @@ -1,2 +1,3 @@
294 foo
294 foo
295 hello world
295 hello world
296 +bottom
296 +bottom
297
297
298 $ hg cat -r . a
298 $ hg cat -r . a
299 a
299 a
300 a
300 a
301 third a
301 third a
302
302
303 $ hg cat -r . b
303 $ hg cat -r . b
304 x
304 x
305 1
305 1
306 2
306 2
307 3
307 3
308 4
308 4
309 5
309 5
310 6
310 6
311 7
311 7
312 8
312 8
313 9
313 9
314 10
314 10
315 y
315 y
316
316
317 $ hg cat -r . x
317 $ hg cat -r . x
318 foo
318 foo
319 hello world
319 hello world
320 lower
320 lower
321
321
322 Check spacemovesdown
322 Check spacemovesdown
323
323
324 $ cat <<EOF >> $HGRCPATH
324 $ cat <<EOF >> $HGRCPATH
325 > [experimental]
325 > [experimental]
326 > spacemovesdown = true
326 > spacemovesdown = true
327 > EOF
327 > EOF
328 $ cat <<EOF >testModeCommands
328 $ cat <<EOF >testModeCommands
329 > TOGGLE
329 > TOGGLE
330 > TOGGLE
330 > TOGGLE
331 > X
331 > X
332 > EOF
332 > EOF
333 $ hg status -q
333 $ hg status -q
334 M b
334 M b
335 M x
335 M x
336 $ hg commit -i -m "nothing to commit?" -d "0 0"
336 $ hg commit -i -m "nothing to commit?" -d "0 0"
337 no changes to record
337 no changes to record
338 [1]
338 [1]
339
339
340 Check ui.interface logic for the chunkselector
340 Check ui.interface logic for the chunkselector
341
341
342 The default interface is text
342 The default interface is text
343 $ cp $HGRCPATH.pretest $HGRCPATH
343 $ cp $HGRCPATH.pretest $HGRCPATH
344 $ chunkselectorinterface() {
344 $ chunkselectorinterface() {
345 > python <<EOF
345 > python <<EOF
346 > from mercurial import hg, ui, parsers;\
346 > from mercurial import hg, ui;\
347 > repo = hg.repository(ui.ui.load(), ".");\
347 > repo = hg.repository(ui.ui.load(), ".");\
348 > print repo.ui.interface("chunkselector")
348 > print repo.ui.interface("chunkselector")
349 > EOF
349 > EOF
350 > }
350 > }
351 $ chunkselectorinterface
351 $ chunkselectorinterface
352 text
352 text
353
353
354 If only the default is set, we'll use that for the feature, too
354 If only the default is set, we'll use that for the feature, too
355 $ cp $HGRCPATH.pretest $HGRCPATH
355 $ cp $HGRCPATH.pretest $HGRCPATH
356 $ cat <<EOF >> $HGRCPATH
356 $ cat <<EOF >> $HGRCPATH
357 > [ui]
357 > [ui]
358 > interface = curses
358 > interface = curses
359 > EOF
359 > EOF
360 $ chunkselectorinterface
360 $ chunkselectorinterface
361 curses
361 curses
362
362
363 It is possible to override the default interface with a feature specific
363 It is possible to override the default interface with a feature specific
364 interface
364 interface
365 $ cp $HGRCPATH.pretest $HGRCPATH
365 $ cp $HGRCPATH.pretest $HGRCPATH
366 $ cat <<EOF >> $HGRCPATH
366 $ cat <<EOF >> $HGRCPATH
367 > [ui]
367 > [ui]
368 > interface = text
368 > interface = text
369 > interface.chunkselector = curses
369 > interface.chunkselector = curses
370 > EOF
370 > EOF
371
371
372 $ chunkselectorinterface
372 $ chunkselectorinterface
373 curses
373 curses
374
374
375 $ cp $HGRCPATH.pretest $HGRCPATH
375 $ cp $HGRCPATH.pretest $HGRCPATH
376 $ cat <<EOF >> $HGRCPATH
376 $ cat <<EOF >> $HGRCPATH
377 > [ui]
377 > [ui]
378 > interface = curses
378 > interface = curses
379 > interface.chunkselector = text
379 > interface.chunkselector = text
380 > EOF
380 > EOF
381
381
382 $ chunkselectorinterface
382 $ chunkselectorinterface
383 text
383 text
384
384
385 If a bad interface name is given, we use the default value (with a nice
385 If a bad interface name is given, we use the default value (with a nice
386 error message to suggest that the configuration needs to be fixed)
386 error message to suggest that the configuration needs to be fixed)
387
387
388 $ cp $HGRCPATH.pretest $HGRCPATH
388 $ cp $HGRCPATH.pretest $HGRCPATH
389 $ cat <<EOF >> $HGRCPATH
389 $ cat <<EOF >> $HGRCPATH
390 > [ui]
390 > [ui]
391 > interface = blah
391 > interface = blah
392 > EOF
392 > EOF
393 $ chunkselectorinterface
393 $ chunkselectorinterface
394 invalid value for ui.interface: blah (using text)
394 invalid value for ui.interface: blah (using text)
395 text
395 text
396
396
397 $ cp $HGRCPATH.pretest $HGRCPATH
397 $ cp $HGRCPATH.pretest $HGRCPATH
398 $ cat <<EOF >> $HGRCPATH
398 $ cat <<EOF >> $HGRCPATH
399 > [ui]
399 > [ui]
400 > interface = curses
400 > interface = curses
401 > interface.chunkselector = blah
401 > interface.chunkselector = blah
402 > EOF
402 > EOF
403 $ chunkselectorinterface
403 $ chunkselectorinterface
404 invalid value for ui.interface.chunkselector: blah (using curses)
404 invalid value for ui.interface.chunkselector: blah (using curses)
405 curses
405 curses
406
406
407 $ cp $HGRCPATH.pretest $HGRCPATH
407 $ cp $HGRCPATH.pretest $HGRCPATH
408 $ cat <<EOF >> $HGRCPATH
408 $ cat <<EOF >> $HGRCPATH
409 > [ui]
409 > [ui]
410 > interface = blah
410 > interface = blah
411 > interface.chunkselector = curses
411 > interface.chunkselector = curses
412 > EOF
412 > EOF
413 $ chunkselectorinterface
413 $ chunkselectorinterface
414 invalid value for ui.interface: blah
414 invalid value for ui.interface: blah
415 curses
415 curses
416
416
417 $ cp $HGRCPATH.pretest $HGRCPATH
417 $ cp $HGRCPATH.pretest $HGRCPATH
418 $ cat <<EOF >> $HGRCPATH
418 $ cat <<EOF >> $HGRCPATH
419 > [ui]
419 > [ui]
420 > interface = blah
420 > interface = blah
421 > interface.chunkselector = blah
421 > interface.chunkselector = blah
422 > EOF
422 > EOF
423 $ chunkselectorinterface
423 $ chunkselectorinterface
424 invalid value for ui.interface: blah
424 invalid value for ui.interface: blah
425 invalid value for ui.interface.chunkselector: blah (using text)
425 invalid value for ui.interface.chunkselector: blah (using text)
426 text
426 text
General Comments 0
You need to be logged in to leave comments. Login now