changelog: fix the diverted opener to accept more kwargs
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 11 Jan 2020 04:57:29 +0100
changeset 44055 7f67f53492f7
parent 44054 612225e994ff
child 44056 8e09551206f5
changelog: fix the diverted opener to accept more kwargs The current code prevent the use of `atomictemp` file with the changelog opener. I do not see a good reason for this limitation. Differential Revision: https://phab.mercurial-scm.org/D7831
mercurial/changelog.py
--- a/mercurial/changelog.py	Mon Jan 06 08:08:06 2020 +0100
+++ b/mercurial/changelog.py	Sat Jan 11 04:57:29 2020 +0100
@@ -167,10 +167,10 @@
 def _divertopener(opener, target):
     """build an opener that writes in 'target.a' instead of 'target'"""
 
-    def _divert(name, mode=b'r', checkambig=False):
+    def _divert(name, mode=b'r', checkambig=False, **kwargs):
         if name != target:
-            return opener(name, mode)
-        return opener(name + b".a", mode)
+            return opener(name, mode, **kwargs)
+        return opener(name + b".a", mode, **kwargs)
 
     return _divert
 
@@ -178,9 +178,10 @@
 def _delayopener(opener, target, buf):
     """build an opener that stores chunks in 'buf' instead of 'target'"""
 
-    def _delay(name, mode=b'r', checkambig=False):
+    def _delay(name, mode=b'r', checkambig=False, **kwargs):
         if name != target:
-            return opener(name, mode)
+            return opener(name, mode, **kwargs)
+        assert not kwargs
         return appender(opener, name, mode, buf)
 
     return _delay