Wrap entire commit in wlock kwmap-templates
authorChristian Ebert <blacktrash@gmx.net>
Thu, 15 Feb 2007 09:25:05 +0100
branchkwmap-templates
changeset 145 1c2cefa97b96
parent 144 19b3d1de3db0
child 146 df9de07ce002
Wrap entire commit in wlock Message-ID: <20070213102701.GC30656@cecm.usp.br>
hgkw/keyword.py
--- a/hgkw/keyword.py	Wed Feb 14 03:03:16 2007 +0100
+++ b/hgkw/keyword.py	Thu Feb 15 09:25:05 2007 +0100
@@ -228,32 +228,31 @@
                 force_editor=False, p1=None, p2=None, extra={}):
             '''Wraps commit, expanding keywords of committed and
             configured files in working directory.'''
-
-            removed = self.status()[2]
-
-            node = super(kwrepo, self).commit(files=files,
-                    text=text, user=user, date=date,
-                    match=match, force=force, lock=lock, wlock=wlock,
-                    force_editor=force_editor, p1=p1, p2=p2, extra=extra)
-            if node is None:
-                return node
-
-            candidates = self.changelog.read(node)[3]
-            candidates = [f for f in candidates if f not in removed
-                    and not self._link(f) and self.kwfmatcher(f)]
-            if not candidates:
-                return node
-
             wrelease = False
             if not wlock:
                 wlock = self.wlock()
                 wrelease = True
             try:
+                removed = self.status()[2]
+
+                node = super(kwrepo, self).commit(files=files,
+                        text=text, user=user, date=date,
+                        match=match, force=force, lock=lock, wlock=wlock,
+                        force_editor=force_editor, p1=p1, p2=p2, extra=extra)
+                if node is None:
+                    return node
+
+                candidates = self.changelog.read(node)[3]
+                candidates = [f for f in candidates if f not in removed
+                        and not self._link(f) and self.kwfmatcher(f)]
+                if not candidates:
+                    return node
+
                 kwt = kwtemplater(self.ui, self)
                 kwt.overwrite(candidates, node)
+                return node
             finally:
                 if wrelease:
                     wlock.release()
-            return node
 
     repo.__class__ = kwrepo