changeset 30479:798bcb1274dd

archival: simplify code and drop message about Python 2.5
author Augie Fackler <augie@google.com>
date Mon, 21 Nov 2016 18:17:02 -0500
parents f7d66746ec18
children b0a8337ba9af
files mercurial/archival.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Mon Nov 21 17:52:32 2016 -0500
+++ b/mercurial/archival.py	Mon Nov 21 18:17:02 2016 -0500
@@ -141,7 +141,7 @@
         self.mtime = mtime
         self.fileobj = None
 
-        def taropen(name, mode, fileobj=None):
+        def taropen(mode, name='', fileobj=None):
             if kind == 'gz':
                 mode = mode[0]
                 if not fileobj:
@@ -155,10 +155,9 @@
                 return tarfile.open(name, mode + kind, fileobj)
 
         if isinstance(dest, str):
-            self.z = taropen(dest, mode='w:')
+            self.z = taropen('w:', name=dest)
         else:
-            # Python 2.5-2.5.1 have a regression that requires a name arg
-            self.z = taropen(name='', mode='w|', fileobj=dest)
+            self.z = taropen('w|', fileobj=dest)
 
     def addfile(self, name, mode, islink, data):
         i = tarfile.TarInfo(name)