[PATCH 3 of 4 V4] gpg: add shortkey() to convert from long id to short
Kevin Bullock
kbullock+mercurial at ringworld.org
Fri Jul 12 12:05:33 CDT 2013
On 11 Jul 2013, at 9:20 PM, elson.wei at gmail.com wrote:
> # HG changeset patch
> # User Wei, Elson <elson.wei at 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
> +
Again, the 'else:' line is unnecessary and breaks our coding style. It occurs to me now that we should also have a debug message here (ui.debug()).
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list