[PATCH STABLE] bundle2: make sure standard stream are binary

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Fri May 16 01:57:00 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1400223201 25200
#      Thu May 15 23:53:21 2014 -0700
# Branch stable
# Node ID cca94027c4f56302c51de2aa281887a0dfa8ce1d
# Parent  54d7657d7d1e6a62315eea53f4498657e766bb60
bundle2: make sure standard stream are binary

Python on Windows apparently use encoded stream by default. We use the same
trick than elsewhere in the code to make them binary.

This should fix the current buildbot failure on windows.

diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t
--- a/tests/test-bundle2.t
+++ b/tests/test-bundle2.t
@@ -6,10 +6,18 @@ Create an extension to test bundle2 API
   > 
   > Current bundle2 implementation is far too limited to be used in any core
   > code. We still need to be able to test it while it grow up.
   > """
   > 
+  > try:
+  >     import msvcrt
+  >     msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
+  >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+  >     msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
+  > except ImportError:
+  >     pass
+  > 
   > import sys
   > from mercurial import cmdutil
   > from mercurial import util
   > from mercurial import bundle2
   > from mercurial import scmutil


More information about the Mercurial-devel mailing list