[PATCH 4 of 9] localrepo: add findbyrevnum for convenience
Yuya Nishihara
yuya at tcha.org
Tue Mar 31 10:31:57 CDT 2015
On Tue, 31 Mar 2015 02:54:58 +0900, FUJIWARA Katsunori wrote:
> > > > + def findbyrevnum(self, revnum, abort=False):
> > > > + """Find the revision by revision number in this repository
> > > > +
> > > > + ``revnum`` should be ``int``. All negative values other than
> > > > + ``-1`` (as null revision) are treated as invalid revision number.
> > > > +
> > > > + This returns ``(node, revnum)`` tuple, if the revision
> > > > + corresponded to the specified ``revnum`` is found. If that
> > > > + revision is hidden one, this raises FilteredRepoLookupError.
> > > > +
> > > > + Other wise, this returns ``None`` (or raises RepoLookupError if
> > > > + ``abort``).
> > > > + """
> > > > + return context.findbyrevnum(self, revnum, abort=abort)
> > >
> > > I think findbyrevnum() can be moved to scmutil to avoid adding new methods
> > > to localrepository.
>
> Using something in context.py from scmutil.py causes importing
> problem, because context.py already imports scmutil.py.
>
> Would you mean that implementation of "findbyrevnum()" itself should
> be placed not in context.py but in scmutil.py ?
Yes, I meant moving everything to scmutil because it looked like a utility
function that uses a repo.
> or "import inside function" like below or so ?
>
> def findbyrevnum(...):
> import context
> return context.findbyrevnum(...)
More information about the Mercurial-devel
mailing list