Changeset - c662d42e1f9c
[Not reviewed]
default
0 2 0
Mads Kiilerich - 6 years ago 2019-05-27 00:12:15
mads@kiilerich.com
Grafted from: de56f63a3c3c
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.
2 files changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/hg/repository.py
Show inline comments
 
@@ -29,7 +29,7 @@ from kallithea.lib.vcs.utils.lazy import
 
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 @@ class MercurialRepository(BaseRepository
 
            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
 

	
kallithea/lib/vcs/utils/hgcompat.py
Show inline comments
 
@@ -21,7 +21,7 @@ from mercurial.context import memctx, me
 
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 @@ if inspect.getargspec(memfilectx.__init_
 
    __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)
0 comments (0 inline, 0 general)