Mercurial > public > mercurial-scm > hg-stable
diff mercurial/wireproto.py @ 17793:8474be4412ca
wireproto: fix pushkey hook failure and output on remote http repo
Over http, a failed pushkey hook simply crashed the server, and
successful hook output was never sent to the client.
author | Wagner Bruna <wbruna@softwareexpress.com.br> |
---|---|
date | Mon, 15 Oct 2012 18:37:34 -0300 |
parents | a7fa5bd1c914 |
children | 47abbaabaaa5 |
line wrap: on
line diff
--- a/mercurial/wireproto.py Tue Oct 16 17:09:50 2012 -0500 +++ b/mercurial/wireproto.py Mon Oct 15 18:37:34 2012 -0300 @@ -503,6 +503,20 @@ else: new = encoding.tolocal(new) # normal path + if util.safehasattr(proto, 'restore'): + + proto.redirect() + + try: + r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), + encoding.tolocal(old), new) or False + except util.Abort: + r = False + + output = proto.restore() + + return '%s\n%s' % (int(r), output) + r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), encoding.tolocal(old), new) return '%s\n' % int(r)