[PATCH 3 of 9 V3] localrepo: add _findlocaltags method

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Mar 31 22:05:57 CDT 2014



On 03/28/2014 03:06 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1396037258 18000
> #      Fri Mar 28 15:07:38 2014 -0500
> # Node ID ccf260976f55dd32cc8d5158d9f164c365275ee4
> # Parent  50cf68685c17254b52aa0ebe4effeef3c65bd6a5
> localrepo: add _findlocaltags method
>
> This method will be used in future patches to allow access to only getting the
> local tags. This will allow us to improve performance to avoid the cost of
> building the tag cache for large repos with many heads.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -617,10 +617,23 @@ class localrepository(object):
>
>           tags, tagtypes = self._encodetags(alltags, tagtypes)
>           tags['tip'] = self.changelog.tip()
>           return (tags, tagtypes)
>
> +    def _findlocaltags(self):
> +        '''Do the hard work of finding local tags.  Return a pair of dicts
> +        (tags, tagtypes) where tags maps local tag name to node, and tagtypes
> +        maps tag name to \'local\'.
> +        Subclasses or extensions are free to add their own tags, but
> +        should be aware that the returned dicts will be retained for the
> +        duration of the localrepo object.'''
> +        alltags = {}
> +        tagtypes = {}
> +
> +        tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
> +        return self._encodetags(alltags, tagtypes)
> +

Mode this to tag  module too.

And note that docstring are usually in the form::

   short desc

   long desc
   on multiple
   lines


More information about the Mercurial-devel mailing list