##// END OF EJS Templates
tests: make test-alias.t pass with re2...
Valentin Gatien-Baron -
r40708:557d3509 default
parent child Browse files
Show More
@@ -1,718 +1,718 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 > myinit:doc = This is my documented alias for init.
7 > myinit:doc = This is my documented alias for init.
8 > myinit:help = [OPTIONS] [BLA] [BLE]
8 > myinit:help = [OPTIONS] [BLA] [BLE]
9 > mycommit = commit
9 > mycommit = commit
10 > mycommit:doc = This is my alias with only doc.
10 > mycommit:doc = This is my alias with only doc.
11 > optionalrepo = showconfig alias.myinit
11 > optionalrepo = showconfig alias.myinit
12 > cleanstatus = status -c
12 > cleanstatus = status -c
13 > cleanstatus:help = [ONLYHELPHERE]
13 > cleanstatus:help = [ONLYHELPHERE]
14 > unknown = bargle
14 > unknown = bargle
15 > ambiguous = s
15 > ambiguous = s
16 > recursive = recursive
16 > recursive = recursive
17 > disabled = email
17 > disabled = email
18 > nodefinition =
18 > nodefinition =
19 > noclosingquotation = '
19 > noclosingquotation = '
20 > no--cwd = status --cwd elsewhere
20 > no--cwd = status --cwd elsewhere
21 > no-R = status -R elsewhere
21 > no-R = status -R elsewhere
22 > no--repo = status --repo elsewhere
22 > no--repo = status --repo elsewhere
23 > no--repository = status --repository elsewhere
23 > no--repository = status --repository elsewhere
24 > no--config = status --config a.config=1
24 > no--config = status --config a.config=1
25 > mylog = log
25 > mylog = log
26 > lognull = log -r null
26 > lognull = log -r null
27 > lognull:doc = Logs the null rev
27 > lognull:doc = Logs the null rev
28 > lognull:help = foo bar baz
28 > lognull:help = foo bar baz
29 > shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
29 > shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
30 > positional = log --template '{\$2} {\$1} | {date|isodate}\n'
30 > positional = log --template '{\$2} {\$1} | {date|isodate}\n'
31 > dln = lognull --debug
31 > dln = lognull --debug
32 > recursivedoc = dln
32 > recursivedoc = dln
33 > recursivedoc:doc = Logs the null rev in debug mode
33 > recursivedoc:doc = Logs the null rev in debug mode
34 > nousage = rollback
34 > nousage = rollback
35 > put = export -r 0 -o "\$FOO/%R.diff"
35 > put = export -r 0 -o "\$FOO/%R.diff"
36 > blank = !printf '\n'
36 > blank = !printf '\n'
37 > self = !printf '\$0\n'
37 > self = !printf '\$0\n'
38 > echoall = !printf '\$@\n'
38 > echoall = !printf '\$@\n'
39 > echo1 = !printf '\$1\n'
39 > echo1 = !printf '\$1\n'
40 > echo2 = !printf '\$2\n'
40 > echo2 = !printf '\$2\n'
41 > echo13 = !printf '\$1 \$3\n'
41 > echo13 = !printf '\$1 \$3\n'
42 > echotokens = !printf "%s\n" "\$@"
42 > echotokens = !printf "%s\n" "\$@"
43 > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g'
43 > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g'
44 > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g'
44 > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g'
45 > rt = root
45 > rt = root
46 > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n"
46 > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n"
47 > idalias = id
47 > idalias = id
48 > idaliaslong = id
48 > idaliaslong = id
49 > idaliasshell = !echo test
49 > idaliasshell = !echo test
50 > parentsshell1 = !echo one
50 > parentsshell1 = !echo one
51 > parentsshell2 = !echo two
51 > parentsshell2 = !echo two
52 > escaped1 = !printf 'test\$\$test\n'
52 > escaped1 = !printf 'test\$\$test\n'
53 > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"'
53 > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"'
54 > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"'
54 > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"'
55 > escaped4 = !printf '\$\$0 \$\$@\n'
55 > escaped4 = !printf '\$\$0 \$\$@\n'
56 > exit1 = !sh -c 'exit 1'
56 > exit1 = !sh -c 'exit 1'
57 >
57 >
58 > [defaults]
58 > [defaults]
59 > mylog = -q
59 > mylog = -q
60 > lognull = -q
60 > lognull = -q
61 > log = -v
61 > log = -v
62 > EOF
62 > EOF
63
63
64 basic
64 basic
65
65
66 $ hg myinit alias
66 $ hg myinit alias
67
67
68 help
68 help
69
69
70 $ hg help -c | grep myinit
70 $ hg help -c | grep myinit
71 myinit This is my documented alias for init.
71 myinit This is my documented alias for init.
72 $ hg help -c | grep mycommit
72 $ hg help -c | grep mycommit
73 mycommit This is my alias with only doc.
73 mycommit This is my alias with only doc.
74 $ hg help -c | grep cleanstatus
74 $ hg help -c | grep cleanstatus
75 [1]
75 [1]
76 $ hg help -c | grep lognull
76 $ hg help -c | grep lognull
77 lognull Logs the null rev
77 lognull Logs the null rev
78 $ hg help -c | grep dln
78 $ hg help -c | grep dln
79 [1]
79 [1]
80 $ hg help -c | grep recursivedoc
80 $ hg help -c | grep recursivedoc
81 recursivedoc Logs the null rev in debug mode
81 recursivedoc Logs the null rev in debug mode
82 $ hg help myinit
82 $ hg help myinit
83 hg myinit [OPTIONS] [BLA] [BLE]
83 hg myinit [OPTIONS] [BLA] [BLE]
84
84
85 alias for: hg init
85 alias for: hg init
86
86
87 This is my documented alias for init.
87 This is my documented alias for init.
88
88
89 defined by: * (glob)
89 defined by: * (glob)
90 */* (glob) (?)
90 */* (glob) (?)
91 */* (glob) (?)
91 */* (glob) (?)
92 */* (glob) (?)
92 */* (glob) (?)
93
93
94 options:
94 options:
95
95
96 -e --ssh CMD specify ssh command to use
96 -e --ssh CMD specify ssh command to use
97 --remotecmd CMD specify hg command to run on the remote side
97 --remotecmd CMD specify hg command to run on the remote side
98 --insecure do not verify server certificate (ignoring web.cacerts
98 --insecure do not verify server certificate (ignoring web.cacerts
99 config)
99 config)
100
100
101 (some details hidden, use --verbose to show complete help)
101 (some details hidden, use --verbose to show complete help)
102
102
103 $ hg help mycommit
103 $ hg help mycommit
104 hg mycommit [OPTION]... [FILE]...
104 hg mycommit [OPTION]... [FILE]...
105
105
106 alias for: hg commit
106 alias for: hg commit
107
107
108 This is my alias with only doc.
108 This is my alias with only doc.
109
109
110 defined by: * (glob)
110 defined by: * (glob)
111 */* (glob) (?)
111 */* (glob) (?)
112 */* (glob) (?)
112 */* (glob) (?)
113 */* (glob) (?)
113 */* (glob) (?)
114
114
115 options ([+] can be repeated):
115 options ([+] can be repeated):
116
116
117 -A --addremove mark new/missing files as added/removed before
117 -A --addremove mark new/missing files as added/removed before
118 committing
118 committing
119 --close-branch mark a branch head as closed
119 --close-branch mark a branch head as closed
120 --amend amend the parent of the working directory
120 --amend amend the parent of the working directory
121 -s --secret use the secret phase for committing
121 -s --secret use the secret phase for committing
122 -e --edit invoke editor on commit messages
122 -e --edit invoke editor on commit messages
123 -i --interactive use interactive mode
123 -i --interactive use interactive mode
124 -I --include PATTERN [+] include names matching the given patterns
124 -I --include PATTERN [+] include names matching the given patterns
125 -X --exclude PATTERN [+] exclude names matching the given patterns
125 -X --exclude PATTERN [+] exclude names matching the given patterns
126 -m --message TEXT use text as commit message
126 -m --message TEXT use text as commit message
127 -l --logfile FILE read commit message from file
127 -l --logfile FILE read commit message from file
128 -d --date DATE record the specified date as commit date
128 -d --date DATE record the specified date as commit date
129 -u --user USER record the specified user as committer
129 -u --user USER record the specified user as committer
130 -S --subrepos recurse into subrepositories
130 -S --subrepos recurse into subrepositories
131
131
132 (some details hidden, use --verbose to show complete help)
132 (some details hidden, use --verbose to show complete help)
133
133
134 $ hg help cleanstatus
134 $ hg help cleanstatus
135 hg cleanstatus [ONLYHELPHERE]
135 hg cleanstatus [ONLYHELPHERE]
136
136
137 alias for: hg status -c
137 alias for: hg status -c
138
138
139 show changed files in the working directory
139 show changed files in the working directory
140
140
141 Show status of files in the repository. If names are given, only files
141 Show status of files in the repository. If names are given, only files
142 that match are shown. Files that are clean or ignored or the source of a
142 that match are shown. Files that are clean or ignored or the source of a
143 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
143 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
144 -C/--copies or -A/--all are given. Unless options described with "show
144 -C/--copies or -A/--all are given. Unless options described with "show
145 only ..." are given, the options -mardu are used.
145 only ..." are given, the options -mardu are used.
146
146
147 Option -q/--quiet hides untracked (unknown and ignored) files unless
147 Option -q/--quiet hides untracked (unknown and ignored) files unless
148 explicitly requested with -u/--unknown or -i/--ignored.
148 explicitly requested with -u/--unknown or -i/--ignored.
149
149
150 Note:
150 Note:
151 'hg status' may appear to disagree with diff if permissions have
151 'hg status' may appear to disagree with diff if permissions have
152 changed or a merge has occurred. The standard diff format does not
152 changed or a merge has occurred. The standard diff format does not
153 report permission changes and diff only reports changes relative to one
153 report permission changes and diff only reports changes relative to one
154 merge parent.
154 merge parent.
155
155
156 If one revision is given, it is used as the base revision. If two
156 If one revision is given, it is used as the base revision. If two
157 revisions are given, the differences between them are shown. The --change
157 revisions are given, the differences between them are shown. The --change
158 option can also be used as a shortcut to list the changed files of a
158 option can also be used as a shortcut to list the changed files of a
159 revision from its first parent.
159 revision from its first parent.
160
160
161 The codes used to show the status of files are:
161 The codes used to show the status of files are:
162
162
163 M = modified
163 M = modified
164 A = added
164 A = added
165 R = removed
165 R = removed
166 C = clean
166 C = clean
167 ! = missing (deleted by non-hg command, but still tracked)
167 ! = missing (deleted by non-hg command, but still tracked)
168 ? = not tracked
168 ? = not tracked
169 I = ignored
169 I = ignored
170 = origin of the previous file (with --copies)
170 = origin of the previous file (with --copies)
171
171
172 Returns 0 on success.
172 Returns 0 on success.
173
173
174 defined by: * (glob)
174 defined by: * (glob)
175 */* (glob) (?)
175 */* (glob) (?)
176 */* (glob) (?)
176 */* (glob) (?)
177 */* (glob) (?)
177 */* (glob) (?)
178
178
179 options ([+] can be repeated):
179 options ([+] can be repeated):
180
180
181 -A --all show status of all files
181 -A --all show status of all files
182 -m --modified show only modified files
182 -m --modified show only modified files
183 -a --added show only added files
183 -a --added show only added files
184 -r --removed show only removed files
184 -r --removed show only removed files
185 -d --deleted show only deleted (but tracked) files
185 -d --deleted show only deleted (but tracked) files
186 -c --clean show only files without changes
186 -c --clean show only files without changes
187 -u --unknown show only unknown (not tracked) files
187 -u --unknown show only unknown (not tracked) files
188 -i --ignored show only ignored files
188 -i --ignored show only ignored files
189 -n --no-status hide status prefix
189 -n --no-status hide status prefix
190 -C --copies show source of copied files
190 -C --copies show source of copied files
191 -0 --print0 end filenames with NUL, for use with xargs
191 -0 --print0 end filenames with NUL, for use with xargs
192 --rev REV [+] show difference from revision
192 --rev REV [+] show difference from revision
193 --change REV list the changed files of a revision
193 --change REV list the changed files of a revision
194 -I --include PATTERN [+] include names matching the given patterns
194 -I --include PATTERN [+] include names matching the given patterns
195 -X --exclude PATTERN [+] exclude names matching the given patterns
195 -X --exclude PATTERN [+] exclude names matching the given patterns
196 -S --subrepos recurse into subrepositories
196 -S --subrepos recurse into subrepositories
197 -T --template TEMPLATE display with template
197 -T --template TEMPLATE display with template
198
198
199 (some details hidden, use --verbose to show complete help)
199 (some details hidden, use --verbose to show complete help)
200
200
201 $ hg help recursivedoc | head -n 5
201 $ hg help recursivedoc | head -n 5
202 hg recursivedoc foo bar baz
202 hg recursivedoc foo bar baz
203
203
204 alias for: hg dln
204 alias for: hg dln
205
205
206 Logs the null rev in debug mode
206 Logs the null rev in debug mode
207
207
208 unknown
208 unknown
209
209
210 $ hg unknown
210 $ hg unknown
211 abort: alias 'unknown' resolves to unknown command 'bargle'
211 abort: alias 'unknown' resolves to unknown command 'bargle'
212 [255]
212 [255]
213 $ hg help unknown
213 $ hg help unknown
214 alias 'unknown' resolves to unknown command 'bargle'
214 alias 'unknown' resolves to unknown command 'bargle'
215
215
216
216
217 ambiguous
217 ambiguous
218
218
219 $ hg ambiguous
219 $ hg ambiguous
220 abort: alias 'ambiguous' resolves to ambiguous command 's'
220 abort: alias 'ambiguous' resolves to ambiguous command 's'
221 [255]
221 [255]
222 $ hg help ambiguous
222 $ hg help ambiguous
223 alias 'ambiguous' resolves to ambiguous command 's'
223 alias 'ambiguous' resolves to ambiguous command 's'
224
224
225
225
226 recursive
226 recursive
227
227
228 $ hg recursive
228 $ hg recursive
229 abort: alias 'recursive' resolves to unknown command 'recursive'
229 abort: alias 'recursive' resolves to unknown command 'recursive'
230 [255]
230 [255]
231 $ hg help recursive
231 $ hg help recursive
232 alias 'recursive' resolves to unknown command 'recursive'
232 alias 'recursive' resolves to unknown command 'recursive'
233
233
234
234
235 disabled
235 disabled
236
236
237 $ hg disabled
237 $ hg disabled
238 abort: alias 'disabled' resolves to unknown command 'email'
238 abort: alias 'disabled' resolves to unknown command 'email'
239 ('email' is provided by 'patchbomb' extension)
239 ('email' is provided by 'patchbomb' extension)
240 [255]
240 [255]
241 $ hg help disabled
241 $ hg help disabled
242 alias 'disabled' resolves to unknown command 'email'
242 alias 'disabled' resolves to unknown command 'email'
243
243
244 'email' is provided by the following extension:
244 'email' is provided by the following extension:
245
245
246 patchbomb command to send changesets as (a series of) patch emails
246 patchbomb command to send changesets as (a series of) patch emails
247
247
248 (use 'hg help extensions' for information on enabling extensions)
248 (use 'hg help extensions' for information on enabling extensions)
249
249
250
250
251 no definition
251 no definition
252
252
253 $ hg nodef
253 $ hg nodef
254 abort: no definition for alias 'nodefinition'
254 abort: no definition for alias 'nodefinition'
255 [255]
255 [255]
256 $ hg help nodef
256 $ hg help nodef
257 no definition for alias 'nodefinition'
257 no definition for alias 'nodefinition'
258
258
259
259
260 no closing quotation
260 no closing quotation
261
261
262 $ hg noclosing
262 $ hg noclosing
263 abort: error in definition for alias 'noclosingquotation': No closing quotation
263 abort: error in definition for alias 'noclosingquotation': No closing quotation
264 [255]
264 [255]
265 $ hg help noclosing
265 $ hg help noclosing
266 error in definition for alias 'noclosingquotation': No closing quotation
266 error in definition for alias 'noclosingquotation': No closing quotation
267
267
268 "--" in alias definition should be preserved
268 "--" in alias definition should be preserved
269
269
270 $ hg --config alias.dash='cat --' -R alias dash -r0
270 $ hg --config alias.dash='cat --' -R alias dash -r0
271 abort: -r0 not under root '$TESTTMP/alias'
271 abort: -r0 not under root '$TESTTMP/alias'
272 (consider using '--cwd alias')
272 (consider using '--cwd alias')
273 [255]
273 [255]
274
274
275 invalid options
275 invalid options
276
276
277 $ hg no--cwd
277 $ hg no--cwd
278 abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
278 abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
279 [255]
279 [255]
280 $ hg help no--cwd
280 $ hg help no--cwd
281 error in definition for alias 'no--cwd': --cwd may only be given on the
281 error in definition for alias 'no--cwd': --cwd may only be given on the
282 command line
282 command line
283 $ hg no-R
283 $ hg no-R
284 abort: error in definition for alias 'no-R': -R may only be given on the command line
284 abort: error in definition for alias 'no-R': -R may only be given on the command line
285 [255]
285 [255]
286 $ hg help no-R
286 $ hg help no-R
287 error in definition for alias 'no-R': -R may only be given on the command line
287 error in definition for alias 'no-R': -R may only be given on the command line
288 $ hg no--repo
288 $ hg no--repo
289 abort: error in definition for alias 'no--repo': --repo may only be given on the command line
289 abort: error in definition for alias 'no--repo': --repo may only be given on the command line
290 [255]
290 [255]
291 $ hg help no--repo
291 $ hg help no--repo
292 error in definition for alias 'no--repo': --repo may only be given on the
292 error in definition for alias 'no--repo': --repo may only be given on the
293 command line
293 command line
294 $ hg no--repository
294 $ hg no--repository
295 abort: error in definition for alias 'no--repository': --repository may only be given on the command line
295 abort: error in definition for alias 'no--repository': --repository may only be given on the command line
296 [255]
296 [255]
297 $ hg help no--repository
297 $ hg help no--repository
298 error in definition for alias 'no--repository': --repository may only be given
298 error in definition for alias 'no--repository': --repository may only be given
299 on the command line
299 on the command line
300 $ hg no--config
300 $ hg no--config
301 abort: error in definition for alias 'no--config': --config may only be given on the command line
301 abort: error in definition for alias 'no--config': --config may only be given on the command line
302 [255]
302 [255]
303 $ hg no --config alias.no='--repo elsewhere --cwd elsewhere status'
303 $ hg no --config alias.no='--repo elsewhere --cwd elsewhere status'
304 abort: error in definition for alias 'no': --repo/--cwd may only be given on the command line
304 abort: error in definition for alias 'no': --repo/--cwd may only be given on the command line
305 [255]
305 [255]
306 $ hg no --config alias.no='--repo elsewhere'
306 $ hg no --config alias.no='--repo elsewhere'
307 abort: error in definition for alias 'no': --repo may only be given on the command line
307 abort: error in definition for alias 'no': --repo may only be given on the command line
308 [255]
308 [255]
309
309
310 optional repository
310 optional repository
311
311
312 #if no-outer-repo
312 #if no-outer-repo
313 $ hg optionalrepo
313 $ hg optionalrepo
314 init
314 init
315 #endif
315 #endif
316 $ cd alias
316 $ cd alias
317 $ cat > .hg/hgrc <<EOF
317 $ cat > .hg/hgrc <<EOF
318 > [alias]
318 > [alias]
319 > myinit = init -q
319 > myinit = init -q
320 > EOF
320 > EOF
321 $ hg optionalrepo
321 $ hg optionalrepo
322 init -q
322 init -q
323
323
324 no usage
324 no usage
325
325
326 $ hg nousage
326 $ hg nousage
327 no rollback information available
327 no rollback information available
328 [1]
328 [1]
329
329
330 $ echo foo > foo
330 $ echo foo > foo
331 $ hg commit -Amfoo
331 $ hg commit -Amfoo
332 adding foo
332 adding foo
333
333
334 infer repository
334 infer repository
335
335
336 $ cd ..
336 $ cd ..
337
337
338 #if no-outer-repo
338 #if no-outer-repo
339 $ hg shortlog alias/foo
339 $ hg shortlog alias/foo
340 0 e63c23eaa88a | 1970-01-01 00:00 +0000
340 0 e63c23eaa88a | 1970-01-01 00:00 +0000
341 #endif
341 #endif
342
342
343 $ cd alias
343 $ cd alias
344
344
345 with opts
345 with opts
346
346
347 $ hg cleanst
347 $ hg cleanst
348 C foo
348 C foo
349
349
350
350
351 with opts and whitespace
351 with opts and whitespace
352
352
353 $ hg shortlog
353 $ hg shortlog
354 0 e63c23eaa88a | 1970-01-01 00:00 +0000
354 0 e63c23eaa88a | 1970-01-01 00:00 +0000
355
355
356 positional arguments
356 positional arguments
357
357
358 $ hg positional
358 $ hg positional
359 abort: too few arguments for command alias
359 abort: too few arguments for command alias
360 [255]
360 [255]
361 $ hg positional a
361 $ hg positional a
362 abort: too few arguments for command alias
362 abort: too few arguments for command alias
363 [255]
363 [255]
364 $ hg positional 'node|short' rev
364 $ hg positional 'node|short' rev
365 0 e63c23eaa88a | 1970-01-01 00:00 +0000
365 0 e63c23eaa88a | 1970-01-01 00:00 +0000
366
366
367 interaction with defaults
367 interaction with defaults
368
368
369 $ hg mylog
369 $ hg mylog
370 0:e63c23eaa88a
370 0:e63c23eaa88a
371 $ hg lognull
371 $ hg lognull
372 -1:000000000000
372 -1:000000000000
373
373
374
374
375 properly recursive
375 properly recursive
376
376
377 $ hg dln
377 $ hg dln
378 changeset: -1:0000000000000000000000000000000000000000
378 changeset: -1:0000000000000000000000000000000000000000
379 phase: public
379 phase: public
380 parent: -1:0000000000000000000000000000000000000000
380 parent: -1:0000000000000000000000000000000000000000
381 parent: -1:0000000000000000000000000000000000000000
381 parent: -1:0000000000000000000000000000000000000000
382 manifest: -1:0000000000000000000000000000000000000000
382 manifest: -1:0000000000000000000000000000000000000000
383 user:
383 user:
384 date: Thu Jan 01 00:00:00 1970 +0000
384 date: Thu Jan 01 00:00:00 1970 +0000
385 extra: branch=default
385 extra: branch=default
386
386
387
387
388
388
389 path expanding
389 path expanding
390
390
391 $ FOO=`pwd` hg put
391 $ FOO=`pwd` hg put
392 $ cat 0.diff
392 $ cat 0.diff
393 # HG changeset patch
393 # HG changeset patch
394 # User test
394 # User test
395 # Date 0 0
395 # Date 0 0
396 # Thu Jan 01 00:00:00 1970 +0000
396 # Thu Jan 01 00:00:00 1970 +0000
397 # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
397 # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
398 # Parent 0000000000000000000000000000000000000000
398 # Parent 0000000000000000000000000000000000000000
399 foo
399 foo
400
400
401 diff -r 000000000000 -r e63c23eaa88a foo
401 diff -r 000000000000 -r e63c23eaa88a foo
402 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
402 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
403 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
403 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
404 @@ -0,0 +1,1 @@
404 @@ -0,0 +1,1 @@
405 +foo
405 +foo
406
406
407
407
408 simple shell aliases
408 simple shell aliases
409
409
410 $ hg blank
410 $ hg blank
411
411
412 $ hg blank foo
412 $ hg blank foo
413
413
414 $ hg self
414 $ hg self
415 self
415 self
416 $ hg echoall
416 $ hg echoall
417
417
418 $ hg echoall foo
418 $ hg echoall foo
419 foo
419 foo
420 $ hg echoall 'test $2' foo
420 $ hg echoall 'test $2' foo
421 test $2 foo
421 test $2 foo
422 $ hg echoall 'test $@' foo '$@'
422 $ hg echoall 'test $@' foo '$@'
423 test $@ foo $@
423 test $@ foo $@
424 $ hg echoall 'test "$@"' foo '"$@"'
424 $ hg echoall 'test "$@"' foo '"$@"'
425 test "$@" foo "$@"
425 test "$@" foo "$@"
426 $ hg echo1 foo bar baz
426 $ hg echo1 foo bar baz
427 foo
427 foo
428 $ hg echo2 foo bar baz
428 $ hg echo2 foo bar baz
429 bar
429 bar
430 $ hg echo13 foo bar baz test
430 $ hg echo13 foo bar baz test
431 foo baz
431 foo baz
432 $ hg echo2 foo
432 $ hg echo2 foo
433
433
434 $ hg echotokens
434 $ hg echotokens
435
435
436 $ hg echotokens foo 'bar $1 baz'
436 $ hg echotokens foo 'bar $1 baz'
437 foo
437 foo
438 bar $1 baz
438 bar $1 baz
439 $ hg echotokens 'test $2' foo
439 $ hg echotokens 'test $2' foo
440 test $2
440 test $2
441 foo
441 foo
442 $ hg echotokens 'test $@' foo '$@'
442 $ hg echotokens 'test $@' foo '$@'
443 test $@
443 test $@
444 foo
444 foo
445 $@
445 $@
446 $ hg echotokens 'test "$@"' foo '"$@"'
446 $ hg echotokens 'test "$@"' foo '"$@"'
447 test "$@"
447 test "$@"
448 foo
448 foo
449 "$@"
449 "$@"
450 $ echo bar > bar
450 $ echo bar > bar
451 $ hg commit -qA -m bar
451 $ hg commit -qA -m bar
452 $ hg count .
452 $ hg count .
453 1
453 1
454 $ hg count 'branch(default)'
454 $ hg count 'branch(default)'
455 2
455 2
456 $ hg mcount -r '"branch(default)"'
456 $ hg mcount -r '"branch(default)"'
457 2
457 2
458
458
459 $ hg tglog
459 $ hg tglog
460 @ 1:042423737847: 'bar'
460 @ 1:042423737847: 'bar'
461 |
461 |
462 o 0:e63c23eaa88a: 'foo'
462 o 0:e63c23eaa88a: 'foo'
463
463
464
464
465
465
466 shadowing
466 shadowing
467
467
468 $ hg i
468 $ hg i
469 hg: command 'i' is ambiguous:
469 hg: command 'i' is ambiguous:
470 idalias idaliaslong idaliasshell identify import incoming init
470 idalias idaliaslong idaliasshell identify import incoming init
471 [255]
471 [255]
472 $ hg id
472 $ hg id
473 042423737847 tip
473 042423737847 tip
474 $ hg ida
474 $ hg ida
475 hg: command 'ida' is ambiguous:
475 hg: command 'ida' is ambiguous:
476 idalias idaliaslong idaliasshell
476 idalias idaliaslong idaliasshell
477 [255]
477 [255]
478 $ hg idalias
478 $ hg idalias
479 042423737847 tip
479 042423737847 tip
480 $ hg idaliasl
480 $ hg idaliasl
481 042423737847 tip
481 042423737847 tip
482 $ hg idaliass
482 $ hg idaliass
483 test
483 test
484 $ hg parentsshell
484 $ hg parentsshell
485 hg: command 'parentsshell' is ambiguous:
485 hg: command 'parentsshell' is ambiguous:
486 parentsshell1 parentsshell2
486 parentsshell1 parentsshell2
487 [255]
487 [255]
488 $ hg parentsshell1
488 $ hg parentsshell1
489 one
489 one
490 $ hg parentsshell2
490 $ hg parentsshell2
491 two
491 two
492
492
493
493
494 shell aliases with global options
494 shell aliases with global options
495
495
496 $ hg init sub
496 $ hg init sub
497 $ cd sub
497 $ cd sub
498 $ hg count 'branch(default)'
498 $ hg count 'branch(default)'
499 abort: unknown revision 'default'!
499 abort: unknown revision 'default'!
500 0
500 0
501 $ hg -v count 'branch(default)'
501 $ hg -v count 'branch(default)'
502 abort: unknown revision 'default'!
502 abort: unknown revision 'default'!
503 0
503 0
504 $ hg -R .. count 'branch(default)'
504 $ hg -R .. count 'branch(default)'
505 abort: unknown revision 'default'!
505 abort: unknown revision 'default'!
506 0
506 0
507 $ hg --cwd .. count 'branch(default)'
507 $ hg --cwd .. count 'branch(default)'
508 2
508 2
509 $ hg echoall --cwd ..
509 $ hg echoall --cwd ..
510
510
511
511
512 "--" passed to shell alias should be preserved
512 "--" passed to shell alias should be preserved
513
513
514 $ hg --config alias.printf='!printf "$@"' printf '%s %s %s\n' -- --cwd ..
514 $ hg --config alias.printf='!printf "$@"' printf '%s %s %s\n' -- --cwd ..
515 -- --cwd ..
515 -- --cwd ..
516
516
517 repo specific shell aliases
517 repo specific shell aliases
518
518
519 $ cat >> .hg/hgrc <<EOF
519 $ cat >> .hg/hgrc <<EOF
520 > [alias]
520 > [alias]
521 > subalias = !echo sub
521 > subalias = !echo sub
522 > EOF
522 > EOF
523 $ cat >> ../.hg/hgrc <<EOF
523 $ cat >> ../.hg/hgrc <<EOF
524 > [alias]
524 > [alias]
525 > mainalias = !echo main
525 > mainalias = !echo main
526 > EOF
526 > EOF
527
527
528
528
529 shell alias defined in current repo
529 shell alias defined in current repo
530
530
531 $ hg subalias
531 $ hg subalias
532 sub
532 sub
533 $ hg --cwd .. subalias > /dev/null
533 $ hg --cwd .. subalias > /dev/null
534 hg: unknown command 'subalias'
534 hg: unknown command 'subalias'
535 (did you mean idalias?)
535 (did you mean idalias?)
536 [255]
536 [255]
537 $ hg -R .. subalias > /dev/null
537 $ hg -R .. subalias > /dev/null
538 hg: unknown command 'subalias'
538 hg: unknown command 'subalias'
539 (did you mean idalias?)
539 (did you mean idalias?)
540 [255]
540 [255]
541
541
542
542
543 shell alias defined in other repo
543 shell alias defined in other repo
544
544
545 $ hg mainalias > /dev/null
545 $ hg mainalias > /dev/null
546 hg: unknown command 'mainalias'
546 hg: unknown command 'mainalias'
547 (did you mean idalias?)
547 (did you mean idalias?)
548 [255]
548 [255]
549 $ hg -R .. mainalias
549 $ hg -R .. mainalias
550 main
550 main
551 $ hg --cwd .. mainalias
551 $ hg --cwd .. mainalias
552 main
552 main
553
553
554 typos get useful suggestions
554 typos get useful suggestions
555 $ hg --cwd .. manalias
555 $ hg --cwd .. manalias
556 hg: unknown command 'manalias'
556 hg: unknown command 'manalias'
557 (did you mean one of idalias, mainalias, manifest?)
557 (did you mean one of idalias, mainalias, manifest?)
558 [255]
558 [255]
559
559
560 shell aliases with escaped $ chars
560 shell aliases with escaped $ chars
561
561
562 $ hg escaped1
562 $ hg escaped1
563 test$test
563 test$test
564 $ hg escaped2
564 $ hg escaped2
565 HGFOO is BAR
565 HGFOO is BAR
566 $ hg escaped3 HGFOO
566 $ hg escaped3 HGFOO
567 HGFOO is BAR
567 HGFOO is BAR
568 $ hg escaped4 test
568 $ hg escaped4 test
569 $0 $@
569 $0 $@
570
570
571 abbreviated name, which matches against both shell alias and the
571 abbreviated name, which matches against both shell alias and the
572 command provided extension, should be aborted.
572 command provided extension, should be aborted.
573
573
574 $ cat >> .hg/hgrc <<EOF
574 $ cat >> .hg/hgrc <<EOF
575 > [extensions]
575 > [extensions]
576 > hgext.rebase =
576 > hgext.rebase =
577 > EOF
577 > EOF
578 #if windows
578 #if windows
579 $ cat >> .hg/hgrc <<EOF
579 $ cat >> .hg/hgrc <<EOF
580 > [alias]
580 > [alias]
581 > rebate = !echo this is %HG_ARGS%
581 > rebate = !echo this is %HG_ARGS%
582 > EOF
582 > EOF
583 #else
583 #else
584 $ cat >> .hg/hgrc <<EOF
584 $ cat >> .hg/hgrc <<EOF
585 > [alias]
585 > [alias]
586 > rebate = !echo this is \$HG_ARGS
586 > rebate = !echo this is \$HG_ARGS
587 > EOF
587 > EOF
588 #endif
588 #endif
589 $ cat >> .hg/hgrc <<EOF
589 $ cat >> .hg/hgrc <<EOF
590 > rebate:doc = This is my alias which just prints something.
590 > rebate:doc = This is my alias which just prints something.
591 > rebate:help = [MYARGS]
591 > rebate:help = [MYARGS]
592 > EOF
592 > EOF
593 $ hg reba
593 $ hg reba
594 hg: command 'reba' is ambiguous:
594 hg: command 'reba' is ambiguous:
595 rebase rebate
595 rebase rebate
596 [255]
596 [255]
597 $ hg rebat
597 $ hg rebat
598 this is rebate
598 this is rebate
599 $ hg rebat --foo-bar
599 $ hg rebat --foo-bar
600 this is rebate --foo-bar
600 this is rebate --foo-bar
601
601
602 help for a shell alias
602 help for a shell alias
603
603
604 $ hg help -c | grep rebate
604 $ hg help -c | grep rebate
605 rebate This is my alias which just prints something.
605 rebate This is my alias which just prints something.
606 $ hg help rebate
606 $ hg help rebate
607 hg rebate [MYARGS]
607 hg rebate [MYARGS]
608
608
609 shell alias for: echo this is %HG_ARGS% (windows !)
609 shell alias for: echo this is %HG_ARGS% (windows !)
610 shell alias for: echo this is $HG_ARGS (no-windows !)
610 shell alias for: echo this is $HG_ARGS (no-windows !)
611
611
612 This is my alias which just prints something.
612 This is my alias which just prints something.
613
613
614 defined by:* (glob)
614 defined by:* (glob)
615 */* (glob) (?)
615 */* (glob) (?)
616 */* (glob) (?)
616 */* (glob) (?)
617 */* (glob) (?)
617 */* (glob) (?)
618
618
619 (some details hidden, use --verbose to show complete help)
619 (some details hidden, use --verbose to show complete help)
620
620
621 invalid character in user-specified help
621 invalid character in user-specified help
622
622
623 >>> with open('.hg/hgrc', 'ab') as f:
623 >>> with open('.hg/hgrc', 'ab') as f:
624 ... f.write(b'[alias]\n'
624 ... f.write(b'[alias]\n'
625 ... b'invaliddoc = log\n'
625 ... b'invaliddoc = log\n'
626 ... b'invaliddoc:doc = \xc0\n'
626 ... b'invaliddoc:doc = \xc3\xa9\n'
627 ... b'invalidhelp = log\n'
627 ... b'invalidhelp = log\n'
628 ... b'invalidhelp:help = \xc0\n') and None
628 ... b'invalidhelp:help = \xc3\xa9\n') and None
629 $ hg help invaliddoc
629 $ hg help invaliddoc
630 non-ASCII character in alias definition 'invaliddoc:doc'
630 non-ASCII character in alias definition 'invaliddoc:doc'
631 $ hg help invalidhelp
631 $ hg help invalidhelp
632 non-ASCII character in alias definition 'invalidhelp:help'
632 non-ASCII character in alias definition 'invalidhelp:help'
633 $ hg invaliddoc
633 $ hg invaliddoc
634 abort: non-ASCII character in alias definition 'invaliddoc:doc'
634 abort: non-ASCII character in alias definition 'invaliddoc:doc'
635 [255]
635 [255]
636 $ hg invalidhelp
636 $ hg invalidhelp
637 abort: non-ASCII character in alias definition 'invalidhelp:help'
637 abort: non-ASCII character in alias definition 'invalidhelp:help'
638 [255]
638 [255]
639
639
640 invalid arguments
640 invalid arguments
641
641
642 $ hg rt foo
642 $ hg rt foo
643 hg rt: invalid arguments
643 hg rt: invalid arguments
644 hg rt
644 hg rt
645
645
646 alias for: hg root
646 alias for: hg root
647
647
648 (use 'hg rt -h' to show more help)
648 (use 'hg rt -h' to show more help)
649 [255]
649 [255]
650
650
651 invalid global arguments for normal commands, aliases, and shell aliases
651 invalid global arguments for normal commands, aliases, and shell aliases
652
652
653 $ hg --invalid root
653 $ hg --invalid root
654 hg: option --invalid not recognized
654 hg: option --invalid not recognized
655 (use 'hg help -v' for a list of global options)
655 (use 'hg help -v' for a list of global options)
656 [255]
656 [255]
657 $ hg --invalid mylog
657 $ hg --invalid mylog
658 hg: option --invalid not recognized
658 hg: option --invalid not recognized
659 (use 'hg help -v' for a list of global options)
659 (use 'hg help -v' for a list of global options)
660 [255]
660 [255]
661 $ hg --invalid blank
661 $ hg --invalid blank
662 hg: option --invalid not recognized
662 hg: option --invalid not recognized
663 (use 'hg help -v' for a list of global options)
663 (use 'hg help -v' for a list of global options)
664 [255]
664 [255]
665
665
666 environment variable changes in alias commands
666 environment variable changes in alias commands
667
667
668 $ cat > $TESTTMP/expandalias.py <<EOF
668 $ cat > $TESTTMP/expandalias.py <<EOF
669 > import os
669 > import os
670 > from mercurial import cmdutil, commands, registrar
670 > from mercurial import cmdutil, commands, registrar
671 > cmdtable = {}
671 > cmdtable = {}
672 > command = registrar.command(cmdtable)
672 > command = registrar.command(cmdtable)
673 > @command(b'expandalias')
673 > @command(b'expandalias')
674 > def expandalias(ui, repo, name):
674 > def expandalias(ui, repo, name):
675 > alias = cmdutil.findcmd(name, commands.table)[1][0]
675 > alias = cmdutil.findcmd(name, commands.table)[1][0]
676 > ui.write(b'%s args: %s\n' % (name, b' '.join(alias.args)))
676 > ui.write(b'%s args: %s\n' % (name, b' '.join(alias.args)))
677 > os.environ['COUNT'] = '2'
677 > os.environ['COUNT'] = '2'
678 > ui.write(b'%s args: %s (with COUNT=2)\n' % (name, b' '.join(alias.args)))
678 > ui.write(b'%s args: %s (with COUNT=2)\n' % (name, b' '.join(alias.args)))
679 > EOF
679 > EOF
680
680
681 $ cat >> $HGRCPATH <<'EOF'
681 $ cat >> $HGRCPATH <<'EOF'
682 > [extensions]
682 > [extensions]
683 > expandalias = $TESTTMP/expandalias.py
683 > expandalias = $TESTTMP/expandalias.py
684 > [alias]
684 > [alias]
685 > showcount = log -T "$COUNT" -r .
685 > showcount = log -T "$COUNT" -r .
686 > EOF
686 > EOF
687
687
688 $ COUNT=1 hg expandalias showcount
688 $ COUNT=1 hg expandalias showcount
689 showcount args: -T 1 -r .
689 showcount args: -T 1 -r .
690 showcount args: -T 2 -r . (with COUNT=2)
690 showcount args: -T 2 -r . (with COUNT=2)
691
691
692 This should show id:
692 This should show id:
693
693
694 $ hg --config alias.log='id' log
694 $ hg --config alias.log='id' log
695 000000000000 tip
695 000000000000 tip
696
696
697 This shouldn't:
697 This shouldn't:
698
698
699 $ hg --config alias.log='id' history
699 $ hg --config alias.log='id' history
700
700
701 $ cd ../..
701 $ cd ../..
702
702
703 return code of command and shell aliases:
703 return code of command and shell aliases:
704
704
705 $ hg mycommit -R alias
705 $ hg mycommit -R alias
706 nothing changed
706 nothing changed
707 [1]
707 [1]
708 $ hg exit1
708 $ hg exit1
709 [1]
709 [1]
710
710
711 #if no-outer-repo
711 #if no-outer-repo
712 $ hg root
712 $ hg root
713 abort: no repository found in '$TESTTMP' (.hg not found)!
713 abort: no repository found in '$TESTTMP' (.hg not found)!
714 [255]
714 [255]
715 $ hg --config alias.hgroot='!hg root' hgroot
715 $ hg --config alias.hgroot='!hg root' hgroot
716 abort: no repository found in '$TESTTMP' (.hg not found)!
716 abort: no repository found in '$TESTTMP' (.hg not found)!
717 [255]
717 [255]
718 #endif
718 #endif
General Comments 0
You need to be logged in to leave comments. Login now