Mercurial Digest, Vol 28, Issue 41

Maxim Khitrov mkhitrov at gmail.com
Sat Aug 25 18:15:36 CDT 2007


On 8/25/07, Brian Baker <brian_e_baker at yahoo.com> wrote:
> > Second, I'm actually not sure what it
> > is that you want hg add to do... I started using mercurial about 3
> > months ago and have never been surprised by any functionality,
> > including hg add. Everything worked exactly as I expected it to. If
> > you read the documentation you should have no surprises.
> > Third, what do you mean by default behavior? Using hg add with no
> > parameters? Yes, I use that constantly. I don't think I've ever had
> to
> > specify a parameter when doing hg add. Run hg status to see what is
> > about to happen then run hg add or hg addremove to get your files in
> > and/or out of the repository. If you don't want something added,
> > create hgignore rules.
>
> Due to working practices beyond my control I want to be able to use
> mercurial in a 'lightweight' way. I've got a big source tree with lots
> of files, and I want to version control just the ones that I edit.
> These files are spread fairly sparsely through the large tree, I add
> each file that I edit.
>
> hg add with no arguments adds everything
> there isn't an unadd command
> One typo and its a headache to tidy up.
>
> I appreciate that this isn't the 'normal' way of using Mercurial.
> However, the fact that the add command default behaviour can cause wide
> ranging changes that can't be readily undone says to me that perhaps
> the interface should be reconsidered.
>
> With CVS at least you can manually edit the files used to manage the
> repository to unadd files before a commit.
>
> Brian

hg revert is more than happy to unadd files. If you run hg add in a
brand new repository, simply run hg revert --all. Your repository is
now back in the original state. Here's a way to revert files even if
there are others with changed status:

hg status | grep '^A' | sed 's/A //' | xargs hg revert

Might be an easier way to do this, but you get the idea. Nothing
difficult about removing files if they were added accidentally. And
while a change to hg add would make your non-normal, as you say, way
of using mercurial easier, it would require many others (including
myself) to perform additional work for something that works perfectly
well right now.

- Max


More information about the Mercurial mailing list