[PATCH 1 of 9 V3] localrepo: add _encodetags method
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Mar 31 22:04:57 CDT 2014
On 03/28/2014 03:05 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1396036685 18000
> # Fri Mar 28 14:58:05 2014 -0500
> # Node ID 9bab4721b0f6821f1f03d8a3eb9780dd14171000
> # Parent dfad9bb23ab49bd461544c1d5fab3318ab637d23
> localrepo: add _encodetags method
>
> This will be used in upcoming patches to help reduce code duplication.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -579,10 +579,24 @@ class localrepository(object):
> t[k] = v
> except (error.LookupError, ValueError):
> pass
> return t
>
> + def _encodetags(self, tags, tagtypes):
> + '''Build the return dicts for tags and tagtypes. Have to
> + re-encode tag names because the tags module always uses UTF-8
> + (in order not to lose info writing to the cache), but the rest
> + of Mercurial wants them in local encoding.'''
> + oldtags = tags
> + tags = {}
> + for (name, (node, hist)) in oldtags.iteritems():
> + if node != nullid:
> + tags[encoding.tolocal(name)] = node
> + tagtypes = dict([(encoding.tolocal(name), value)
> + for (name, value) in tagtypes.iteritems()])
> + return (tags, tagtypes)
> +
Why is this new method on the repository ‽
Sounds like it could be in the tag module itself.
More information about the Mercurial-devel
mailing list