hgkw/keyword.py
branchkwmap-templates
changeset 126 47b45198a30d
parent 123 6cf933de685a
child 128 fe37939db543
--- a/hgkw/keyword.py	Thu Feb 08 06:45:12 2007 +0100
+++ b/hgkw/keyword.py	Thu Feb 08 06:52:40 2007 +0100
@@ -72,11 +72,9 @@
 '''
  
 from mercurial.i18n import gettext as _
-# above line for backwards compatibility; can be changed to
-#   from mercurial.i18n import _
-# some day
+# above line for backwards compatibility of standalone version
+from mercurial import commands, cmdutil, templater, util
 from mercurial import context, filelog, revlog
-from mercurial import commands, cmdutil, templater, util
 from mercurial.node import bin
 import os.path, re, sys, time
 
@@ -98,9 +96,7 @@
     '''Makes sure pretxncommit-hook can import keyword module
     regardless of where its located.'''
     for k, v in sys.modules.iteritems():
-        if v is None:
-            continue
-        if not hasattr(v, '__file__'):
+        if v is None or not hasattr(v, '__file__'):
             continue
         if v.__file__.startswith(__file__):
             return k
@@ -121,7 +117,6 @@
                 '|'.join(re.escape(k) for k in self.templates.keys()))
         templater.common_filters['utcdate'] = utcdate
         self.t = cmdutil.changeset_templater(ui, repo, False, '', False)
-            
 
     def expand(self, mobj, path, node):
         '''Expands keyword using corresponding template.'''