Mercurial > hg
comparison mercurial/localrepo.py @ 23416:53a65929ef1f stable
pushkey: gracefully handle prepushkey hook failure (issue4455)
This allow to gracefully report the failure of the bookmark push and carry on.
Before this change set. Local push would plain quit and wireprotocol would
failed in various ungraceful way.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 29 Nov 2014 19:17:47 -0800 |
parents | eb315418224c |
children | 19ebd2f88fc7 |
comparison
equal
deleted
inserted
replaced
23415:cdbb85489c41 | 23416:53a65929ef1f |
---|---|
1752 finally: | 1752 finally: |
1753 self.ui.restoreconfig(quiet) | 1753 self.ui.restoreconfig(quiet) |
1754 return ret | 1754 return ret |
1755 | 1755 |
1756 def pushkey(self, namespace, key, old, new): | 1756 def pushkey(self, namespace, key, old, new): |
1757 self.hook('prepushkey', throw=True, namespace=namespace, key=key, | 1757 try: |
1758 old=old, new=new) | 1758 self.hook('prepushkey', throw=True, namespace=namespace, key=key, |
1759 old=old, new=new) | |
1760 except error.HookAbort, exc: | |
1761 self.ui.write_err(_("pushkey-abort: %s\n") % exc) | |
1762 if exc.hint: | |
1763 self.ui.write_err(_("(%s)\n") % exc.hint) | |
1764 return False | |
1759 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) | 1765 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) |
1760 ret = pushkey.push(self, namespace, key, old, new) | 1766 ret = pushkey.push(self, namespace, key, old, new) |
1761 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new, | 1767 self.hook('pushkey', namespace=namespace, key=key, old=old, new=new, |
1762 ret=ret) | 1768 ret=ret) |
1763 return ret | 1769 return ret |