Show More
@@ -37,10 +37,10 b' class tarit:' | |||
|
37 | 37 | '''write archive to tar file or stream. can write uncompressed, |
|
38 | 38 | or compress with gzip or bzip2.''' |
|
39 | 39 | |
|
40 | def __init__(self, dest, prefix, kind=''): | |
|
40 | def __init__(self, dest, prefix, mtime, kind=''): | |
|
41 | 41 | self.prefix = tidyprefix(dest, prefix, ['.tar', '.tar.bz2', '.tar.gz', |
|
42 | 42 | '.tgz', 'tbz2']) |
|
43 |
self.mtime = |
|
|
43 | self.mtime = mtime | |
|
44 | 44 | if isinstance(dest, str): |
|
45 | 45 | self.z = tarfile.open(dest, mode='w:'+kind) |
|
46 | 46 | else: |
@@ -78,7 +78,7 b' class zipit:' | |||
|
78 | 78 | '''write archive to zip file or stream. can write uncompressed, |
|
79 | 79 | or compressed with deflate.''' |
|
80 | 80 | |
|
81 | def __init__(self, dest, prefix, compress=True): | |
|
81 | def __init__(self, dest, prefix, mtime, compress=True): | |
|
82 | 82 | self.prefix = tidyprefix(dest, prefix, ('.zip',)) |
|
83 | 83 | if not isinstance(dest, str): |
|
84 | 84 | try: |
@@ -88,7 +88,7 b' class zipit:' | |||
|
88 | 88 | self.z = zipfile.ZipFile(dest, 'w', |
|
89 | 89 | compress and zipfile.ZIP_DEFLATED or |
|
90 | 90 | zipfile.ZIP_STORED) |
|
91 |
self.date_time = time.gmtime( |
|
|
91 | self.date_time = time.gmtime(mtime)[:6] | |
|
92 | 92 | |
|
93 | 93 | def addfile(self, name, mode, data): |
|
94 | 94 | i = zipfile.ZipInfo(self.prefix + name, self.date_time) |
@@ -106,7 +106,7 b' class zipit:' | |||
|
106 | 106 | class fileit: |
|
107 | 107 | '''write archive as files in directory.''' |
|
108 | 108 | |
|
109 | def __init__(self, name, prefix): | |
|
109 | def __init__(self, name, prefix, mtime): | |
|
110 | 110 | if prefix: |
|
111 | 111 | raise util.Abort(_('cannot give prefix when archiving to files')) |
|
112 | 112 | self.basedir = name |
@@ -130,14 +130,14 b' class fileit:' | |||
|
130 | 130 | archivers = { |
|
131 | 131 | 'files': fileit, |
|
132 | 132 | 'tar': tarit, |
|
133 | 'tbz2': lambda name, prefix: tarit(name, prefix, 'bz2'), | |
|
134 | 'tgz': lambda name, prefix: tarit(name, prefix, 'gz'), | |
|
135 | 'uzip': lambda name, prefix: zipit(name, prefix, False), | |
|
133 | 'tbz2': lambda name, prefix, mtime: tarit(name, prefix, mtime, 'bz2'), | |
|
134 | 'tgz': lambda name, prefix, mtime: tarit(name, prefix, mtime, 'gz'), | |
|
135 | 'uzip': lambda name, prefix, mtime: zipit(name, prefix, mtime, False), | |
|
136 | 136 | 'zip': zipit, |
|
137 | 137 | } |
|
138 | 138 | |
|
139 | 139 | def archive(repo, dest, node, kind, decode=True, matchfn=None, |
|
140 | prefix=None): | |
|
140 | prefix=None, mtime=None): | |
|
141 | 141 | '''create archive of repo as it was at node. |
|
142 | 142 | |
|
143 | 143 | dest can be name of directory, name of archive file, or file |
@@ -160,8 +160,9 b' def archive(repo, dest, node, kind, deco' | |||
|
160 | 160 | data = fp.getvalue() |
|
161 | 161 | archiver.addfile(name, mode, data) |
|
162 | 162 | |
|
163 | archiver = archivers[kind](dest, prefix) | |
|
164 |
mn = |
|
|
163 | change = repo.changelog.read(node) | |
|
164 | mn = change[0] | |
|
165 | archiver = archivers[kind](dest, prefix, mtime or change[2][0]) | |
|
165 | 166 | mf = repo.manifest.read(mn).items() |
|
166 | 167 | mff = repo.manifest.readflags(mn) |
|
167 | 168 | mf.sort() |
General Comments 0
You need to be logged in to leave comments.
Login now