# HG changeset patch # User Boris Feld # Date 1517914299 -3600 # Node ID a915465a731ee3a8ba6ac65a4d8f61bc797c6725 # Parent 69aaad59dc0229880917529510921eb2b8ced792 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. diff -r 69aaad59dc02 -r a915465a731e contrib/dumprevlog --- 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: