Show More
@@ -139,7 +139,7 b' def snapshot(ui, repo, files, node, tmpr' | |||||
139 | repo.ui.setconfig("ui", "archivemeta", False) |
|
139 | repo.ui.setconfig("ui", "archivemeta", False) | |
140 |
|
140 | |||
141 | archival.archive(repo, base, node, 'files', |
|
141 | archival.archive(repo, base, node, 'files', | |
142 |
match |
|
142 | match=scmutil.matchfiles(repo, files), | |
143 | subrepos=listsubrepos) |
|
143 | subrepos=listsubrepos) | |
144 |
|
144 | |||
145 | for fn in sorted(files): |
|
145 | for fn in sorted(files): |
@@ -929,12 +929,12 b' def hgwebarchive(orig, web):' | |||||
929 | finally: |
|
929 | finally: | |
930 | web.repo.lfstatus = False |
|
930 | web.repo.lfstatus = False | |
931 |
|
931 | |||
932 |
def overridearchive(orig, repo, dest, node, kind, decode=True, match |
|
932 | def overridearchive(orig, repo, dest, node, kind, decode=True, match=None, | |
933 | prefix='', mtime=None, subrepos=None): |
|
933 | prefix='', mtime=None, subrepos=None): | |
934 | # For some reason setting repo.lfstatus in hgwebarchive only changes the |
|
934 | # For some reason setting repo.lfstatus in hgwebarchive only changes the | |
935 | # unfiltered repo's attr, so check that as well. |
|
935 | # unfiltered repo's attr, so check that as well. | |
936 | if not repo.lfstatus and not repo.unfiltered().lfstatus: |
|
936 | if not repo.lfstatus and not repo.unfiltered().lfstatus: | |
937 |
return orig(repo, dest, node, kind, decode, match |
|
937 | return orig(repo, dest, node, kind, decode, match, prefix, mtime, | |
938 | subrepos) |
|
938 | subrepos) | |
939 |
|
939 | |||
940 | # No need to lock because we are only reading history and |
|
940 | # No need to lock because we are only reading history and | |
@@ -955,7 +955,7 b' def overridearchive(orig, repo, dest, no' | |||||
955 | prefix = archival.tidyprefix(dest, kind, prefix) |
|
955 | prefix = archival.tidyprefix(dest, kind, prefix) | |
956 |
|
956 | |||
957 | def write(name, mode, islink, getdata): |
|
957 | def write(name, mode, islink, getdata): | |
958 |
if match |
|
958 | if match and not match(name): | |
959 | return |
|
959 | return | |
960 | data = getdata() |
|
960 | data = getdata() | |
961 | if decode: |
|
961 | if decode: | |
@@ -991,7 +991,7 b' def overridearchive(orig, repo, dest, no' | |||||
991 | if subrepos: |
|
991 | if subrepos: | |
992 | for subpath in sorted(ctx.substate): |
|
992 | for subpath in sorted(ctx.substate): | |
993 | sub = ctx.workingsub(subpath) |
|
993 | sub = ctx.workingsub(subpath) | |
994 |
submatch = matchmod.subdirmatcher(subpath, match |
|
994 | submatch = matchmod.subdirmatcher(subpath, match) | |
995 | sub._repo.lfstatus = True |
|
995 | sub._repo.lfstatus = True | |
996 | sub.archive(archiver, prefix, submatch) |
|
996 | sub.archive(archiver, prefix, submatch) | |
997 |
|
997 |
@@ -274,7 +274,7 b' archivers = {' | |||||
274 | 'zip': zipit, |
|
274 | 'zip': zipit, | |
275 | } |
|
275 | } | |
276 |
|
276 | |||
277 |
def archive(repo, dest, node, kind, decode=True, match |
|
277 | def archive(repo, dest, node, kind, decode=True, match=None, | |
278 | prefix='', mtime=None, subrepos=False): |
|
278 | prefix='', mtime=None, subrepos=False): | |
279 | '''create archive of repo as it was at node. |
|
279 | '''create archive of repo as it was at node. | |
280 |
|
280 | |||
@@ -286,7 +286,7 b' def archive(repo, dest, node, kind, deco' | |||||
286 | decode tells whether to put files through decode filters from |
|
286 | decode tells whether to put files through decode filters from | |
287 | hgrc. |
|
287 | hgrc. | |
288 |
|
288 | |||
289 |
match |
|
289 | match is a matcher to filter names of files to write to archive. | |
290 |
|
290 | |||
291 | prefix is name of path to put before every archive member. |
|
291 | prefix is name of path to put before every archive member. | |
292 |
|
292 | |||
@@ -315,11 +315,11 b' def archive(repo, dest, node, kind, deco' | |||||
315 |
|
315 | |||
316 | if repo.ui.configbool("ui", "archivemeta"): |
|
316 | if repo.ui.configbool("ui", "archivemeta"): | |
317 | name = '.hg_archival.txt' |
|
317 | name = '.hg_archival.txt' | |
318 |
if not match |
|
318 | if not match or match(name): | |
319 | write(name, 0o644, False, lambda: buildmetadata(ctx)) |
|
319 | write(name, 0o644, False, lambda: buildmetadata(ctx)) | |
320 |
|
320 | |||
321 |
if match |
|
321 | if match: | |
322 |
files = [f for f in ctx.manifest().keys() if match |
|
322 | files = [f for f in ctx.manifest().keys() if match(f)] | |
323 | else: |
|
323 | else: | |
324 | files = ctx.manifest().keys() |
|
324 | files = ctx.manifest().keys() | |
325 | total = len(files) |
|
325 | total = len(files) | |
@@ -339,7 +339,7 b' def archive(repo, dest, node, kind, deco' | |||||
339 | if subrepos: |
|
339 | if subrepos: | |
340 | for subpath in sorted(ctx.substate): |
|
340 | for subpath in sorted(ctx.substate): | |
341 | sub = ctx.workingsub(subpath) |
|
341 | sub = ctx.workingsub(subpath) | |
342 |
submatch = matchmod.subdirmatcher(subpath, match |
|
342 | submatch = matchmod.subdirmatcher(subpath, match) | |
343 | total += sub.archive(archiver, prefix, submatch, decode) |
|
343 | total += sub.archive(archiver, prefix, submatch, decode) | |
344 |
|
344 | |||
345 | if total == 0: |
|
345 | if total == 0: |
@@ -1216,8 +1216,7 b' def archive(web):' | |||||
1216 |
|
1216 | |||
1217 | bodyfh = web.res.getbodyfile() |
|
1217 | bodyfh = web.res.getbodyfile() | |
1218 |
|
1218 | |||
1219 | archival.archive(web.repo, bodyfh, cnode, artype, prefix=name, |
|
1219 | archival.archive(web.repo, bodyfh, cnode, artype, prefix=name, match=match, | |
1220 | matchfn=match, |
|
|||
1221 | subrepos=web.configbool("web", "archivesubrepos")) |
|
1220 | subrepos=web.configbool("web", "archivesubrepos")) | |
1222 |
|
1221 | |||
1223 | return [] |
|
1222 | return [] |
General Comments 0
You need to be logged in to leave comments.
Login now