[PATCH] generate-working-copy-states: open() in binary mode when writing content

Matt Harbison mharbison72 at gmail.com
Sat Dec 6 04:00:05 UTC 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at 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

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):


More information about the Mercurial-devel mailing list