diff hgext/gpg.py @ 19443:2a7fd31ac548

gpg: add shortkey() to convert from long id to short
author Wei, Elson <elson.wei@gmail.com>
date Sun, 14 Jul 2013 21:50:45 +0800
parents 33c72f054e16
children f9e04a4e28d0
line wrap: on
line diff
--- a/hgext/gpg.py	Fri Jul 12 10:10:46 2013 +0800
+++ b/hgext/gpg.py	Sun Jul 14 21:50:45 2013 +0800
@@ -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":