[PATCH 3 of 4 V5] gpg: add shortkey() to convert from long id to short

elson.wei at gmail.com elson.wei at gmail.com
Sun Jul 14 08:52:14 CDT 2013


# HG changeset patch
# User Wei, Elson <elson.wei at gmail.com>
# Date 1373809845 -28800
#      Sun Jul 14 21:50:45 2013 +0800
# Node ID 446ad1284333c9ffee4c96d9b7e887a869314d7a
# Parent  750bda4b332c3eb913750f26f496b988042da25f
gpg: add shortkey() to convert from long id to short

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -276,6 +276,13 @@
     except ValueError, inst:
         raise util.Abort(str(inst))
 
+def shortkey(ui, key):
+    if len(key) != 16:
+        ui.debug(_("key ID \"%s\" format error\n") % key)
+        return key
+
+    return key[-8:]
+
 def node2txt(repo, node, ver):
     """map a manifest into some text"""
     if ver == "0":
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2013-07-10_12-50-44_r19380+.diff
Type: text/x-patch
Size: 694 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130714/6fcced85/attachment.bin>


More information about the Mercurial-devel mailing list