# HG changeset patch # User Patrick Mezard # Date 2010-07-26 21:26:15 # Node ID fc360de6621728c40e51370114eac05b23728e70 # Parent aade8f133d11cdc8dd9cd6d443098d1abbe90e95 debugbuilddag: build repository content in binary mode diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -890,7 +890,7 @@ def debugbuilddag(ui, repo, text, # we don't want to fail in merges during buildup os.environ['HGMERGE'] = 'internal:local' - def writefile(fname, text, fmode="w"): + def writefile(fname, text, fmode="wb"): f = open(fname, fmode) try: f.write(text) @@ -925,7 +925,7 @@ def debugbuilddag(ui, repo, text, merge(ui, repo, node=p2) if mergeable_file: - f = open("mf", "r+") + f = open("mf", "rb+") try: lines = f.read().split("\n") lines[id * linesperrev] += " r%i" % id @@ -935,7 +935,7 @@ def debugbuilddag(ui, repo, text, f.close() if appended_file: - writefile("af", "r%i\n" % id, "a") + writefile("af", "r%i\n" % id, "ab") if overwritten_file: writefile("of", "r%i\n" % id) diff --git a/tests/test-debugbuilddag b/tests/test-debugbuilddag --- a/tests/test-debugbuilddag +++ b/tests/test-debugbuilddag @@ -13,6 +13,8 @@ cd repo hg debugbuilddag '+2:f +3:p2 @temp