[rfc] Allow action parameter to smart_add to return a file_id

John Arbash Meinel john at arbash-meinel.com
Wed Jul 19 18:31:51 BST 2006


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

I have a use case of wanting to be able to create a new tree with the
same file ids as another tree (or subset of the other tree). I used to
do this with a custom Action object, which would grab the file id when
it went to add the entry to the inventory.

Since we now always add the object to the inventory (in __add_one), it
would be nice to have ability to customize file id generation.

My 'add_from' plugin:
http://bzr.arbash-meinel.com/plugins/add_from

Basically hijacks the current __add_one function to add this
functionality. But rather than monkey patching, the attached diff does
what I need.

I already have tests for it, since I'm using it in my add_from branch,
so I would be happy to update bzr.dev, with tests.

And the changes to the Action object, are only for sanitary purposes.
(you always implicitly return None, but since we now expect a result,
explicitly do so).

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEvmyGJdeBCYSNAAMRApRxAKCUW/bBOZPowzhwgYw/Nh8Y5Ce8jACgpmi/
YfRftJlGer/i4haluV31BkI=
=Td50
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: allow_add_to_give_id.diff
Type: text/x-patch
Size: 1023 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060719/edd7a1bf/attachment.bin 


More information about the bazaar mailing list