changeset 35964:a915465a731e

dumprevlog: handle being passed a mode parameter This makes it closer to an actual file opener. Otherwise, it gets in the way of a coming refactoring.
author Boris Feld <boris.feld@octobus.net>
date Tue, 06 Feb 2018 11:51:39 +0100
parents 69aaad59dc02
children c839bbee1e13
files contrib/dumprevlog
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/dumprevlog	Tue Feb 06 11:08:41 2018 +0100
+++ b/contrib/dumprevlog	Tue Feb 06 11:51:39 2018 +0100
@@ -14,8 +14,12 @@
 for fp in (sys.stdin, sys.stdout, sys.stderr):
     util.setbinary(fp)
 
+def binopen(path, mode='rb'):
+    if 'b' not in mode:
+        mode = mode + 'b'
+    return open(path, mode)
+
 for f in sys.argv[1:]:
-    binopen = lambda fn: open(fn, 'rb')
     r = revlog.revlog(binopen, f)
     print("file:", f)
     for i in r: