diff mercurial/lock.py @ 8113:87a1605979e4

add a deprecation warning for gc based lock releasing
author Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
date Wed, 22 Apr 2009 02:01:22 +0200
parents a26d33749bd8
children 46293a0c7e9f
line wrap: on
line diff
--- 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