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