Mercurial > hg
comparison mercurial/localrepo.py @ 23648:915ac9403e13
pushkey: run hook after the lock release
The pushkey operation used to be in its own wireprotocol command and (in
practice) always be lock free when running the hook. With bundle2, it happen in
a greater scheme and a hook running locking command would get stuck. We now run
such hooks after the lock release as similar hook do.
Bundle2 test are altered to ensure we are lockfree at hook running time.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 22 Dec 2014 15:48:39 -0800 |
parents | b9af235810cc |
children | 965788d9ae09 |
comparison
equal
deleted
inserted
replaced
23647:eb55e09202c8 | 23648:915ac9403e13 |
---|---|
1783 if exc.hint: | 1783 if exc.hint: |
1784 self.ui.write_err(_("(%s)\n") % exc.hint) | 1784 self.ui.write_err(_("(%s)\n") % exc.hint) |
1785 return False | 1785 return False |
1786 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) | 1786 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) |
1787 ret = pushkey.push(self, namespace, key, old, new) | 1787 ret = pushkey.push(self, namespace, key, old, new) |
1788 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new, | 1788 def runhook(): |
1789 ret=ret) | 1789 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new, |
1790 ret=ret) | |
1791 self._afterlock(runhook) | |
1790 return ret | 1792 return ret |
1791 | 1793 |
1792 def listkeys(self, namespace): | 1794 def listkeys(self, namespace): |
1793 self.hook('prelistkeys', throw=True, namespace=namespace) | 1795 self.hook('prelistkeys', throw=True, namespace=namespace) |
1794 self.ui.debug('listing keys for "%s"\n' % namespace) | 1796 self.ui.debug('listing keys for "%s"\n' % namespace) |