equal
deleted
inserted
replaced
136 or compress with gzip or bzip2.''' |
136 or compress with gzip or bzip2.''' |
137 |
137 |
138 class GzipFileWithTime(gzip.GzipFile): |
138 class GzipFileWithTime(gzip.GzipFile): |
139 def __init__(self, *args, **kw): |
139 def __init__(self, *args, **kw): |
140 timestamp = None |
140 timestamp = None |
141 if 'timestamp' in kw: |
141 if 'mtime' in kw: |
142 timestamp = kw.pop('timestamp') |
142 timestamp = kw.pop('mtime') |
143 if timestamp is None: |
143 if timestamp is None: |
144 self.timestamp = time.time() |
144 self.timestamp = time.time() |
145 else: |
145 else: |
146 self.timestamp = timestamp |
146 self.timestamp = timestamp |
147 gzip.GzipFile.__init__(self, *args, **kw) |
147 gzip.GzipFile.__init__(self, *args, **kw) |
176 gzfileobj = self.GzipFileWithTime( |
176 gzfileobj = self.GzipFileWithTime( |
177 name, |
177 name, |
178 pycompat.sysstr(mode + b'b'), |
178 pycompat.sysstr(mode + b'b'), |
179 zlib.Z_BEST_COMPRESSION, |
179 zlib.Z_BEST_COMPRESSION, |
180 fileobj, |
180 fileobj, |
181 timestamp=mtime, |
181 mtime=mtime, |
182 ) |
182 ) |
183 self.fileobj = gzfileobj |
183 self.fileobj = gzfileobj |
184 return tarfile.TarFile.taropen( # pytype: disable=attribute-error |
184 return tarfile.TarFile.taropen( # pytype: disable=attribute-error |
185 name, pycompat.sysstr(mode), gzfileobj |
185 name, pycompat.sysstr(mode), gzfileobj |
186 ) |
186 ) |