demandimport and ldap hook
mpm at selenic.com
Wed Jun 22 16:36:42 CDT 2011
On Wed, 2011-06-22 at 02:48 -0700, JamieEchlin wrote:
> First post so please advise if this is better posted to the general forum.
> I am trying to write an "in-process" hook that will validate that each
> author in a change group is a member of a particular ldap group.
> I am using python-ldap. When the hook runs I get the error:
> ImportError: No module named pyasn1.type
> After some experimentation I found that it works if at the top of my hook
> script I use:
> from mercurial import demandimport; demandimport.disable()
> Are there any negative consequences to doing this, or should this be done a
> better way?
It will make Mercurial startup substantially slower:
! wall 0.028465 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
! wall 0.085481 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
It may also outright break in the future as demandimport tends to hide
various import ordering issues.
The right way is to add entries to demandimport's blacklist.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel