mercurial/archival.py
branchstable
changeset 44474 a23b859ad17d
parent 44473 6c36a521572e
child 44475 b7ca03dff14c
--- a/mercurial/archival.py	Tue Mar 10 18:57:49 2020 +0100
+++ b/mercurial/archival.py	Tue Mar 10 18:53:19 2020 +0100
@@ -135,34 +135,36 @@
     '''write archive to tar file or stream.  can write uncompressed,
     or compress with gzip or bzip2.'''
 
-    class GzipFileWithTime(gzip.GzipFile):
-        def __init__(self, *args, **kw):
-            timestamp = None
-            if 'mtime' in kw:
-                timestamp = kw.pop('mtime')
-            if timestamp is None:
-                self.timestamp = time.time()
-            else:
-                self.timestamp = timestamp
-            gzip.GzipFile.__init__(self, *args, **kw)
+    if True:
+
+        class GzipFileWithTime(gzip.GzipFile):
+            def __init__(self, *args, **kw):
+                timestamp = None
+                if 'mtime' in kw:
+                    timestamp = kw.pop('mtime')
+                if timestamp is None:
+                    self.timestamp = time.time()
+                else:
+                    self.timestamp = timestamp
+                gzip.GzipFile.__init__(self, *args, **kw)
 
-        def _write_gzip_header(self):
-            self.fileobj.write(b'\037\213')  # magic header
-            self.fileobj.write(b'\010')  # compression method
-            fname = self.name
-            if fname and fname.endswith(b'.gz'):
-                fname = fname[:-3]
-            flags = 0
-            if fname:
-                flags = gzip.FNAME  # pytype: disable=module-attr
-            self.fileobj.write(pycompat.bytechr(flags))
-            gzip.write32u(  # pytype: disable=module-attr
-                self.fileobj, int(self.timestamp)
-            )
-            self.fileobj.write(b'\002')
-            self.fileobj.write(b'\377')
-            if fname:
-                self.fileobj.write(fname + b'\000')
+            def _write_gzip_header(self):
+                self.fileobj.write(b'\037\213')  # magic header
+                self.fileobj.write(b'\010')  # compression method
+                fname = self.name
+                if fname and fname.endswith(b'.gz'):
+                    fname = fname[:-3]
+                flags = 0
+                if fname:
+                    flags = gzip.FNAME  # pytype: disable=module-attr
+                self.fileobj.write(pycompat.bytechr(flags))
+                gzip.write32u(  # pytype: disable=module-attr
+                    self.fileobj, int(self.timestamp)
+                )
+                self.fileobj.write(b'\002')
+                self.fileobj.write(b'\377')
+                if fname:
+                    self.fileobj.write(fname + b'\000')
 
     def __init__(self, dest, mtime, kind=b''):
         self.mtime = mtime