##// END OF EJS Templates
py3: add b'' prefixes in test-alias.t...
Pulkit Goyal -
r36398:2bff5f05 default
parent child Browse files
Show More
@@ -1,596 +1,596 b''
1 $ HGFOO=BAR; export HGFOO
1 $ HGFOO=BAR; export HGFOO
2 $ cat >> $HGRCPATH <<EOF
2 $ cat >> $HGRCPATH <<EOF
3 > [alias]
3 > [alias]
4 > # should clobber ci but not commit (issue2993)
4 > # should clobber ci but not commit (issue2993)
5 > ci = version
5 > ci = version
6 > myinit = init
6 > myinit = init
7 > mycommit = commit
7 > mycommit = commit
8 > optionalrepo = showconfig alias.myinit
8 > optionalrepo = showconfig alias.myinit
9 > cleanstatus = status -c
9 > cleanstatus = status -c
10 > unknown = bargle
10 > unknown = bargle
11 > ambiguous = s
11 > ambiguous = s
12 > recursive = recursive
12 > recursive = recursive
13 > disabled = email
13 > disabled = email
14 > nodefinition =
14 > nodefinition =
15 > noclosingquotation = '
15 > noclosingquotation = '
16 > no--cwd = status --cwd elsewhere
16 > no--cwd = status --cwd elsewhere
17 > no-R = status -R elsewhere
17 > no-R = status -R elsewhere
18 > no--repo = status --repo elsewhere
18 > no--repo = status --repo elsewhere
19 > no--repository = status --repository elsewhere
19 > no--repository = status --repository elsewhere
20 > no--config = status --config a.config=1
20 > no--config = status --config a.config=1
21 > mylog = log
21 > mylog = log
22 > lognull = log -r null
22 > lognull = log -r null
23 > shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
23 > shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
24 > positional = log --template '{\$2} {\$1} | {date|isodate}\n'
24 > positional = log --template '{\$2} {\$1} | {date|isodate}\n'
25 > dln = lognull --debug
25 > dln = lognull --debug
26 > nousage = rollback
26 > nousage = rollback
27 > put = export -r 0 -o "\$FOO/%R.diff"
27 > put = export -r 0 -o "\$FOO/%R.diff"
28 > blank = !printf '\n'
28 > blank = !printf '\n'
29 > self = !printf '\$0\n'
29 > self = !printf '\$0\n'
30 > echoall = !printf '\$@\n'
30 > echoall = !printf '\$@\n'
31 > echo1 = !printf '\$1\n'
31 > echo1 = !printf '\$1\n'
32 > echo2 = !printf '\$2\n'
32 > echo2 = !printf '\$2\n'
33 > echo13 = !printf '\$1 \$3\n'
33 > echo13 = !printf '\$1 \$3\n'
34 > echotokens = !printf "%s\n" "\$@"
34 > echotokens = !printf "%s\n" "\$@"
35 > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g'
35 > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g'
36 > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g'
36 > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g'
37 > rt = root
37 > rt = root
38 > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n"
38 > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n"
39 > idalias = id
39 > idalias = id
40 > idaliaslong = id
40 > idaliaslong = id
41 > idaliasshell = !echo test
41 > idaliasshell = !echo test
42 > parentsshell1 = !echo one
42 > parentsshell1 = !echo one
43 > parentsshell2 = !echo two
43 > parentsshell2 = !echo two
44 > escaped1 = !printf 'test\$\$test\n'
44 > escaped1 = !printf 'test\$\$test\n'
45 > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"'
45 > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"'
46 > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"'
46 > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"'
47 > escaped4 = !printf '\$\$0 \$\$@\n'
47 > escaped4 = !printf '\$\$0 \$\$@\n'
48 > exit1 = !sh -c 'exit 1'
48 > exit1 = !sh -c 'exit 1'
49 >
49 >
50 > [defaults]
50 > [defaults]
51 > mylog = -q
51 > mylog = -q
52 > lognull = -q
52 > lognull = -q
53 > log = -v
53 > log = -v
54 > EOF
54 > EOF
55
55
56
56
57 basic
57 basic
58
58
59 $ hg myinit alias
59 $ hg myinit alias
60
60
61
61
62 unknown
62 unknown
63
63
64 $ hg unknown
64 $ hg unknown
65 abort: alias 'unknown' resolves to unknown command 'bargle'
65 abort: alias 'unknown' resolves to unknown command 'bargle'
66 [255]
66 [255]
67 $ hg help unknown
67 $ hg help unknown
68 alias 'unknown' resolves to unknown command 'bargle'
68 alias 'unknown' resolves to unknown command 'bargle'
69
69
70
70
71 ambiguous
71 ambiguous
72
72
73 $ hg ambiguous
73 $ hg ambiguous
74 abort: alias 'ambiguous' resolves to ambiguous command 's'
74 abort: alias 'ambiguous' resolves to ambiguous command 's'
75 [255]
75 [255]
76 $ hg help ambiguous
76 $ hg help ambiguous
77 alias 'ambiguous' resolves to ambiguous command 's'
77 alias 'ambiguous' resolves to ambiguous command 's'
78
78
79
79
80 recursive
80 recursive
81
81
82 $ hg recursive
82 $ hg recursive
83 abort: alias 'recursive' resolves to unknown command 'recursive'
83 abort: alias 'recursive' resolves to unknown command 'recursive'
84 [255]
84 [255]
85 $ hg help recursive
85 $ hg help recursive
86 alias 'recursive' resolves to unknown command 'recursive'
86 alias 'recursive' resolves to unknown command 'recursive'
87
87
88
88
89 disabled
89 disabled
90
90
91 $ hg disabled
91 $ hg disabled
92 abort: alias 'disabled' resolves to unknown command 'email'
92 abort: alias 'disabled' resolves to unknown command 'email'
93 ('email' is provided by 'patchbomb' extension)
93 ('email' is provided by 'patchbomb' extension)
94 [255]
94 [255]
95 $ hg help disabled
95 $ hg help disabled
96 alias 'disabled' resolves to unknown command 'email'
96 alias 'disabled' resolves to unknown command 'email'
97
97
98 'email' is provided by the following extension:
98 'email' is provided by the following extension:
99
99
100 patchbomb command to send changesets as (a series of) patch emails
100 patchbomb command to send changesets as (a series of) patch emails
101
101
102 (use 'hg help extensions' for information on enabling extensions)
102 (use 'hg help extensions' for information on enabling extensions)
103
103
104
104
105 no definition
105 no definition
106
106
107 $ hg nodef
107 $ hg nodef
108 abort: no definition for alias 'nodefinition'
108 abort: no definition for alias 'nodefinition'
109 [255]
109 [255]
110 $ hg help nodef
110 $ hg help nodef
111 no definition for alias 'nodefinition'
111 no definition for alias 'nodefinition'
112
112
113
113
114 no closing quotation
114 no closing quotation
115
115
116 $ hg noclosing
116 $ hg noclosing
117 abort: error in definition for alias 'noclosingquotation': No closing quotation
117 abort: error in definition for alias 'noclosingquotation': No closing quotation
118 [255]
118 [255]
119 $ hg help noclosing
119 $ hg help noclosing
120 error in definition for alias 'noclosingquotation': No closing quotation
120 error in definition for alias 'noclosingquotation': No closing quotation
121
121
122 "--" in alias definition should be preserved
122 "--" in alias definition should be preserved
123
123
124 $ hg --config alias.dash='cat --' -R alias dash -r0
124 $ hg --config alias.dash='cat --' -R alias dash -r0
125 abort: -r0 not under root '$TESTTMP/alias'
125 abort: -r0 not under root '$TESTTMP/alias'
126 (consider using '--cwd alias')
126 (consider using '--cwd alias')
127 [255]
127 [255]
128
128
129 invalid options
129 invalid options
130
130
131 $ hg no--cwd
131 $ hg no--cwd
132 abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
132 abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
133 [255]
133 [255]
134 $ hg help no--cwd
134 $ hg help no--cwd
135 error in definition for alias 'no--cwd': --cwd may only be given on the
135 error in definition for alias 'no--cwd': --cwd may only be given on the
136 command line
136 command line
137 $ hg no-R
137 $ hg no-R
138 abort: error in definition for alias 'no-R': -R may only be given on the command line
138 abort: error in definition for alias 'no-R': -R may only be given on the command line
139 [255]
139 [255]
140 $ hg help no-R
140 $ hg help no-R
141 error in definition for alias 'no-R': -R may only be given on the command line
141 error in definition for alias 'no-R': -R may only be given on the command line
142 $ hg no--repo
142 $ hg no--repo
143 abort: error in definition for alias 'no--repo': --repo may only be given on the command line
143 abort: error in definition for alias 'no--repo': --repo may only be given on the command line
144 [255]
144 [255]
145 $ hg help no--repo
145 $ hg help no--repo
146 error in definition for alias 'no--repo': --repo may only be given on the
146 error in definition for alias 'no--repo': --repo may only be given on the
147 command line
147 command line
148 $ hg no--repository
148 $ hg no--repository
149 abort: error in definition for alias 'no--repository': --repository may only be given on the command line
149 abort: error in definition for alias 'no--repository': --repository may only be given on the command line
150 [255]
150 [255]
151 $ hg help no--repository
151 $ hg help no--repository
152 error in definition for alias 'no--repository': --repository may only be given
152 error in definition for alias 'no--repository': --repository may only be given
153 on the command line
153 on the command line
154 $ hg no--config
154 $ hg no--config
155 abort: error in definition for alias 'no--config': --config may only be given on the command line
155 abort: error in definition for alias 'no--config': --config may only be given on the command line
156 [255]
156 [255]
157 $ hg no --config alias.no='--repo elsewhere --cwd elsewhere status'
157 $ hg no --config alias.no='--repo elsewhere --cwd elsewhere status'
158 abort: error in definition for alias 'no': --repo/--cwd may only be given on the command line
158 abort: error in definition for alias 'no': --repo/--cwd may only be given on the command line
159 [255]
159 [255]
160 $ hg no --config alias.no='--repo elsewhere'
160 $ hg no --config alias.no='--repo elsewhere'
161 abort: error in definition for alias 'no': --repo may only be given on the command line
161 abort: error in definition for alias 'no': --repo may only be given on the command line
162 [255]
162 [255]
163
163
164 optional repository
164 optional repository
165
165
166 #if no-outer-repo
166 #if no-outer-repo
167 $ hg optionalrepo
167 $ hg optionalrepo
168 init
168 init
169 #endif
169 #endif
170 $ cd alias
170 $ cd alias
171 $ cat > .hg/hgrc <<EOF
171 $ cat > .hg/hgrc <<EOF
172 > [alias]
172 > [alias]
173 > myinit = init -q
173 > myinit = init -q
174 > EOF
174 > EOF
175 $ hg optionalrepo
175 $ hg optionalrepo
176 init -q
176 init -q
177
177
178 no usage
178 no usage
179
179
180 $ hg nousage
180 $ hg nousage
181 no rollback information available
181 no rollback information available
182 [1]
182 [1]
183
183
184 $ echo foo > foo
184 $ echo foo > foo
185 $ hg commit -Amfoo
185 $ hg commit -Amfoo
186 adding foo
186 adding foo
187
187
188 infer repository
188 infer repository
189
189
190 $ cd ..
190 $ cd ..
191
191
192 #if no-outer-repo
192 #if no-outer-repo
193 $ hg shortlog alias/foo
193 $ hg shortlog alias/foo
194 0 e63c23eaa88a | 1970-01-01 00:00 +0000
194 0 e63c23eaa88a | 1970-01-01 00:00 +0000
195 #endif
195 #endif
196
196
197 $ cd alias
197 $ cd alias
198
198
199 with opts
199 with opts
200
200
201 $ hg cleanst
201 $ hg cleanst
202 C foo
202 C foo
203
203
204
204
205 with opts and whitespace
205 with opts and whitespace
206
206
207 $ hg shortlog
207 $ hg shortlog
208 0 e63c23eaa88a | 1970-01-01 00:00 +0000
208 0 e63c23eaa88a | 1970-01-01 00:00 +0000
209
209
210 positional arguments
210 positional arguments
211
211
212 $ hg positional
212 $ hg positional
213 abort: too few arguments for command alias
213 abort: too few arguments for command alias
214 [255]
214 [255]
215 $ hg positional a
215 $ hg positional a
216 abort: too few arguments for command alias
216 abort: too few arguments for command alias
217 [255]
217 [255]
218 $ hg positional 'node|short' rev
218 $ hg positional 'node|short' rev
219 0 e63c23eaa88a | 1970-01-01 00:00 +0000
219 0 e63c23eaa88a | 1970-01-01 00:00 +0000
220
220
221 interaction with defaults
221 interaction with defaults
222
222
223 $ hg mylog
223 $ hg mylog
224 0:e63c23eaa88a
224 0:e63c23eaa88a
225 $ hg lognull
225 $ hg lognull
226 -1:000000000000
226 -1:000000000000
227
227
228
228
229 properly recursive
229 properly recursive
230
230
231 $ hg dln
231 $ hg dln
232 changeset: -1:0000000000000000000000000000000000000000
232 changeset: -1:0000000000000000000000000000000000000000
233 phase: public
233 phase: public
234 parent: -1:0000000000000000000000000000000000000000
234 parent: -1:0000000000000000000000000000000000000000
235 parent: -1:0000000000000000000000000000000000000000
235 parent: -1:0000000000000000000000000000000000000000
236 manifest: -1:0000000000000000000000000000000000000000
236 manifest: -1:0000000000000000000000000000000000000000
237 user:
237 user:
238 date: Thu Jan 01 00:00:00 1970 +0000
238 date: Thu Jan 01 00:00:00 1970 +0000
239 extra: branch=default
239 extra: branch=default
240
240
241
241
242
242
243 path expanding
243 path expanding
244
244
245 $ FOO=`pwd` hg put
245 $ FOO=`pwd` hg put
246 $ cat 0.diff
246 $ cat 0.diff
247 # HG changeset patch
247 # HG changeset patch
248 # User test
248 # User test
249 # Date 0 0
249 # Date 0 0
250 # Thu Jan 01 00:00:00 1970 +0000
250 # Thu Jan 01 00:00:00 1970 +0000
251 # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
251 # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
252 # Parent 0000000000000000000000000000000000000000
252 # Parent 0000000000000000000000000000000000000000
253 foo
253 foo
254
254
255 diff -r 000000000000 -r e63c23eaa88a foo
255 diff -r 000000000000 -r e63c23eaa88a foo
256 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
256 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
257 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
257 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
258 @@ -0,0 +1,1 @@
258 @@ -0,0 +1,1 @@
259 +foo
259 +foo
260
260
261
261
262 simple shell aliases
262 simple shell aliases
263
263
264 $ hg blank
264 $ hg blank
265
265
266 $ hg blank foo
266 $ hg blank foo
267
267
268 $ hg self
268 $ hg self
269 self
269 self
270 $ hg echoall
270 $ hg echoall
271
271
272 $ hg echoall foo
272 $ hg echoall foo
273 foo
273 foo
274 $ hg echoall 'test $2' foo
274 $ hg echoall 'test $2' foo
275 test $2 foo
275 test $2 foo
276 $ hg echoall 'test $@' foo '$@'
276 $ hg echoall 'test $@' foo '$@'
277 test $@ foo $@
277 test $@ foo $@
278 $ hg echoall 'test "$@"' foo '"$@"'
278 $ hg echoall 'test "$@"' foo '"$@"'
279 test "$@" foo "$@"
279 test "$@" foo "$@"
280 $ hg echo1 foo bar baz
280 $ hg echo1 foo bar baz
281 foo
281 foo
282 $ hg echo2 foo bar baz
282 $ hg echo2 foo bar baz
283 bar
283 bar
284 $ hg echo13 foo bar baz test
284 $ hg echo13 foo bar baz test
285 foo baz
285 foo baz
286 $ hg echo2 foo
286 $ hg echo2 foo
287
287
288 $ hg echotokens
288 $ hg echotokens
289
289
290 $ hg echotokens foo 'bar $1 baz'
290 $ hg echotokens foo 'bar $1 baz'
291 foo
291 foo
292 bar $1 baz
292 bar $1 baz
293 $ hg echotokens 'test $2' foo
293 $ hg echotokens 'test $2' foo
294 test $2
294 test $2
295 foo
295 foo
296 $ hg echotokens 'test $@' foo '$@'
296 $ hg echotokens 'test $@' foo '$@'
297 test $@
297 test $@
298 foo
298 foo
299 $@
299 $@
300 $ hg echotokens 'test "$@"' foo '"$@"'
300 $ hg echotokens 'test "$@"' foo '"$@"'
301 test "$@"
301 test "$@"
302 foo
302 foo
303 "$@"
303 "$@"
304 $ echo bar > bar
304 $ echo bar > bar
305 $ hg commit -qA -m bar
305 $ hg commit -qA -m bar
306 $ hg count .
306 $ hg count .
307 1
307 1
308 $ hg count 'branch(default)'
308 $ hg count 'branch(default)'
309 2
309 2
310 $ hg mcount -r '"branch(default)"'
310 $ hg mcount -r '"branch(default)"'
311 2
311 2
312
312
313 $ hg tglog
313 $ hg tglog
314 @ 1:042423737847: 'bar'
314 @ 1:042423737847: 'bar'
315 |
315 |
316 o 0:e63c23eaa88a: 'foo'
316 o 0:e63c23eaa88a: 'foo'
317
317
318
318
319
319
320 shadowing
320 shadowing
321
321
322 $ hg i
322 $ hg i
323 hg: command 'i' is ambiguous:
323 hg: command 'i' is ambiguous:
324 idalias idaliaslong idaliasshell identify import incoming init
324 idalias idaliaslong idaliasshell identify import incoming init
325 [255]
325 [255]
326 $ hg id
326 $ hg id
327 042423737847 tip
327 042423737847 tip
328 $ hg ida
328 $ hg ida
329 hg: command 'ida' is ambiguous:
329 hg: command 'ida' is ambiguous:
330 idalias idaliaslong idaliasshell
330 idalias idaliaslong idaliasshell
331 [255]
331 [255]
332 $ hg idalias
332 $ hg idalias
333 042423737847 tip
333 042423737847 tip
334 $ hg idaliasl
334 $ hg idaliasl
335 042423737847 tip
335 042423737847 tip
336 $ hg idaliass
336 $ hg idaliass
337 test
337 test
338 $ hg parentsshell
338 $ hg parentsshell
339 hg: command 'parentsshell' is ambiguous:
339 hg: command 'parentsshell' is ambiguous:
340 parentsshell1 parentsshell2
340 parentsshell1 parentsshell2
341 [255]
341 [255]
342 $ hg parentsshell1
342 $ hg parentsshell1
343 one
343 one
344 $ hg parentsshell2
344 $ hg parentsshell2
345 two
345 two
346
346
347
347
348 shell aliases with global options
348 shell aliases with global options
349
349
350 $ hg init sub
350 $ hg init sub
351 $ cd sub
351 $ cd sub
352 $ hg count 'branch(default)'
352 $ hg count 'branch(default)'
353 abort: unknown revision 'default'!
353 abort: unknown revision 'default'!
354 0
354 0
355 $ hg -v count 'branch(default)'
355 $ hg -v count 'branch(default)'
356 abort: unknown revision 'default'!
356 abort: unknown revision 'default'!
357 0
357 0
358 $ hg -R .. count 'branch(default)'
358 $ hg -R .. count 'branch(default)'
359 abort: unknown revision 'default'!
359 abort: unknown revision 'default'!
360 0
360 0
361 $ hg --cwd .. count 'branch(default)'
361 $ hg --cwd .. count 'branch(default)'
362 2
362 2
363 $ hg echoall --cwd ..
363 $ hg echoall --cwd ..
364
364
365
365
366 "--" passed to shell alias should be preserved
366 "--" passed to shell alias should be preserved
367
367
368 $ hg --config alias.printf='!printf "$@"' printf '%s %s %s\n' -- --cwd ..
368 $ hg --config alias.printf='!printf "$@"' printf '%s %s %s\n' -- --cwd ..
369 -- --cwd ..
369 -- --cwd ..
370
370
371 repo specific shell aliases
371 repo specific shell aliases
372
372
373 $ cat >> .hg/hgrc <<EOF
373 $ cat >> .hg/hgrc <<EOF
374 > [alias]
374 > [alias]
375 > subalias = !echo sub
375 > subalias = !echo sub
376 > EOF
376 > EOF
377 $ cat >> ../.hg/hgrc <<EOF
377 $ cat >> ../.hg/hgrc <<EOF
378 > [alias]
378 > [alias]
379 > mainalias = !echo main
379 > mainalias = !echo main
380 > EOF
380 > EOF
381
381
382
382
383 shell alias defined in current repo
383 shell alias defined in current repo
384
384
385 $ hg subalias
385 $ hg subalias
386 sub
386 sub
387 $ hg --cwd .. subalias > /dev/null
387 $ hg --cwd .. subalias > /dev/null
388 hg: unknown command 'subalias'
388 hg: unknown command 'subalias'
389 (did you mean idalias?)
389 (did you mean idalias?)
390 [255]
390 [255]
391 $ hg -R .. subalias > /dev/null
391 $ hg -R .. subalias > /dev/null
392 hg: unknown command 'subalias'
392 hg: unknown command 'subalias'
393 (did you mean idalias?)
393 (did you mean idalias?)
394 [255]
394 [255]
395
395
396
396
397 shell alias defined in other repo
397 shell alias defined in other repo
398
398
399 $ hg mainalias > /dev/null
399 $ hg mainalias > /dev/null
400 hg: unknown command 'mainalias'
400 hg: unknown command 'mainalias'
401 (did you mean idalias?)
401 (did you mean idalias?)
402 [255]
402 [255]
403 $ hg -R .. mainalias
403 $ hg -R .. mainalias
404 main
404 main
405 $ hg --cwd .. mainalias
405 $ hg --cwd .. mainalias
406 main
406 main
407
407
408 typos get useful suggestions
408 typos get useful suggestions
409 $ hg --cwd .. manalias
409 $ hg --cwd .. manalias
410 hg: unknown command 'manalias'
410 hg: unknown command 'manalias'
411 (did you mean one of idalias, mainalias, manifest?)
411 (did you mean one of idalias, mainalias, manifest?)
412 [255]
412 [255]
413
413
414 shell aliases with escaped $ chars
414 shell aliases with escaped $ chars
415
415
416 $ hg escaped1
416 $ hg escaped1
417 test$test
417 test$test
418 $ hg escaped2
418 $ hg escaped2
419 HGFOO is BAR
419 HGFOO is BAR
420 $ hg escaped3 HGFOO
420 $ hg escaped3 HGFOO
421 HGFOO is BAR
421 HGFOO is BAR
422 $ hg escaped4 test
422 $ hg escaped4 test
423 $0 $@
423 $0 $@
424
424
425 abbreviated name, which matches against both shell alias and the
425 abbreviated name, which matches against both shell alias and the
426 command provided extension, should be aborted.
426 command provided extension, should be aborted.
427
427
428 $ cat >> .hg/hgrc <<EOF
428 $ cat >> .hg/hgrc <<EOF
429 > [extensions]
429 > [extensions]
430 > hgext.rebase =
430 > hgext.rebase =
431 > EOF
431 > EOF
432 #if windows
432 #if windows
433 $ cat >> .hg/hgrc <<EOF
433 $ cat >> .hg/hgrc <<EOF
434 > [alias]
434 > [alias]
435 > rebate = !echo this is %HG_ARGS%
435 > rebate = !echo this is %HG_ARGS%
436 > EOF
436 > EOF
437 #else
437 #else
438 $ cat >> .hg/hgrc <<EOF
438 $ cat >> .hg/hgrc <<EOF
439 > [alias]
439 > [alias]
440 > rebate = !echo this is \$HG_ARGS
440 > rebate = !echo this is \$HG_ARGS
441 > EOF
441 > EOF
442 #endif
442 #endif
443 $ hg reba
443 $ hg reba
444 hg: command 'reba' is ambiguous:
444 hg: command 'reba' is ambiguous:
445 rebase rebate
445 rebase rebate
446 [255]
446 [255]
447 $ hg rebat
447 $ hg rebat
448 this is rebate
448 this is rebate
449 $ hg rebat --foo-bar
449 $ hg rebat --foo-bar
450 this is rebate --foo-bar
450 this is rebate --foo-bar
451
451
452 invalid arguments
452 invalid arguments
453
453
454 $ hg rt foo
454 $ hg rt foo
455 hg rt: invalid arguments
455 hg rt: invalid arguments
456 hg rt
456 hg rt
457
457
458 alias for: hg root
458 alias for: hg root
459
459
460 (use 'hg rt -h' to show more help)
460 (use 'hg rt -h' to show more help)
461 [255]
461 [255]
462
462
463 invalid global arguments for normal commands, aliases, and shell aliases
463 invalid global arguments for normal commands, aliases, and shell aliases
464
464
465 $ hg --invalid root
465 $ hg --invalid root
466 hg: option --invalid not recognized
466 hg: option --invalid not recognized
467 Mercurial Distributed SCM
467 Mercurial Distributed SCM
468
468
469 basic commands:
469 basic commands:
470
470
471 add add the specified files on the next commit
471 add add the specified files on the next commit
472 annotate show changeset information by line for each file
472 annotate show changeset information by line for each file
473 clone make a copy of an existing repository
473 clone make a copy of an existing repository
474 commit commit the specified files or all outstanding changes
474 commit commit the specified files or all outstanding changes
475 diff diff repository (or selected files)
475 diff diff repository (or selected files)
476 export dump the header and diffs for one or more changesets
476 export dump the header and diffs for one or more changesets
477 forget forget the specified files on the next commit
477 forget forget the specified files on the next commit
478 init create a new repository in the given directory
478 init create a new repository in the given directory
479 log show revision history of entire repository or files
479 log show revision history of entire repository or files
480 merge merge another revision into working directory
480 merge merge another revision into working directory
481 pull pull changes from the specified source
481 pull pull changes from the specified source
482 push push changes to the specified destination
482 push push changes to the specified destination
483 remove remove the specified files on the next commit
483 remove remove the specified files on the next commit
484 serve start stand-alone webserver
484 serve start stand-alone webserver
485 status show changed files in the working directory
485 status show changed files in the working directory
486 summary summarize working directory state
486 summary summarize working directory state
487 update update working directory (or switch revisions)
487 update update working directory (or switch revisions)
488
488
489 (use 'hg help' for the full list of commands or 'hg -v' for details)
489 (use 'hg help' for the full list of commands or 'hg -v' for details)
490 [255]
490 [255]
491 $ hg --invalid mylog
491 $ hg --invalid mylog
492 hg: option --invalid not recognized
492 hg: option --invalid not recognized
493 Mercurial Distributed SCM
493 Mercurial Distributed SCM
494
494
495 basic commands:
495 basic commands:
496
496
497 add add the specified files on the next commit
497 add add the specified files on the next commit
498 annotate show changeset information by line for each file
498 annotate show changeset information by line for each file
499 clone make a copy of an existing repository
499 clone make a copy of an existing repository
500 commit commit the specified files or all outstanding changes
500 commit commit the specified files or all outstanding changes
501 diff diff repository (or selected files)
501 diff diff repository (or selected files)
502 export dump the header and diffs for one or more changesets
502 export dump the header and diffs for one or more changesets
503 forget forget the specified files on the next commit
503 forget forget the specified files on the next commit
504 init create a new repository in the given directory
504 init create a new repository in the given directory
505 log show revision history of entire repository or files
505 log show revision history of entire repository or files
506 merge merge another revision into working directory
506 merge merge another revision into working directory
507 pull pull changes from the specified source
507 pull pull changes from the specified source
508 push push changes to the specified destination
508 push push changes to the specified destination
509 remove remove the specified files on the next commit
509 remove remove the specified files on the next commit
510 serve start stand-alone webserver
510 serve start stand-alone webserver
511 status show changed files in the working directory
511 status show changed files in the working directory
512 summary summarize working directory state
512 summary summarize working directory state
513 update update working directory (or switch revisions)
513 update update working directory (or switch revisions)
514
514
515 (use 'hg help' for the full list of commands or 'hg -v' for details)
515 (use 'hg help' for the full list of commands or 'hg -v' for details)
516 [255]
516 [255]
517 $ hg --invalid blank
517 $ hg --invalid blank
518 hg: option --invalid not recognized
518 hg: option --invalid not recognized
519 Mercurial Distributed SCM
519 Mercurial Distributed SCM
520
520
521 basic commands:
521 basic commands:
522
522
523 add add the specified files on the next commit
523 add add the specified files on the next commit
524 annotate show changeset information by line for each file
524 annotate show changeset information by line for each file
525 clone make a copy of an existing repository
525 clone make a copy of an existing repository
526 commit commit the specified files or all outstanding changes
526 commit commit the specified files or all outstanding changes
527 diff diff repository (or selected files)
527 diff diff repository (or selected files)
528 export dump the header and diffs for one or more changesets
528 export dump the header and diffs for one or more changesets
529 forget forget the specified files on the next commit
529 forget forget the specified files on the next commit
530 init create a new repository in the given directory
530 init create a new repository in the given directory
531 log show revision history of entire repository or files
531 log show revision history of entire repository or files
532 merge merge another revision into working directory
532 merge merge another revision into working directory
533 pull pull changes from the specified source
533 pull pull changes from the specified source
534 push push changes to the specified destination
534 push push changes to the specified destination
535 remove remove the specified files on the next commit
535 remove remove the specified files on the next commit
536 serve start stand-alone webserver
536 serve start stand-alone webserver
537 status show changed files in the working directory
537 status show changed files in the working directory
538 summary summarize working directory state
538 summary summarize working directory state
539 update update working directory (or switch revisions)
539 update update working directory (or switch revisions)
540
540
541 (use 'hg help' for the full list of commands or 'hg -v' for details)
541 (use 'hg help' for the full list of commands or 'hg -v' for details)
542 [255]
542 [255]
543
543
544 environment variable changes in alias commands
544 environment variable changes in alias commands
545
545
546 $ cat > $TESTTMP/expandalias.py <<EOF
546 $ cat > $TESTTMP/expandalias.py <<EOF
547 > import os
547 > import os
548 > from mercurial import cmdutil, commands, registrar
548 > from mercurial import cmdutil, commands, registrar
549 > cmdtable = {}
549 > cmdtable = {}
550 > command = registrar.command(cmdtable)
550 > command = registrar.command(cmdtable)
551 > @command('expandalias')
551 > @command(b'expandalias')
552 > def expandalias(ui, repo, name):
552 > def expandalias(ui, repo, name):
553 > alias = cmdutil.findcmd(name, commands.table)[1][0]
553 > alias = cmdutil.findcmd(name, commands.table)[1][0]
554 > ui.write('%s args: %s\n' % (name, ' '.join(alias.args)))
554 > ui.write(b'%s args: %s\n' % (name, b' '.join(alias.args)))
555 > os.environ['COUNT'] = '2'
555 > os.environ['COUNT'] = '2'
556 > ui.write('%s args: %s (with COUNT=2)\n' % (name, ' '.join(alias.args)))
556 > ui.write(b'%s args: %s (with COUNT=2)\n' % (name, b' '.join(alias.args)))
557 > EOF
557 > EOF
558
558
559 $ cat >> $HGRCPATH <<'EOF'
559 $ cat >> $HGRCPATH <<'EOF'
560 > [extensions]
560 > [extensions]
561 > expandalias = $TESTTMP/expandalias.py
561 > expandalias = $TESTTMP/expandalias.py
562 > [alias]
562 > [alias]
563 > showcount = log -T "$COUNT" -r .
563 > showcount = log -T "$COUNT" -r .
564 > EOF
564 > EOF
565
565
566 $ COUNT=1 hg expandalias showcount
566 $ COUNT=1 hg expandalias showcount
567 showcount args: -T 1 -r .
567 showcount args: -T 1 -r .
568 showcount args: -T 2 -r . (with COUNT=2)
568 showcount args: -T 2 -r . (with COUNT=2)
569
569
570 This should show id:
570 This should show id:
571
571
572 $ hg --config alias.log='id' log
572 $ hg --config alias.log='id' log
573 000000000000 tip
573 000000000000 tip
574
574
575 This shouldn't:
575 This shouldn't:
576
576
577 $ hg --config alias.log='id' history
577 $ hg --config alias.log='id' history
578
578
579 $ cd ../..
579 $ cd ../..
580
580
581 return code of command and shell aliases:
581 return code of command and shell aliases:
582
582
583 $ hg mycommit -R alias
583 $ hg mycommit -R alias
584 nothing changed
584 nothing changed
585 [1]
585 [1]
586 $ hg exit1
586 $ hg exit1
587 [1]
587 [1]
588
588
589 #if no-outer-repo
589 #if no-outer-repo
590 $ hg root
590 $ hg root
591 abort: no repository found in '$TESTTMP' (.hg not found)!
591 abort: no repository found in '$TESTTMP' (.hg not found)!
592 [255]
592 [255]
593 $ hg --config alias.hgroot='!hg root' hgroot
593 $ hg --config alias.hgroot='!hg root' hgroot
594 abort: no repository found in '$TESTTMP' (.hg not found)!
594 abort: no repository found in '$TESTTMP' (.hg not found)!
595 [255]
595 [255]
596 #endif
596 #endif
General Comments 0
You need to be logged in to leave comments. Login now