why does bazaar not add a file automatically on the first commit

Wichmann, Mats D mats.d.wichmann at intel.com
Tue Apr 22 22:51:14 BST 2008


Matt Nordhoff wrote:
> Rahul Nabar wrote:
>> I find myself repeating this cycle so often that I wonder there
>> isn't a combined command / option. 
>> 
>> #made a new file foo.cfg
>> bzr commit ~/foo.cfg
>> bzr: ERROR: Path(s) are not versioned: ~/foo.cfg
>> bzr add ~/foo.cfg
>> bzr commit ~/foo.cfg
>> 
>> If a user requests a commit and the file is not being tracked why
>> doesn't bazaar automatically add it  rather than complain? If the
>> user demanded a commit it is reasonable to assume he wants that file
>> added? Perhaps with some option --force etc. Is that a feature  /
>> bug? Maybe there's some subtlety I am not aware of! Just curious!
>> 
>> I must mention that I've a .bzrignore set to * since I'm using it to
>> version scattered scripts and config files across my system.
> 
> FWIW, hg has a -A/--addremove argument to commit. (It also has an
> addremove command.)
> 
> Automatically adding files when they are specified on the command line
> is a neat idea though. Except, you could do "bzr commit *" or
> something and accidentally add files you don't want. There could be a
>  heuristic to not add files when a ton of them are specified, or the
> entire directory, or something.

I personally agree it makes sense to add files when specified
by name, and perhaps directory (+contents) when specified by name.
But not otherwise. For example, if I just say "bzr commit" inside
a branch, it should not make assumptions. I've just recovered from 
a mistake I made where several files were auto-removed because 
they weren't present in a directory when I committed a change. 
There were no warnings; I'd rather have an error in this situation
and have to do something explicit to commit anyway.  As it is,
it requires me to do extra work to confirm that something isn't
going to happen by mistake. In fact, I'll take this moment to 
declare that this is a Horrible Mistfeature, Please Put It Back 
The Way It Was!!!!  It completely violates the principle of
"No Surprises".  





More information about the bazaar mailing list