--- a/hgkw/keyword.py Wed Jan 10 18:52:09 2007 +0100
+++ b/hgkw/keyword.py Thu Jan 11 02:22:56 2007 +0100
@@ -129,10 +129,16 @@
filelog.filelog = kwfilelog
repo.__class__ = kwrepo
- # import keyword from pretxncommit hook even if it is not in hgext folder
- sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
- ui.setconfig('hooks', 'pretxncommit.keyword', 'python:%s.pretxnkw'
- % os.path.splitext(os.path.basename(__file__))[0])
+ # make pretxncommit hook import kwmodule regardless of where it's located
+ moddir = os.path.abspath(os.path.dirname(__file__))
+ if os.path.dirname(moddir) in sys.path:
+ moddir = os.path.split(moddir)[1]+'.'
+ else:
+ sys.path.insert(0, moddir)
+ moddir = ''
+ ui.setconfig('hooks', 'pretxncommit.keyword', 'python:%s%s.pretxnkw'
+ % (moddir, os.path.splitext(os.path.basename(__file__))[0]))
+ del moddir
def pretxnkw(ui, repo, hooktype, **args):