Mercurial > kallithea
changeset 7711:c662d42e1f9c
hg: prepare for Mercurial 5.0 changing "exact" arguments
In the backward compat wrapper, we use root=None. That might seem a bit risky.
But it seems to work for the single use case we have, and the changeset dropped
it in Mercurial https://www.mercurial-scm.org/repo/hg/rev/0531dff73d0b hint
that this parameter really is unused.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 27 May 2019 00:12:15 +0200 |
parents | eda137096b3f |
children | 62c8b8791a2e |
files | kallithea/lib/vcs/backends/hg/repository.py kallithea/lib/vcs/utils/hgcompat.py |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/repository.py Mon May 27 00:17:32 2019 +0200 +++ b/kallithea/lib/vcs/backends/hg/repository.py Mon May 27 00:12:15 2019 +0200 @@ -29,7 +29,7 @@ from kallithea.lib.vcs.utils.ordered_dict import OrderedDict from kallithea.lib.vcs.utils.paths import abspath from kallithea.lib.vcs.utils.hgcompat import ( - ui, nullid, match, patch, diffopts, clone, get_contact, + ui, nullid, match, match_exact, patch, diffopts, clone, get_contact, localrepo, RepoLookupError, Abort, RepoError, hex, scmutil, hg_url, httpbasicauthhandler, httpdigestauthhandler, peer, httppeer, sshpeer, tag ) @@ -264,7 +264,7 @@ self.get_changeset(rev1) self.get_changeset(rev2) if path: - file_filter = match(self.path, '', [path], exact=True) + file_filter = match_exact(path) else: file_filter = None
--- a/kallithea/lib/vcs/utils/hgcompat.py Mon May 27 00:17:32 2019 +0200 +++ b/kallithea/lib/vcs/utils/hgcompat.py Mon May 27 00:12:15 2019 +0200 @@ -21,7 +21,7 @@ from mercurial.error import RepoError, RepoLookupError, Abort from mercurial.hgweb import hgweb_mod from mercurial.hgweb.common import get_contact -from mercurial.match import match +from mercurial.match import match, exact as match_exact from mercurial.mdiff import diffopts from mercurial.node import hex from mercurial.encoding import tolocal @@ -45,3 +45,7 @@ __org_memfilectx_ = memfilectx memfilectx = lambda repo, changectx, path, data, islink=False, isexec=False, copysource=None: \ __org_memfilectx_(repo, changectx, path, data, islink=islink, isexec=isexec, copied=copysource) + +# Mercurial 5.0 dropped exact argument for match in 635a12c53ea6, and 0531dff73d0b made the exact function stable with a single parameter +if inspect.getargspec(match_exact).args[0] != 'files': + match_exact = lambda path: match(None, '', [path], exact=True)