Patchwork [5,of,9,V3] localrepo: add localtags method to mimic tags method

login
register
mail settings
Submitter Sean Farley
Date March 28, 2014, 10:06 p.m.
Message ID <2545603a2724a97dd78b.1396044363@laptop.local>
Download mbox | patch
Permalink /patch/4113/
State Superseded
Headers show

Comments

Sean Farley - March 28, 2014, 10:06 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1395969042 18000
#      Thu Mar 27 20:10:42 2014 -0500
# Node ID 2545603a2724a97dd78b17c207b188e9cef414a0
# Parent  ee90b9a274e93bf091e9c00f9bfc916eb98e2408
localrepo: add localtags method to mimic tags method

This is just a wrapper for localrepo._findlocaltags that returns a dict, just
as localrepo.tags.
Pierre-Yves David - April 1, 2014, 3:07 a.m.
On 03/28/2014 03:06 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1395969042 18000
> #      Thu Mar 27 20:10:42 2014 -0500
> # Node ID 2545603a2724a97dd78b17c207b188e9cef414a0
> # Parent  ee90b9a274e93bf091e9c00f9bfc916eb98e2408
> localrepo: add localtags method to mimic tags method
>
> This is just a wrapper for localrepo._findlocaltags that returns a dict, just
> as localrepo.tags.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -638,10 +638,14 @@ class localrepository(object):
>           tagtypes = {}
>
>           tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
>           return self._encodetags(alltags, tagtypes)
>
> +    def localtags(self):
> +        '''return a mapping of local tag to node'''
> +        return self._findlocaltags()[0]
> +

This may had a chance to live on localrepo, however it has a single 
planned caller so it will go in the tag module with its buddies.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -638,10 +638,14 @@  class localrepository(object):
         tagtypes = {}
 
         tagsmod.readlocaltags(self.ui, self, alltags, tagtypes)
         return self._encodetags(alltags, tagtypes)
 
+    def localtags(self):
+        '''return a mapping of local tag to node'''
+        return self._findlocaltags()[0]
+
     def tagtype(self, tagname):
         '''
         return the type of the given tag. result can be:
 
         'local'  : a local tag