Remove spurious NameError checking for locks
authorChristian Ebert <blacktrash@gmx.net>
Tue, 21 Aug 2007 13:27:48 +0200
changeset 229 8e5ba738e36d
parent 228 88362a9b5afd
child 230 9fe9a9839387
Remove spurious NameError checking for locks Overriding commit sets them to None by default already.
hgkw/keyword.py
--- a/hgkw/keyword.py	Mon Aug 20 05:08:39 2007 +0200
+++ b/hgkw/keyword.py	Tue Aug 21 13:27:48 2007 +0200
@@ -461,24 +461,23 @@
         def commit(self, files=None, text='', user=None, date=None,
                    match=util.always, force=False, lock=None, wlock=None,
                    force_editor=False, p1=None, p2=None, extra={}):
+            # (w)lock arguments removed in 126f527b3ba3
+            # so they are None or what was passed to commit
+            # use private _(w)lock for deletion
+            _lock = lock
+            _wlock = wlock
+            del wlock, lock
             try:
-                kwlock = lock
-                kwwlock = wlock
-                del wlock, lock
-            except NameError:
-                # (w)lock arguments removed in recent Hg versions
-                kwwlock = kwlock = None
-            try:
-                if not kwwlock:
-                    kwwlock = self.wlock()
-                if not kwlock:
-                    kwlock = self.lock()
+                if not _wlock:
+                    _wlock = self.wlock()
+                if not _lock:
+                    _lock = self.lock()
                 try:
                     node = super(kwrepo,
                                  self).commit(files=files, text=text,
                                               user=user, date=date,
                                               match=match, force=force,
-                                              lock=kwlock, wlock=kwwlock,
+                                              lock=_lock, wlock=_wlock,
                                               force_editor=force_editor,
                                               p1=p1, p2=p2, extra=extra)
                 except TypeError:
@@ -498,7 +497,7 @@
                         kwt.overwrite(candidates, mn, commit)
                 return node
             finally:
-                del kwwlock, kwlock
+                del _wlock, _lock
 
     repo.__class__ = kwrepo