[PATCH 4 of 9 RFC] localrepo: add a method to return markers ina namespacee

Matt Mackall mpm at selenic.com
Wed Apr 2 16:31:22 CDT 2014


On Wed, 2014-04-02 at 16:20 -0500, Sean Farley wrote:
> Matt Mackall <mpm at selenic.com> writes:
> 
> > On Wed, 2014-04-02 at 12:01 -0500, Sean Farley wrote:
> >> Matt Mackall <mpm at selenic.com> writes:
> >> 
> >> > On Mon, 2014-03-31 at 17:41 +0000, David Soria Parra wrote:
> >> >> Sean Farley <sean.michael.farley at gmail.com> writes:
> >> >> 
> >> >> > # HG changeset patch
> >> >> > # User Sean Farley <sean.michael.farley at gmail.com>
> >> >> > # Date 1396218396 18000
> >> >> > #      Sun Mar 30 17:26:36 2014 -0500
> >> >> > # Node ID 0c5c36fe392d9dfbc56ac466e312a62bdeb2bf93
> >> >> > # Parent  1bb668ecda482ee83f31d505c2094e6402668931
> >> >> > localrepo: add a method to return markers in a namespace
> >> >> >
> >> >> > diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> >> >> > --- a/mercurial/localrepo.py
> >> >> > +++ b/mercurial/localrepo.py
> >> >> > @@ -671,10 +671,37 @@ class localrepository(object):
> >> >> >          RFC: should we allow tags and bookmarks to be set this way?
> >> >> >          '''
> >> >> >          self._createmarkernamespace(namespace)
> >> >> >          self._markers[namespace][name] = node
> >> >> >  
> >> >> > +    def markers(self, namespace=None, name=None):
> >> >> > +        '''Return markers in the namespace, otherwise return all markers.
> >> >> > +
> >> >> > +        If namespace is None, this will return a dictionary of dictionaries.
> >> >> > +
> >> >> > +        If namespace is passed but name is None, this function will return a
> >> >> > +        dictionary.
> >> >> > +
> >> >> > +        If both namespace and name are passed, this will return a value.
> >> >
> >> > This is a bit too polymorphic an API: it has three return types (dict of
> >> > dicts, dict, and value). 
> >> 
> >> Agreed. What about the name, though?
> >
> > If we agree that the shape of this function is:
> >
> > no args -> dictionary of name, hash pairs
> >
> > ..it's fine. But then we have questions about what to do with
> > collisions. Perhaps all we really need is marked() -> set of nodes that
> > have some form of marker.
> 
> Sorry, I didn't clarify what I meant. It seems that 'marker' is not a
> good name because there is a clash with 'obsolete marker'. In another
> thread, I present the word 'label':
> 
> http://www.selenic.com/pipermail/mercurial-devel/2014-March/057599.html

Either is fine. I've suggested label in the past.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list