# HG changeset patch # User Boris Feld # Date 2018-02-06 10:51:39 # 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 --git a/contrib/dumprevlog b/contrib/dumprevlog --- a/contrib/dumprevlog +++ b/contrib/dumprevlog @@ -14,8 +14,12 @@ from mercurial import ( 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: