[PATCH 1 of 3 V3] gpg: treat "ERRSIG" as a valid key id but no fingerprint

elson.wei at gmail.com elson.wei at gmail.com
Wed Jul 10 00:04:14 CDT 2013


# HG changeset patch
# User Wei, Elson <elson.wei at gmail.com>
# Date 1373432623 -28800
#      Wed Jul 10 13:03:43 2013 +0800
# Node ID 578a4d336d183f41239f9568919333ef0561c1b7
# Parent  83d0df2ddf3f2a07ed347afcfa30ddacc18b4c3d
gpg: treat "ERRSIG" as a valid key id but no fingerprint

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -48,19 +48,19 @@
                     pass
         keys = []
         key, fingerprint = None, None
-        err = ""
         for l in ret.splitlines():
             # see DETAILS in the gnupg documentation
             # filter the logger output
             if not l.startswith("[GNUPG:]"):
                 continue
             l = l[9:]
-            if l.startswith("ERRSIG"):
-                err = _("error while verifying signature")
-                break
-            elif l.startswith("VALIDSIG"):
+            if l.startswith("VALIDSIG"):
                 # fingerprint of the primary key
                 fingerprint = l.split()[10]
+            elif l.startswith("ERRSIG"):
+                key = l.split(" ", 3)[:2]
+                key.append("")
+                fingerprint = None
             elif (l.startswith("GOODSIG") or
                   l.startswith("EXPSIG") or
                   l.startswith("EXPKEYSIG") or
@@ -69,11 +69,9 @@
                     keys.append(key + [fingerprint])
                 key = l.split(" ", 2)
                 fingerprint = None
-        if err:
-            return err, []
         if key is not None:
             keys.append(key + [fingerprint])
-        return err, keys
+        return keys
 
 def newgpg(ui, **opts):
     """create a new gpg instance"""
@@ -119,10 +117,7 @@
 
     data = node2txt(repo, node, version)
     sig = binascii.a2b_base64(sig)
-    err, keys = mygpg.verify(data, sig)
-    if err:
-        ui.warn("%s:%d %s\n" % (fn, ln , err))
-        return None
+    keys = mygpg.verify(data, sig)
 
     validkeys = []
     # warn for expired key and/or sigs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2013-07-10_12-36-11_r19379+.diff
Type: text/x-patch
Size: 2007 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130710/66696e5d/attachment.bin>


More information about the Mercurial-devel mailing list