Patchwork [5,of,5,oldpy] archival: simplify code and drop message about Python 2.5

login
register
mail settings
Submitter Augie Fackler
Date Nov. 21, 2016, 11:48 p.m.
Message ID <0c18783234e5abe63826.1479772087@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/17673/
State Accepted
Headers show

Comments

Augie Fackler - Nov. 21, 2016, 11:48 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1479770222 18000
#      Mon Nov 21 18:17:02 2016 -0500
# Node ID 0c18783234e5abe63826edbb890f125b93c53c9b
# Parent  30886d0c0d17add55d64e53fb087bb53499cb682
archival: simplify code and drop message about Python 2.5
Pierre-Yves David - Nov. 22, 2016, 2:43 a.m.
On 11/22/2016 12:48 AM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1479770222 18000
> #      Mon Nov 21 18:17:02 2016 -0500
> # Node ID 0c18783234e5abe63826edbb890f125b93c53c9b
> # Parent  30886d0c0d17add55d64e53fb087bb53499cb682
> archival: simplify code and drop message about Python 2.5

nice cleanup, pushed.

Patch

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -141,7 +141,7 @@  class tarit(object):
         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 @@  class tarit(object):
                 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)