changeset 4951:667290b6c95e

archive: delay extraction of file revisions This allows us to look only at the filelogs we're interested in, providing a nice speedup if we're archiving only part of a repository.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 19 Jul 2007 19:43:25 -0300
parents 93b7e2fa7ee3
children a11921d24ec4
files mercurial/archival.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Thu Jul 19 19:43:25 2007 -0300
+++ b/mercurial/archival.py	Thu Jul 19 19:43:25 2007 -0300
@@ -200,8 +200,9 @@
 
     prefix is name of path to put before every archive member.'''
 
-    def write(name, mode, islink, data):
+    def write(name, mode, islink, getdata):
         if matchfn and not matchfn(name): return
+        data = getdata()
         if decode:
             data = repo.wwritedata(name, data)
         archiver.addfile(name, mode, islink, data)
@@ -212,8 +213,8 @@
     items = m.items()
     items.sort()
     write('.hg_archival.txt', 0644, False,
-          'repo: %s\nnode: %s\n' % (hex(repo.changelog.node(0)), hex(node)))
+          lambda: 'repo: %s\nnode: %s\n' % (hex(repo.changelog.node(0)), hex(node)))
     for filename, filenode in items:
         write(filename, m.execf(filename) and 0755 or 0644, m.linkf(filename),
-              repo.file(filename).read(filenode))
+              lambda: repo.file(filename).read(filenode))
     archiver.done()