diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2011-10-01 20:49:36 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-27 13:27:51 +0000 |
commit | 921ced43c48c1d170452a7b251b94cc96ec8dd44 (patch) | |
tree | 3c4a89176ea67fe4c7bf7b375488361a823c95fa /mercurial/archival.py | |
parent | 9039c805b0a7e36220101323f82735f08a104b37 (diff) | |
download | mercurial-tarball-921ced43c48c1d170452a7b251b94cc96ec8dd44.tar.gz |
Imported from /srv/lorry/lorry-area/mercurial-tarball/mercurial-1.9.3.tar.gz.HEADmercurial-1.9.3master
Diffstat (limited to 'mercurial/archival.py')
-rw-r--r-- | mercurial/archival.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/mercurial/archival.py b/mercurial/archival.py index 8eddf29..3f92f4c 100644 --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -7,7 +7,6 @@ from i18n import _ from node import hex -import match as matchmod import cmdutil import scmutil, util, encoding import cStringIO, os, tarfile, time, zipfile @@ -196,7 +195,7 @@ class fileit(object): return f = self.opener(name, "w", atomictemp=True) f.write(data) - f.close() + f.rename() destfile = os.path.join(self.basedir, name) os.chmod(destfile, mode) @@ -235,6 +234,8 @@ def archive(repo, dest, node, kind, decode=True, matchfn=None, prefix = tidyprefix(dest, kind, prefix) def write(name, mode, islink, getdata): + if matchfn and not matchfn(name): + return data = getdata() if decode: data = repo.wwritedata(name, data) @@ -264,18 +265,11 @@ def archive(repo, dest, node, kind, decode=True, matchfn=None, return base + tags - name = '.hg_archival.txt' - if not matchfn or matchfn(name): - write(name, 0644, False, metadata) + write('.hg_archival.txt', 0644, False, metadata) - if matchfn: - files = [f for f in ctx.manifest().keys() if matchfn(f)] - else: - files = ctx.manifest().keys() - files.sort() - total = len(files) + total = len(ctx.manifest()) repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) - for i, f in enumerate(files): + for i, f in enumerate(ctx): ff = ctx.flags(f) write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) repo.ui.progress(_('archiving'), i + 1, item=f, @@ -285,7 +279,6 @@ def archive(repo, dest, node, kind, decode=True, matchfn=None, if subrepos: for subpath in ctx.substate: sub = ctx.sub(subpath) - submatch = matchmod.narrowmatcher(subpath, matchfn) - sub.archive(repo.ui, archiver, prefix, submatch) + sub.archive(repo.ui, archiver, prefix) archiver.done() |