diff hgext/gpg.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 917be0574d7f
children ad2627f4af27
line wrap: on
line diff
--- a/hgext/gpg.py	Mon Oct 05 22:49:24 2015 -0700
+++ b/hgext/gpg.py	Thu Oct 08 12:55:45 2015 -0700
@@ -6,7 +6,7 @@
 '''commands to sign and verify changesets'''
 
 import os, tempfile, binascii
-from mercurial import util, commands, match, cmdutil
+from mercurial import util, commands, match, cmdutil, error
 from mercurial import node as hgnode
 from mercurial.i18n import _
 
@@ -237,7 +237,7 @@
         nodes = [node for node in repo.dirstate.parents()
                  if node != hgnode.nullid]
         if len(nodes) > 1:
-            raise util.Abort(_('uncommitted merge - please provide a '
+            raise error.Abort(_('uncommitted merge - please provide a '
                                'specific revision'))
         if not nodes:
             nodes = [repo.changelog.tip()]
@@ -250,7 +250,7 @@
         data = node2txt(repo, n, sigver)
         sig = mygpg.sign(data)
         if not sig:
-            raise util.Abort(_("error while signing"))
+            raise error.Abort(_("error while signing"))
         sig = binascii.b2a_base64(sig)
         sig = sig.replace("\n", "")
         sigmessage += "%s %s %s\n" % (hexnode, sigver, sig)
@@ -263,7 +263,7 @@
     if not opts["force"]:
         msigs = match.exact(repo.root, '', ['.hgsigs'])
         if any(repo.status(match=msigs, unknown=True, ignored=True)):
-            raise util.Abort(_("working copy of .hgsigs is changed "),
+            raise error.Abort(_("working copy of .hgsigs is changed "),
                              hint=_("please commit .hgsigs manually"))
 
     sigsfile = repo.wfile(".hgsigs", "ab")
@@ -287,7 +287,7 @@
         repo.commit(message, opts['user'], opts['date'], match=msigs,
                     editor=editor)
     except ValueError as inst:
-        raise util.Abort(str(inst))
+        raise error.Abort(str(inst))
 
 def shortkey(ui, key):
     if len(key) != 16:
@@ -301,4 +301,4 @@
     if ver == "0":
         return "%s\n" % hgnode.hex(node)
     else:
-        raise util.Abort(_("unknown signature version"))
+        raise error.Abort(_("unknown signature version"))