hg add default behaviour...

Maxim Khitrov mkhitrov at gmail.com
Thu Aug 23 15:57:35 CDT 2007


On 8/23/07, Brian Baker <brian_e_baker at yahoo.com> wrote:
>
> On 2007.08.22 15:01, Brian Baker wrote:
> >
> > +tan(90)
> >
> > The way I see it 'hg add' with no arguments doesn't fit the principle
> > of least suprise.
>
> So then "hg commit" with no arguments should also do nothing, right?
>
> Surely the things that are committed have already been queued up?
> We don't want to queue up a load of garbage and not have a simple way
> of removing it!
>
> >
> > In fact being a newcomer to Mercurial I'd be very suprised if a bunch
> > of objects and other generated files got added to my repo all of a
> > sudden. If I do a 'hg add' in new directory I'd just made with a
>  couple
> > of source files in, I wouldn't expect stuff from all over the
> > repository to get added.
> >
> > I say hang backwards compatibility, and make the default behaviour
> > sane.Now is the time to do it as Mercurial hasn't got to version 1. I
>
> > too
> > would like to know who relies on the wacky default behaviour of add.
>
> I'd like to know why I'm getting to read the views of a bunch of idiots
> who can't seem to remember how "hg add" works.
>
> Its because you have subscribed to the discussion mailing list....
>
> It is insulting and idiotic on your part, the fact of the matter is
> that hg add's behaviour is suprising. Even if *you* think that we're a
> bunch of idiots!
>
> The question still stands, who relies on the default behaviour?
> And why not change it, us idiots would welcome some sanity!
> Just because we're idiots doesn't mean we're mental!
>
> Brian

First of all, responding to a rude comment with a rude comment of your
own rarely helps your position. 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.

For example, I run several FreeBSD servers on which mercurial is used
to keep track of all configuration files. The repository is located in
/.hg, and I configured ignore rules such that only files in /etc and
/usr/local/etc and added. Install a new piece of software, run hg add
to import the default configuration, edit configuration and commit the
changes. For me, it's been a great way to keep your systems healthy
and track all the important configuration changes. I use the exact
same behavior when working on programming projects. See absolutely no
reason why hg add should behave any differently.

- Max


More information about the Mercurial mailing list