view tests/test-alias.out @ 11695:ee8f36a6c766

alias: improved diagnostic when arguments include --cwd, etc. The logic pre-emptively checks for -R, --repo, --repository and --cwd in order to give the user a more helpful error message. In addition, each option is handled invididually, which avoids listing them all in the error. Before: % hg --config alias.broken='push --cwd /dev/null' broken abort: Option --cwd may not be abbreviated! After: % hg --config alias.broken='push --cwd /dev/null' broken error in definition for alias 'broken': --cwd may only be given on the command line
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 27 Jul 2010 14:43:40 +0200
parents c5e555e064d0
children
line wrap: on
line source

% basic
% unknown
alias 'unknown' resolves to unknown command 'bargle'
alias 'unknown' resolves to unknown command 'bargle'
% ambiguous
alias 'ambiguous' resolves to ambiguous command 's'
alias 'ambiguous' resolves to ambiguous command 's'
% recursive
alias 'recursive' resolves to unknown command 'recursive'
alias 'recursive' resolves to unknown command 'recursive'
% no definition
no definition for alias 'nodefinition'
no definition for alias 'nodefinition'
% invalid options
error in definition for alias 'no--cwd': --cwd may only be given on the command line
error in definition for alias 'no--cwd': --cwd may only be given on the command line
error in definition for alias 'no-R': -R may only be given on the command line
error in definition for alias 'no-R': -R may only be given on the command line
error in definition for alias 'no--repo': --repo may only be given on the command line
error in definition for alias 'no--repo': --repo may only be given on the command line
error in definition for alias 'no--repository': --repository may only be given on the command line
error in definition for alias 'no--repository': --repository may only be given on the command line
% no usage
no rollback information available
adding foo
% with opts
C foo
% with opts and whitespace
0 e63c23eaa88a | 1970-01-01 00:00 +0000
% interaction with defaults
0:e63c23eaa88a
-1:000000000000
% properly recursive
changeset:   -1:0000000000000000000000000000000000000000
parent:      -1:0000000000000000000000000000000000000000
parent:      -1:0000000000000000000000000000000000000000
manifest:    -1:0000000000000000000000000000000000000000
user:        
date:        Thu Jan 01 00:00:00 1970 +0000
extra:       branch=default

% path expanding
# HG changeset patch
# User test
# Date 0 0
# Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
# Parent  0000000000000000000000000000000000000000
foo

diff -r 000000000000 -r e63c23eaa88a foo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/foo	Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+foo
% shell aliases
foo
% invalid arguments
hg rt: invalid arguments
hg rt 

alias for: hg root

print the root (top) of the current working directory

    Print the root directory of the current repository.

    Returns 0 on success.

use "hg -v help rt" to show global options