add a deprecation warning for gc based lock releasing
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
Wed, 22 Apr 2009 02:01:22 +0200
changeset 8113 87a1605979e4
parent 8112 6ee71f78497c
child 8114 ad3ba2de2cba
add a deprecation warning for gc based lock releasing
mercurial/lock.py
--- a/mercurial/lock.py	Wed Apr 22 02:01:22 2009 +0200
+++ b/mercurial/lock.py	Wed Apr 22 02:01:22 2009 +0200
@@ -6,6 +6,7 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 import errno, os, socket, time, util, error
+import warnings
 
 class lock(object):
     # lock is symlink on platforms that support it, file on others.
@@ -28,6 +29,10 @@
 
     def __del__(self):
         if self.held:
+            warnings.warn("use lock.release instead of del lock",
+                    category=DeprecationWarning,
+                    stacklevel=2)
+
             # ensure the lock will be removed
             # even if recursive locking did occur
             self.held = 1