diff hgext/keyword.py @ 9096:47bc92755b95

keyword: eliminate potential reference cycles from kwrepo - delete kwrepo.commitctx after using the tweaked version - prefer self.hook over repo.hook to avoid nesting Also pass arguments to commit as arbitrary list. Thanks to Simon Heimberg and Matt Mackall for guidance.
author Christian Ebert <blacktrash@gmx.net>
date Thu, 09 Jul 2009 11:59:12 +0200
parents 23e941d7f507
children bbc78cb1bf15 3ef6c14a1e8e
line wrap: on
line diff
--- a/hgext/keyword.py	Wed Jul 08 22:08:45 2009 -0400
+++ b/hgext/keyword.py	Thu Jul 09 11:59:12 2009 +0200
@@ -459,13 +459,14 @@
             data = super(kwrepo, self).wread(filename)
             return kwt.wread(filename, data)
 
-        def commit(self, text='', user=None, date=None, match=None,
-                   force=False, editor=None, extra={}):
+        def commit(self, *args, **opts):
             # use custom commitctx for user commands
             # other extensions can still wrap repo.commitctx directly
-            repo.commitctx = self.kwcommitctx
-            return super(kwrepo, self).commit(text, user, date, match, force,
-                         editor, extra)
+            self.commitctx = self.kwcommitctx
+            try:
+                return super(kwrepo, self).commit(*args, **opts)
+            finally:
+                del self.commitctx
 
         def kwcommitctx(self, ctx, error=False):
             wlock = lock = None
@@ -489,7 +490,7 @@
                 if commithooks:
                     for name, cmd in commithooks.iteritems():
                         ui.setconfig('hooks', name, cmd)
-                    repo.hook('commit', node=n, parent1=xp1, parent2=xp2)
+                    self.hook('commit', node=n, parent1=xp1, parent2=xp2)
                 return n
             finally:
                 release(lock, wlock)