comparison mercurial/archival.py @ 12323:f00953d9533c

subrepo: add support for 'hg archive'
author Martin Geisler <mg@aragost.com>
date Mon, 20 Sep 2010 15:46:17 +0200
parents 11db6fa2961e
children 6c375e07d673 2956945c3bee
comparison
equal deleted inserted replaced
12322:510afb31cf99 12323:f00953d9533c
203 'uzip': lambda name, mtime: zipit(name, mtime, False), 203 'uzip': lambda name, mtime: zipit(name, mtime, False),
204 'zip': zipit, 204 'zip': zipit,
205 } 205 }
206 206
207 def archive(repo, dest, node, kind, decode=True, matchfn=None, 207 def archive(repo, dest, node, kind, decode=True, matchfn=None,
208 prefix=None, mtime=None): 208 prefix=None, mtime=None, subrepos=False):
209 '''create archive of repo as it was at node. 209 '''create archive of repo as it was at node.
210 210
211 dest can be name of directory, name of archive file, or file 211 dest can be name of directory, name of archive file, or file
212 object to write archive to. 212 object to write archive to.
213 213
261 write('.hg_archival.txt', 0644, False, metadata) 261 write('.hg_archival.txt', 0644, False, metadata)
262 262
263 for f in ctx: 263 for f in ctx:
264 ff = ctx.flags(f) 264 ff = ctx.flags(f)
265 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) 265 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data)
266
267 if subrepos:
268 for subpath in ctx.substate:
269 sub = ctx.sub(subpath)
270 sub.archive(archiver, prefix)
271
266 archiver.done() 272 archiver.done()