# HG changeset patch # User Wei, Elson # Date 2013-07-14 13:50:45 # Node ID 2a7fd31ac5483cb5f282286f5c91ad464510834f # Parent 33c72f054e168f0b23188f39888fbf04969e9f21 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 @@ def sign(ui, repo, *revs, **opts): 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":