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.
--- 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: