Let "hg add" do nothing

Steffen Kaiser skhg at smail.inf.fh-bonn-rhein-sieg.de
Wed Aug 22 10:33:15 CDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 21 Aug 2007, Boris Samorodov wrote:

Well, first of all, I did not expected that "hg add" (no args) does 
anything at all, except to tell me the help options; I had no such problem 
with subversion, cvs or bzr.

That "hg add" is not "hg add ." was even more surprising, I understand why 
"hg commit" uses the repo root, but even "hg st" hits me by surprise now 
and then.

My bad experiences with "hg add"  == "hg add $(hg root)" comes from these 
situations:

+ scripts that return nothing, e.g.
hg add $(hg st -un | grep pattern)

+ mistyping: at least two times I typed
hg add
instead of
hg commit

+ Some occurences of bad selections with Copy'n'Paste and not waiting for 
<TAB>-Expansion to complete (not correctly hitting the key).

+ One or two situations "that can happen in computer space", such as a 
broken SSH connection.

Unfortunately "hg revert $(hg st -an)" does not revert the last "hg add". 
However, in all cases I was able to revert the add manually.

> I'm also concerned about current behaviour. What about:
> $ hg add
> <add nothing, display a message>
> $ hg add .
> <add new files recursevly starting from the current directory>
> $ hg add --all
> <add all files at the hg repository>

Any of these suggestions would make the command more "consistently" to my 
feel "right", however, because the backward compatibly has been mentioned.
Currently the defaults are added to any command line before any command 
line argument, when there would be an option "--help-if-no-argument", you 
can set this as "default" for those commands (add, ...) in your hgrc.
So one has the "hg add" => does nothing harmful condition.

Regards,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGzFc9IE0teHb4Zi4RAg/cAKCuJtEHNb8QoebJ1YmOZOCA3emj4wCfY15n
AXjw0sPtZN/7DCVLvHCPqqM=
=xQeB
-----END PGP SIGNATURE-----


More information about the Mercurial mailing list