# HG changeset patch # User Martin von Zweigbergk # Date 1504650081 25200 # Node ID 3d76a8e627a623b9a66f21a0d599fb2fa87143f5 # Parent bf249bb60087b8aa2c9ea6ef4031768620c7a790 archive: change "matcnfn" argument to a real matcher All callers seem to be passing a real matcher, not just a function. We were also passing it into match.subdirmatcher(), which assumes it is a matcher. Differential Revision: https://phab.mercurial-scm.org/D5176 diff -r bf249bb60087 -r 3d76a8e627a6 hgext/extdiff.py --- a/hgext/extdiff.py Mon Oct 22 11:34:35 2018 -0700 +++ b/hgext/extdiff.py Tue Sep 05 15:21:21 2017 -0700 @@ -139,7 +139,7 @@ repo.ui.setconfig("ui", "archivemeta", False) archival.archive(repo, base, node, 'files', - matchfn=scmutil.matchfiles(repo, files), + match=scmutil.matchfiles(repo, files), subrepos=listsubrepos) for fn in sorted(files): diff -r bf249bb60087 -r 3d76a8e627a6 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Mon Oct 22 11:34:35 2018 -0700 +++ b/hgext/largefiles/overrides.py Tue Sep 05 15:21:21 2017 -0700 @@ -929,12 +929,12 @@ finally: web.repo.lfstatus = False -def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None, +def overridearchive(orig, repo, dest, node, kind, decode=True, match=None, prefix='', mtime=None, subrepos=None): # For some reason setting repo.lfstatus in hgwebarchive only changes the # unfiltered repo's attr, so check that as well. if not repo.lfstatus and not repo.unfiltered().lfstatus: - return orig(repo, dest, node, kind, decode, matchfn, prefix, mtime, + return orig(repo, dest, node, kind, decode, match, prefix, mtime, subrepos) # No need to lock because we are only reading history and @@ -955,7 +955,7 @@ prefix = archival.tidyprefix(dest, kind, prefix) def write(name, mode, islink, getdata): - if matchfn and not matchfn(name): + if match and not match(name): return data = getdata() if decode: @@ -991,7 +991,7 @@ if subrepos: for subpath in sorted(ctx.substate): sub = ctx.workingsub(subpath) - submatch = matchmod.subdirmatcher(subpath, matchfn) + submatch = matchmod.subdirmatcher(subpath, match) sub._repo.lfstatus = True sub.archive(archiver, prefix, submatch) diff -r bf249bb60087 -r 3d76a8e627a6 mercurial/archival.py --- a/mercurial/archival.py Mon Oct 22 11:34:35 2018 -0700 +++ b/mercurial/archival.py Tue Sep 05 15:21:21 2017 -0700 @@ -274,7 +274,7 @@ 'zip': zipit, } -def archive(repo, dest, node, kind, decode=True, matchfn=None, +def archive(repo, dest, node, kind, decode=True, match=None, prefix='', mtime=None, subrepos=False): '''create archive of repo as it was at node. @@ -286,7 +286,7 @@ decode tells whether to put files through decode filters from hgrc. - matchfn is function to filter names of files to write to archive. + match is a matcher to filter names of files to write to archive. prefix is name of path to put before every archive member. @@ -315,11 +315,11 @@ if repo.ui.configbool("ui", "archivemeta"): name = '.hg_archival.txt' - if not matchfn or matchfn(name): + if not match or match(name): write(name, 0o644, False, lambda: buildmetadata(ctx)) - if matchfn: - files = [f for f in ctx.manifest().keys() if matchfn(f)] + if match: + files = [f for f in ctx.manifest().keys() if match(f)] else: files = ctx.manifest().keys() total = len(files) @@ -339,7 +339,7 @@ if subrepos: for subpath in sorted(ctx.substate): sub = ctx.workingsub(subpath) - submatch = matchmod.subdirmatcher(subpath, matchfn) + submatch = matchmod.subdirmatcher(subpath, match) total += sub.archive(archiver, prefix, submatch, decode) if total == 0: diff -r bf249bb60087 -r 3d76a8e627a6 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Mon Oct 22 11:34:35 2018 -0700 +++ b/mercurial/hgweb/webcommands.py Tue Sep 05 15:21:21 2017 -0700 @@ -1216,8 +1216,7 @@ bodyfh = web.res.getbodyfile() - archival.archive(web.repo, bodyfh, cnode, artype, prefix=name, - matchfn=match, + archival.archive(web.repo, bodyfh, cnode, artype, prefix=name, match=match, subrepos=web.configbool("web", "archivesubrepos")) return []