232 raise util.Abort(_('cannot give prefix when archiving to files')) |
232 raise util.Abort(_('cannot give prefix when archiving to files')) |
233 else: |
233 else: |
234 prefix = tidyprefix(dest, kind, prefix) |
234 prefix = tidyprefix(dest, kind, prefix) |
235 |
235 |
236 def write(name, mode, islink, getdata): |
236 def write(name, mode, islink, getdata): |
237 if matchfn and not matchfn(name): |
|
238 return |
|
239 data = getdata() |
237 data = getdata() |
240 if decode: |
238 if decode: |
241 data = repo.wwritedata(name, data) |
239 data = repo.wwritedata(name, data) |
242 archiver.addfile(prefix + name, mode, islink, data) |
240 archiver.addfile(prefix + name, mode, islink, data) |
243 |
241 |
263 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) |
261 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) |
264 tags += 'latesttagdistance: %s\n' % dist |
262 tags += 'latesttagdistance: %s\n' % dist |
265 |
263 |
266 return base + tags |
264 return base + tags |
267 |
265 |
268 write('.hg_archival.txt', 0644, False, metadata) |
266 name = '.hg_archival.txt' |
269 |
267 if not matchfn or matchfn(name): |
270 total = len(ctx.manifest()) |
268 write(name, 0644, False, metadata) |
|
269 |
|
270 if matchfn: |
|
271 files = [f for f in ctx.manifest().keys() if matchfn(f)] |
|
272 else: |
|
273 files = ctx.manifest().keys() |
|
274 files.sort() |
|
275 total = len(files) |
271 repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) |
276 repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) |
272 for i, f in enumerate(ctx): |
277 for i, f in enumerate(files): |
273 ff = ctx.flags(f) |
278 ff = ctx.flags(f) |
274 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) |
279 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) |
275 repo.ui.progress(_('archiving'), i + 1, item=f, |
280 repo.ui.progress(_('archiving'), i + 1, item=f, |
276 unit=_('files'), total=total) |
281 unit=_('files'), total=total) |
277 repo.ui.progress(_('archiving'), None) |
282 repo.ui.progress(_('archiving'), None) |