Patchwork generate-working-copy-states: open() in binary mode when writing content

login
register
mail settings
Submitter Matt Harbison
Date Dec. 6, 2014, 4 a.m.
Message ID <d45dcc325cc311345c73.1417838405@Envy>
Download mbox | patch
Permalink /patch/7016/
State Accepted
Commit 3849b89459b03ebdb82b3b6e8f8e7e1b206a6a14
Headers show

Comments

Matt Harbison - Dec. 6, 2014, 4 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1417838282 18000
#      Fri Dec 05 22:58:02 2014 -0500
# Node ID d45dcc325cc311345c73c5f525e19d945ab05bb9
# Parent  406dfc63a1ad71213dccc1a45de99a3c5d5ac460
generate-working-copy-states: open() in binary mode when writing content

This avoids changes to the hashes on Windows in test-merge-force.t like so:

    @@ -594,12 +594,12 @@
       content2

       M missing_content2_content3_content4-tracked
    -  <<<<<<< local: 443153eb5b88 - test: local\r (esc)
    -  content4
    -  ||||||| base
    -  =======
    -  content2
    -  >>>>>>> other: 9b2ccd328a08  - test: remote\r (esc)
    +  <<<<<<< local: 0447570f1af6 - test: local
    +  content4
    +  ||||||| base
    +  =======
    +  content2
    +  >>>>>>> other: 85100b8c675b  - test: remote
       missing_content2_content3_content4-tracked.orig:
       content4
Matt Mackall - Dec. 8, 2014, 11:03 p.m.
On Fri, 2014-12-05 at 23:00 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1417838282 18000
> #      Fri Dec 05 22:58:02 2014 -0500
> # Node ID d45dcc325cc311345c73c5f525e19d945ab05bb9
> # Parent  406dfc63a1ad71213dccc1a45de99a3c5d5ac460
> generate-working-copy-states: open() in binary mode when writing content

Queued for default, thanks.

Patch

diff --git a/tests/generate-working-copy-states.py b/tests/generate-working-copy-states.py
--- a/tests/generate-working-copy-states.py
+++ b/tests/generate-working-copy-states.py
@@ -79,7 +79,7 @@ 
 # write actual content
 for filename, data in content:
     if data is not None:
-        f = open(filename, 'w')
+        f = open(filename, 'wb')
         f.write(data + '\n')
         f.close()
     elif os.path.exists(filename):