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

login
register
mail settings
Submitter Pierre-Yves David
Date May 16, 2014, 6:57 a.m.
Message ID <cca94027c4f56302c51d.1400223420@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4782/
State Accepted
Headers show

Comments

Pierre-Yves David - May 16, 2014, 6:57 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Pierre-Yves David - May 16, 2014, 7:44 a.m.
On 05/15/2014 11:57 PM, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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.

I've no dev machine on window at hands. If someone could test it 
actually fixes what it pretend to fix, that would be great.
Augie Fackler - May 26, 2014, 4:35 p.m.
On Thu, May 15, 2014 at 11:57:00PM -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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

Looks roughly like what I'd expect from my limited windows exposure.

Queued for stable.

>
> 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

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