subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1743239 - in /subversion/trunk/subversion/tests/cmdline: merge_tests.py svntest/wc.py
Date Tue, 10 May 2016 17:34:15 GMT
Author: stefan2
Date: Tue May 10 17:34:15 2016
New Revision: 1743239

URL: http://svn.apache.org/viewvc?rev=1743239&view=rev
Log:
Make all other FAILed merge tests PASS under Python 3.

* subversion/tests/cmdline/svntest/wc.py
  (State.from_wc):  When a file can't be read as string / UTF-8, retry as
                    binary.  The caller must then match that with their
                    expectations.

* subversion/tests/cmdline/merge_tests.py
  (merge_binary_file): We add to binary file content.
  (merge_binary_with_common_ancestry): Explicitly write the contents as
                                       binary to prevent conversion to UTF-8.
  (dry_run_merge_conflicting_binary): We modify binary data here.

Modified:
    subversion/trunk/subversion/tests/cmdline/merge_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/wc.py

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1743239&r1=1743238&r2=1743239&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Tue May 10 17:34:15 2016
@@ -1190,7 +1190,7 @@ def merge_binary_file(sbox):
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.add({
     ''        : Item(props={SVN_PROP_MERGEINFO : '/:3'}),
-    'A/theta' : Item(theta_contents + "some extra junk",
+    'A/theta' : Item(theta_contents + b"some extra junk",
                      props={'svn:mime-type' : 'application/octet-stream'}),
     })
   expected_status = svntest.actions.get_virginal_state(other_wc, 1)
@@ -1822,7 +1822,7 @@ def merge_binary_with_common_ancestry(sb
   # Add a binary file to the common ancestry path
   theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read()
   theta_I_path = os.path.join(I_path, 'theta')
-  svntest.main.file_write(theta_I_path, theta_contents)
+  svntest.main.file_write(theta_I_path, theta_contents, mode='wb')
   svntest.main.run_svn(None, 'add', theta_I_path)
   svntest.main.run_svn(None, 'propset', 'svn:mime-type',
                        'application/octet-stream', theta_I_path)
@@ -15983,7 +15983,7 @@ def dry_run_merge_conflicting_binary(sbo
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.add({
     ''        : Item(props={SVN_PROP_MERGEINFO : '/:3'}),
-    'A/theta' : Item(theta_contents + "some other junk",
+    'A/theta' : Item(theta_contents + b"some other junk",
                      props={'svn:mime-type' : 'application/octet-stream'}),
     })
 
@@ -15995,7 +15995,7 @@ def dry_run_merge_conflicting_binary(sbo
   # verify content of theirs(right) file
   expected_disk.add({
   'A/theta.merge-right.r3' :
-    Item(contents= theta_contents + "some extra junk")
+    Item(contents= theta_contents + b"some extra junk")
   })
 
   expected_status = svntest.actions.get_virginal_state(other_wc, 1)

Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=1743239&r1=1743238&r2=1743239&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Tue May 10 17:34:15 2016
@@ -679,7 +679,10 @@ class State:
       for name in dirs + files:
         node = os.path.join(dirpath, name)
         if os.path.isfile(node):
-          contents = open(node, 'r').read()
+          try:
+            contents = open(node, 'r', newline='').read()
+          except:
+            contents = open(node, 'rb').read()
         else:
           contents = None
         desc[repos_join(parent, name)] = StateItem(contents=contents)



Mime
View raw message