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