[PATCH] send external diff to a file (bug 4047)

Robert Collins robertc at robertcollins.net
Fri May 5 08:25:17 BST 2006


On Fri, 2006-05-05 at 17:21 +1000, Martin Pool wrote:
> On 05/05/2006, at 5:12 PM, James Henstridge wrote:
> 
> >
> > [...]
> >> These imports should really happen at the module level, not inside  
> >> the
> >> diff function.
> >
> > Is this a new coding guideline for bzr?  I noticed a lot of other
> > functions that contain imports (including this one), so I just
> > followed the existing style.  I guessed that this was to remove the
> > cost of the imports if the function in question did not get called.
> >
> > If the recommended style has changed, I can fix things up.
> 
> The general rule is to put them at the top level unless either:
> 
>   - importing them later would substantially reduce the cost

[..] of an 'bzr help' or similarly trivial run of bzr.

>   - or importing them later is the best way to resolve a dependency  
> cycle

One thing to be cautious of is that having them in a commonly called
function (like bzrlib.trace.note) will lead to dramatic slowdowns,
because of the synchronisation point at every execution of that routine.

Rob


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060505/a1cbbba1/attachment.pgp 


More information about the bazaar mailing list