comparison hgext/evolve.py @ 1255:a2d4901e211e stable

commit: avoid potential deadlock We must acquire 'wlock' before 'lock'.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 20 Apr 2015 13:47:04 +0200
parents d03583da89c4
children f8cb01637e75
comparison
equal deleted inserted replaced
1254:87d626390270 1255:a2d4901e211e
2037 lockmod.release(tr, lock, wlock) 2037 lockmod.release(tr, lock, wlock)
2038 2038
2039 @eh.wrapcommand('commit') 2039 @eh.wrapcommand('commit')
2040 def commitwrapper(orig, ui, repo, *arg, **kwargs): 2040 def commitwrapper(orig, ui, repo, *arg, **kwargs):
2041 if kwargs.get('amend', False): 2041 if kwargs.get('amend', False):
2042 lock = None 2042 wlock = lock = None
2043 else: 2043 else:
2044 wlock = repo.wlock()
2044 lock = repo.lock() 2045 lock = repo.lock()
2045 try: 2046 try:
2046 obsoleted = kwargs.get('obsolete', []) 2047 obsoleted = kwargs.get('obsolete', [])
2047 if obsoleted: 2048 if obsoleted:
2048 obsoleted = repo.set('%lr', obsoleted) 2049 obsoleted = repo.set('%lr', obsoleted)
2062 repo._bookmarks.write() 2063 repo._bookmarks.write()
2063 return result 2064 return result
2064 finally: 2065 finally:
2065 if lock is not None: 2066 if lock is not None:
2066 lock.release() 2067 lock.release()
2068 if wlock is not None:
2069 wlock.release()
2067 2070
2068 @command('^touch', 2071 @command('^touch',
2069 [('r', 'rev', [], 'revision to update'), 2072 [('r', 'rev', [], 'revision to update'),
2070 ('D', 'duplicate', False, 2073 ('D', 'duplicate', False,
2071 'do not mark the new revision as successor of the old one')], 2074 'do not mark the new revision as successor of the old one')],