[MERGE] add a hook for Branch.set_last_revision_info()

James Henstridge james at jamesh.id.au
Wed Apr 9 04:26:17 BST 2008


On 08/04/2008, Andrew Bennetts <andrew at canonical.com> wrote:
> I do prefer Ian's API.  As a general rule, passing an object rather than a bunch
>  of simple arguments to a plugin is a much more flexible API:
>
>   - it's easy to extend the interface of the object without breaking existing
>    plugins.
>   - not all plugins that use a hook will necessarily need all the information.
>    An object can provide methods to retrieve information which might be
>    expensive to calculate, so plugins don't pay the price for details they don't
>    use.
>
>  Also, specifically for this hook, I think it is important that the previous tip
>  revision info is accessible to the hook.  That will make it possible to enforce
>  a particular policy (e.g. all .xml files must be well formed, or no tabs in .py,
>  etc) for all revisions on a branch, even when a push adds multiple revisions in
>  a single operation.  Similarly it makes it possible to generate sensible
>  commit-like emails when there are multiple commits — or an uncommit.
>
>  That said, tests are important!  Any chance you could make a patch that combines
>  the best of both worlds?  :)

Attached is a merge of my branch and Ian's (it is primarily Ian's API
and documentation with my tests).

I also cleaned up a few bugs in Ian's branch that the tests showed up.
 I also changed the ordering of the revno and revision_id arguments to
_make_branch_tip_hook_params() to match set_last_revision_info():
using different orders in different places is asking for trouble.

James.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr-post-change-branch-tip.patch
Type: text/x-diff
Size: 20076 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080409/8cfaf69e/attachment-0001.bin 


More information about the bazaar mailing list