D1996: wireproto: remove unnecessary exception trapping

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Thu Feb 1 23:37:46 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The `try..except error.Abort` was added in https://phab.mercurial-scm.org/rHG8474be4412ca5eb4e67047a97acb7cb7f3120ff0 back in
  
  2012. The intent was to ensure a failing pushkey hook didn't crash
  
  the server.
  
  Since that changeset, repo.pushkey() and the hooks mechanism is
  now much more robust about trapping errors itself. As such, we no
  longer need this try..except block. So it has been removed.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1996

AFFECTED FILES
  mercurial/wireproto.py

CHANGE DETAILS

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -914,11 +914,8 @@
 
         proto.redirect()
 
-        try:
-            r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key),
-                             encoding.tolocal(old), new) or False
-        except error.Abort:
-            r = False
+        r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key),
+                         encoding.tolocal(old), new) or False
 
         output = proto.restore()
 



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list