[PATCH 4 of 9] localrepo: add findbyrevnum for convenience
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Mar 30 16:58:44 CDT 2015
On 03/29/2015 11:34 AM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1427653752 -32400
> # Mon Mar 30 03:29:12 2015 +0900
> # Node ID efa05b47238ba2a0bca69cd40b8e2e1aed3a2cf2
> # Parent 5f035c783b0443fabc15e773af176c7ef092c1de
> localrepo: add findbyrevnum for convenience
>
> This allows to use "context.findbyrevnum()" easily, without additional
> importing "context".
You have awaken the localrepo bloat warden. How much caller do we have
for that? can it goes into scmutil as the other revnum related function?
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1900,6 +1900,21 @@ class localrepository(object):
> fp.close()
> return self.pathto(fp.name[len(self.root) + 1:])
>
> + 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)
> +
> # used to avoid circular references so destructors work
> def aftertrans(files):
> renamefiles = [tuple(t) for t in files]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list