bzr add

Robey Pointer robey at lag.net
Wed Aug 24 17:17:18 BST 2005


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


On 23 Aug 2005, at 23:48, Michael Ellerman wrote:

> On Wed, 24 Aug 2005 15:44, Robey Pointer wrote:
>
>> On 23 Aug 2005, at 17:00, Johan Rydberg wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Robey Pointer <robey at lag.net> writes:
>>>
>>>> It looks like "bzr add <folder>" adds not just the folder, but
>>>> everything in it.  But sometimes I only want to add *some*  
>>>> things in
>>>> the folder (for example, not .pyc files).  bzr is giving an  
>>>> error on
>>>> attempts to do these partial adds:
>>>>
>>>
>>> I suggest you look at "bzr add --help" and specially for the
>>> - --no-recurse option.
>>>
>>
>> Well, that's surprising enough. :)
>>
>> The default behavior for commands (ie, the behavior with no options)
>> should be the simplest or least surprising.
>>
>> The attached patch fixes "add" to default to non-recursive, using -R
>> or --recurse to get recursive behavior, and fixes the tests to
>> follow.  It also gets rid of a double negative. :)
>>
>
> I think that's really bad UI. I wrote about it before, but Google  
> can't seem
> to find it, so here from my sent-mail:
>
> I don't see the point of non-recursive mode.
>
> If you think about it, you don't care about versioning directories,  
> you care
> about the files in them. You would never add a directory and then  
> not add a
> file in it later (usually straight away).
>
> Other SCMs make you do this stupid dance:
>
> # scm add subdir/bar/foo.file
> ERROR: subdir/bar is not versioned!
> # scm add subdir/bar
> ERROR: subdir is not versioned
> # scm add subdir
> A       subdir
> # scm add subdir/bar
> A       subdir/bar
> # scm add subdir/bar/foo.file
> A       subdir/bar/foo.file
>
> bzr's smart enough (well it will be [1]) to work out that if you're  
> asking to
> add a file then you implicitly want its parents to be versioned too.
>
> So you just get:
>
> # bzr add subdir/bar/foo.file -v
> A       subdir
> A       subdir/bar
> A       subdir/bar/foo.file
>
> And so you never need to call 'bzr add directory' directly. Which  
> means if you
> *do* run 'bzr add directory' the only useful thing for it to mean  
> is 'add
> that directory and all the files under it'.
>
> [1] Seems this hasn't quite got implemented yet

Okay, you've convinced me.  The real problem was:

$ bzr add a/b/c
bzr: error: puke
(me: "i guess i have to add them manually")
$ bzr add a
adding 23GB of files...
(me: "aieeeeee!")

So once your patch is taken, the original error won't happen, and I  
would probably never try to add a folder by itself unless I wanted it  
to recurse.

It's worth noting, however, that having "--recurse" as the default  
behavior is the opposite of most Unix CLI tools, so it will probably  
surprise people when they first learn bzr.

robey

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)

iD8DBQFDDJ2SQQDkKvyJ6cMRAhaMAJ45KQHtN+iNTGJC6MyIEW/JVKvtfACgtkTw
ZQwKll7JCW7o0ch6znO+c9w=
=GPSe
-----END PGP SIGNATURE-----




More information about the bazaar mailing list