Mercurial > public > mercurial-scm > hg-stable
diff mercurial/archival.py @ 40483:3d76a8e627a6
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 05 Sep 2017 15:21:21 -0700 |
parents | 844deb408a5b |
children | 997997eb8367 |
line wrap: on
line diff
--- 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: