diff mercurial/commandserver.py @ 26587:56b2bcea2529

error: get Abort from 'error' instead of 'util' The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be confused about that and gives all the credit to 'util' instead of the hardworking 'error'. In a spirit of equity, we break the cycle of injustice and give back to 'error' the respect it deserves. And screw that 'util' poser. For great justice.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 12:55:45 -0700
parents 5857be01962e
children 28e50c4b15ed
line wrap: on
line diff
--- a/mercurial/commandserver.py	Mon Oct 05 22:49:24 2015 -0700
+++ b/mercurial/commandserver.py	Thu Oct 08 12:55:45 2015 -0700
@@ -8,7 +8,7 @@
 from i18n import _
 import struct
 import sys, os, errno, traceback, SocketServer
-import dispatch, encoding, util
+import dispatch, encoding, util, error
 
 logfile = None
 
@@ -222,7 +222,7 @@
             else:
                 # clients are expected to check what commands are supported by
                 # looking at the servers capabilities
-                raise util.Abort(_('unknown command %s') % cmd)
+                raise error.Abort(_('unknown command %s') % cmd)
 
         return cmd != ''
 
@@ -301,7 +301,7 @@
                 sv.serve()
             # handle exceptions that may be raised by command server. most of
             # known exceptions are caught by dispatch.
-            except util.Abort as inst:
+            except error.Abort as inst:
                 ui.warn(_('abort: %s\n') % inst)
             except IOError as inst:
                 if inst.errno != errno.EPIPE:
@@ -323,9 +323,9 @@
         self.repo = repo
         self.address = opts['address']
         if not util.safehasattr(SocketServer, 'UnixStreamServer'):
-            raise util.Abort(_('unsupported platform'))
+            raise error.Abort(_('unsupported platform'))
         if not self.address:
-            raise util.Abort(_('no socket path specified with --address'))
+            raise error.Abort(_('no socket path specified with --address'))
 
     def init(self):
         class cls(SocketServer.ForkingMixIn, SocketServer.UnixStreamServer):
@@ -351,4 +351,4 @@
     try:
         return _servicemap[mode](ui, repo, opts)
     except KeyError:
-        raise util.Abort(_('unknown mode %s') % mode)
+        raise error.Abort(_('unknown mode %s') % mode)