hg add default behaviour...

Dan North dan at tastapod.com
Thu Aug 23 16:54:22 CDT 2007


I'm another Mercurial newbie. (It's a great tool - thanks!)

I've been playing with darcs and someone suggested I look at hg too. So
far I'm really impressed. The only surprise is the way in which a new
repository handles un-added files.

There isn't a default "sensible" list of ignores to populate a new
.hgignore file. This compounded with hg add's unintuitive behaviour
means the initial hg add will happily consume all sorts of nonsense.

The ironic - and non-intuitive - thing is you get this sequence:

$ hg add
adding unwanted.o
adding .svn/whatever

[ oops - didn't mean to do that, still, I can always revert ]

$ hg revert
abort: no files or directories specified; use --all to revert the whole repo

Hmm!

btw my current use case is to use an hg repository on top of a
subversion checkout to be able to work offline between subversion
commits, which is working out really nicely.


Brian Baker wrote:
> +tan(90)
>
> The way I see it 'hg add' with no arguments doesn't fit the principle
> of least suprise. 
>
> 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.
>
> Use:
> hg add --repo[sitory] 
>
> For a command line version of getting to the old behaviour, and give a
> helpful message if no arguments are used with add.
>
> I prefer --repository to --all, as all could be construde to mean all
> files in the present directory.
>
> If we really must maintain existing behaviour for the sake of backwards
> compatibility use a .hg configuration flag to allow the 'extreme'
> behaviour we have at the moment, please don't keep it as the default.
>
> Brian
>
>
>       ___________________________________________________________
> Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
> now.
> http://uk.answers.yahoo.com/ 
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>   



More information about the Mercurial mailing list