[PATCH] Infer a --repository argument from command arguments when reasonable

Jesse Glick jesse.glick at sun.com
Tue Jan 29 19:35:34 CST 2008

Thomas Arendsen Hein wrote:
> This might be too much magic.

Why? Subversion does it and no one seems to complain.

> People should be aware in which repository they are working.

I am quite aware of which repository I am working in. But sometimes it 
is nice to type

hg ann ../../hgforest/forest.py

instead of the redundant

hg -R ../../hgforest ann ../../hgforest/forest.py

You can of course use

hg --cwd ../../hgforest ann forest.py


(cd ../../hgforest; hg ann forest.py)

but this is not friendly to shell filename completion.

> Additionally this will always be inconsistent with nested repos

Why? The patch is only triggered if the hg command would otherwise have 
aborted. In particular, if you are inside a repo now, it will never take 
effect. I don't see what problem there would be with nested repos.

> and with commands accepting two paths, e.g. hg mv repo1/foo repo2/foo

You can't move a file from one repo to another with this command anyway, 
AFAIK, and even if you could the patch would have no effect on such a 
command because it involves paths in two repos.

More information about the Mercurial-devel mailing list