Submitter | Sean Farley |
---|---|
Date | March 28, 2014, 10:06 p.m. |
Message ID | <ccf260976f55dd32cc8d.1396044361@laptop.local> |
Download | mbox | patch |
Permalink | /patch/4111/ |
State | Superseded |
Headers | show |
Comments
On 03/28/2014 03:06 PM, Sean Farley wrote: > # HG changeset patch > # User Sean Farley <sean.michael.farley@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
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes: > On 03/28/2014 03:06 PM, Sean Farley wrote: >> # HG changeset patch >> # User Sean Farley <sean.michael.farley@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. You mean add a 'findlocaltags' method to tags.py, too? That does seem like a good idea. > And note that docstring are usually in the form:: > > short desc > > long desc > on multiple > lines Huh, it seems my meta-q failed me here.
Patch
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) + def tagtype(self, tagname): ''' return the type of the given tag. result can be: 'local' : a local tag