Patchwork [1,of,3,STABLE] gzip: rename the argument to `mtime` to match upstream python

login
register
mail settings
Submitter Pierre-Yves David
Date March 10, 2020, 6:23 p.m.
Message ID <f0f5e4dbc875fb4a7201.1583864637@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/45674/
State New
Headers show

Comments

Pierre-Yves David - March 10, 2020, 6:23 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1583863069 -3600
#      Tue Mar 10 18:57:49 2020 +0100
# Branch stable
# Node ID f0f5e4dbc875fb4a7201987deba6c1eb2cbdbdee
# Parent  9803b374389a408dabdd4e3810ed7217ac0186a1
# EXP-Topic fix-3.8
# Available At https://dev.heptapod.net/octobus/mercurial-devel/
#              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r f0f5e4dbc875
gzip: rename the argument to `mtime` to match upstream python

Python gained the feature we missed in 3.1. The argument name is `mtime`. We
align our version for consistency.

Patch

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -138,8 +138,8 @@  class tarit(object):
     class GzipFileWithTime(gzip.GzipFile):
         def __init__(self, *args, **kw):
             timestamp = None
-            if 'timestamp' in kw:
-                timestamp = kw.pop('timestamp')
+            if 'mtime' in kw:
+                timestamp = kw.pop('mtime')
             if timestamp is None:
                 self.timestamp = time.time()
             else:
@@ -178,7 +178,7 @@  class tarit(object):
                     pycompat.sysstr(mode + b'b'),
                     zlib.Z_BEST_COMPRESSION,
                     fileobj,
-                    timestamp=mtime,
+                    mtime=mtime,
                 )
                 self.fileobj = gzfileobj
                 return tarfile.TarFile.taropen(  # pytype: disable=attribute-error