Patchwork [3,of,4,V4] gpg: add shortkey() to convert from long id to short

login
register
mail settings
Submitter elson.wei@gmail.com
Date July 12, 2013, 2:20 a.m.
Message ID <67fe87db273db79c14b5.1373595639@ElsonWei-NB.PrimeVOLT>
Download mbox | patch
Permalink /patch/1838/
State Superseded, archived
Headers show

Comments

elson.wei@gmail.com - July 12, 2013, 2:20 a.m.
# HG changeset patch
# User Wei, Elson <elson.wei@gmail.com>
# Date 1373595319 -28800
#      Fri Jul 12 10:15:19 2013 +0800
# Node ID 67fe87db273db79c14b5d2c251b34b92275c691e
# Parent  750bda4b332c3eb913750f26f496b988042da25f
gpg: add shortkey() to convert from long id to short

Patch

# HG changeset patch
# User Wei, Elson <elson.wei@gmail.com>
# Date 1373595319 -28800
#      Fri Jul 12 10:15:19 2013 +0800
# Node ID 67fe87db273db79c14b5d2c251b34b92275c691e
# 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,12 @@ 
     except ValueError, inst:
         raise util.Abort(str(inst))
 
+def shortkey(key):
+    if len(key) == 16:
+        return key[-8:]
+    else:
+        return key
+
 def node2txt(repo, node, ver):
     """map a manifest into some text"""
     if ver == "0":