mercurial/lock.py
changeset 8113 87a1605979e4
parent 8108 a26d33749bd8
child 8225 46293a0c7e9f
equal deleted inserted replaced
8112:6ee71f78497c 8113:87a1605979e4
     4 #
     4 #
     5 # This software may be used and distributed according to the terms
     5 # This software may be used and distributed according to the terms
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 
     7 
     8 import errno, os, socket, time, util, error
     8 import errno, os, socket, time, util, error
       
     9 import warnings
     9 
    10 
    10 class lock(object):
    11 class lock(object):
    11     # lock is symlink on platforms that support it, file on others.
    12     # lock is symlink on platforms that support it, file on others.
    12 
    13 
    13     # symlink is used because create of directory entry and contents
    14     # symlink is used because create of directory entry and contents
    26         self.desc = desc
    27         self.desc = desc
    27         self.lock()
    28         self.lock()
    28 
    29 
    29     def __del__(self):
    30     def __del__(self):
    30         if self.held:
    31         if self.held:
       
    32             warnings.warn("use lock.release instead of del lock",
       
    33                     category=DeprecationWarning,
       
    34                     stacklevel=2)
       
    35 
    31             # ensure the lock will be removed
    36             # ensure the lock will be removed
    32             # even if recursive locking did occur
    37             # even if recursive locking did occur
    33             self.held = 1
    38             self.held = 1
    34 
    39 
    35         self.release()
    40         self.release()