Mercurial > hg
diff contrib/dumprevlog @ 6466:9c426da6b03b
contrib: fix binary file issues with dumprevlog on Windows
* Fix traceback on dumprevlog: open revlog in mode 'rb' (binary)
* Set stdio to binary mode so that redirected data is not modified
References:
http://selenic.com/pipermail/mercurial/2008-March/018330.html
http://selenic.com/repo/index.cgi/hg/rev/a3fe91b4f6eb
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Fri, 04 Apr 2008 16:39:44 +0200 |
parents | ec5d77eb3431 |
children | fb42030d79d6 |
line wrap: on
line diff
--- a/contrib/dumprevlog Thu Apr 03 17:17:39 2008 +0200 +++ b/contrib/dumprevlog Fri Apr 04 16:39:44 2008 +0200 @@ -3,10 +3,14 @@ # $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump import sys -from mercurial import revlog, node +from mercurial import revlog, node, util + +for fp in (sys.stdin, sys.stdout, sys.stderr): + util.set_binary(fp) for f in sys.argv[1:]: - r = revlog.revlog(open, f) + binopen = lambda fn: open(fn, 'rb') + r = revlog.revlog(binopen, f) print "file:", f for i in xrange(r.count()): n = r.node(i)