Author: svn-role
Date: Wed Jun 3 04:00:20 2020
New Revision: 1878415
URL: http://svn.apache.org/viewvc?rev=1878415&view=rev
Log:
Merge the r1876707 group from trunk:
* r1876707, r1876734, r1877318, r1877712, r1878141, r1878142, r1878143,
r1878144
Various fixes for making the test suite run correctly with Python 3 on
Windows.
Justification:
Our test suite should test Subversion correctly also on Windows with
Python 3
Votes:
+1: futatuki, jcorvel, stsp
Modified:
subversion/branches/1.14.x/ (props changed)
subversion/branches/1.14.x/STATUS
subversion/branches/1.14.x/subversion/tests/cmdline/blame_tests.py
subversion/branches/1.14.x/subversion/tests/cmdline/entries-dump.c
subversion/branches/1.14.x/subversion/tests/cmdline/merge_tests.py
subversion/branches/1.14.x/subversion/tests/cmdline/patch_tests.py
subversion/branches/1.14.x/subversion/tests/cmdline/svndumpfilter_tests.py
subversion/branches/1.14.x/subversion/tests/cmdline/svntest/actions.py
subversion/branches/1.14.x/subversion/tests/cmdline/svntest/main.py
subversion/branches/1.14.x/subversion/tests/cmdline/svntest/wc.py
subversion/branches/1.14.x/subversion/tests/cmdline/update_tests.py
Propchange: subversion/branches/1.14.x/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1876707,1876734,1877318,1877712,1878141-1878144
Modified: subversion/branches/1.14.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/STATUS?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/STATUS (original)
+++ subversion/branches/1.14.x/STATUS Wed Jun 3 04:00:20 2020
@@ -60,13 +60,3 @@ Veto-blocked changes:
Approved changes:
=================
-
- * r1876707, r1876734, r1877318, r1877712, r1878141, r1878142, r1878143,
- r1878144
- Various fixes for making the test suite run correctly with Python 3 on
- Windows.
- Justification:
- Our test suite should test Subversion correctly also on Windows with
- Python 3
- Votes:
- +1: futatuki, jcorvel, stsp
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/blame_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/blame_tests.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/blame_tests.py
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/blame_tests.py Wed Jun
3 04:00:20 2020
@@ -958,8 +958,7 @@ def blame_youngest_to_oldest(sbox):
sbox.simple_commit() #r3
# Delete a line.
- with open(iota_moved, 'w') as f:
- f.write(line)
+ svntest.main.file_write(iota_moved, line)
sbox.simple_commit() #r4
expected_output = [
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/entries-dump.c
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/entries-dump.c?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/entries-dump.c
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/entries-dump.c Wed Jun
3 04:00:20 2020
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
#include <apr_pools.h>
#include <apr_general.h>
@@ -34,6 +35,7 @@
#include "svn_pools.h"
#include "svn_wc.h"
#include "svn_dirent_uri.h"
+#include "svn_xml.h"
#include "private/svn_wc_private.h"
@@ -41,14 +43,61 @@
#include "../../libsvn_wc/lock.h"
static void
-str_value(const char *name, const char *value)
+print_prefix(void)
+{
+ puts("if b'' == '':\n"
+ " def _to_str(s):\n"
+ " return s\n"
+ "else:\n"
+ " def _to_str(s):\n"
+ " return s.decode('utf-8', 'surrogateescape')\n"
+ "\n"
+ "class Entry(object):\n"
+ " \"\"\"An Entry object represents one node's entry in a pre-1.6"
+ " .svn/entries file.\n\n"
+ "Similar to #svn_wc_entry_t, but not all fields are populated.\n\n"
+ "Entry objects are generated by the 'entries-dump'"
+ " test helper tool.\"\"\"\n\n"
+ " if b'' == '':\n"
+ " def set_strval(self, name, val):\n"
+ " self.__setattr__(name, val)\n"
+ " else:\n"
+ " def set_strval(self, name, val):\n"
+ " global _to_str\n"
+ " self.__setattr__(name, _to_str(val))\n");
+}
+
+static void
+print_as_bytes(const char *val)
+{
+ printf("b'");
+ while(*val)
+ {
+ printf("\\x%02x", (unsigned int)(unsigned char)*val++);
+ }
+ printf("'");
+}
+
+static void
+str_value(const char *name, const char *value, apr_pool_t *pool)
{
if (value == NULL)
printf("e.%s = None\n", name);
else
- printf("e.%s = '%s'\n", name, value);
-}
+ {
+ svn_stringbuf_t *escaped_value = NULL;
+ svn_xml_escape_attr_cstring(&escaped_value, value, pool);
+ /* Print the human-readable value. */
+ assert(NULL == strchr(escaped_value->data, '\n'));
+ printf("# e.%s = '%s'\n", name, escaped_value->data);
+
+ /* Print the machine-readable value. */
+ printf("e.set_strval('%s', ", name);
+ print_as_bytes(value);
+ printf(")\n");
+ }
+}
static void
int_value(const char *name, long int value)
@@ -76,6 +125,7 @@ entries_dump(const char *dir_path, svn_w
svn_error_t *err;
svn_wc_context_t *wc_ctx = NULL;
const char *dir_abspath;
+ apr_pool_t *iterpool = svn_pool_create(pool);
SVN_ERR(svn_dirent_get_absolute(&dir_abspath, dir_path, pool));
@@ -124,44 +174,45 @@ entries_dump(const char *dir_path, svn_w
for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
{
+ svn_stringbuf_t *escaped_key;
const char *key = apr_hash_this_key(hi);
const svn_wc_entry_t *entry = apr_hash_this_val(hi);
+ svn_pool_clear(iterpool);
SVN_ERR_ASSERT(strcmp(key, entry->name) == 0);
-
printf("e = Entry()\n");
- str_value("name", entry->name);
+ str_value("name", entry->name, iterpool);
int_value("revision", entry->revision);
- str_value("url", entry->url);
- str_value("repos", entry->repos);
- str_value("uuid", entry->uuid);
+ str_value("url", entry->url, iterpool);
+ str_value("repos", entry->repos, iterpool);
+ str_value("uuid", entry->uuid, iterpool);
int_value("kind", entry->kind);
int_value("schedule", entry->schedule);
bool_value("copied", entry->copied);
bool_value("deleted", entry->deleted);
bool_value("absent", entry->absent);
bool_value("incomplete", entry->incomplete);
- str_value("copyfrom_url", entry->copyfrom_url);
+ str_value("copyfrom_url", entry->copyfrom_url, iterpool);
int_value("copyfrom_rev", entry->copyfrom_rev);
- str_value("conflict_old", entry->conflict_old);
- str_value("conflict_new", entry->conflict_new);
- str_value("conflict_wrk", entry->conflict_wrk);
- str_value("prejfile", entry->prejfile);
+ str_value("conflict_old", entry->conflict_old, iterpool);
+ str_value("conflict_new", entry->conflict_new, iterpool);
+ str_value("conflict_wrk", entry->conflict_wrk, iterpool);
+ str_value("prejfile", entry->prejfile, iterpool);
/* skip: text_time */
/* skip: prop_time */
/* skip: checksum */
int_value("cmt_rev", entry->cmt_rev);
/* skip: cmt_date */
- str_value("cmt_author", entry->cmt_author);
- str_value("lock_token", entry->lock_token);
- str_value("lock_owner", entry->lock_owner);
- str_value("lock_comment", entry->lock_comment);
+ str_value("cmt_author", entry->cmt_author, iterpool);
+ str_value("lock_token", entry->lock_token, iterpool);
+ str_value("lock_owner", entry->lock_owner, iterpool);
+ str_value("lock_comment", entry->lock_comment, iterpool);
/* skip: lock_creation_date */
/* skip: has_props */
/* skip: has_prop_mods */
/* skip: cachable_props */
/* skip: present_props */
- str_value("changelist", entry->changelist);
+ str_value("changelist", entry->changelist, iterpool);
/* skip: working_size */
/* skip: keep_local */
int_value("depth", entry->depth);
@@ -170,8 +221,17 @@ entries_dump(const char *dir_path, svn_w
/* skip: file_external_peg_rev */
/* skip: file_external_rev */
bool_value("locked", locked && *entry->name == '\0');
- printf("entries['%s'] = e\n", (const char *)key);
+ /* Print the human-readable value. */
+ escaped_key = NULL;
+ svn_xml_escape_attr_cstring(&escaped_key, key, iterpool);
+ assert(NULL == strchr(escaped_key->data, '\n'));
+ printf("# entries['%s'] = e\n", escaped_key->data);
+ /* Print the machine-readable value. */
+ printf("entries[_to_str(");
+ print_as_bytes(key);
+ printf(")] = e\n");
}
+ svn_pool_destroy(iterpool);
if (wc_ctx)
SVN_ERR(svn_wc_context_destroy(wc_ctx));
@@ -282,6 +342,7 @@ tree_dump_dir(const char *local_abspath,
{
struct directory_walk_baton *bt = walk_baton;
const char *path;
+ svn_stringbuf_t *escaped_path;
if (kind != svn_node_dir)
return SVN_NO_ERROR;
@@ -307,7 +368,15 @@ tree_dump_dir(const char *local_abspath,
printf("entries = {}\n");
SVN_ERR(entries_dump(path, bt->adm_access, scratch_pool));
- printf("dirs['%s'] = entries\n", path);
+ /* Print the human-readable value. */
+ escaped_path = NULL;
+ svn_xml_escape_attr_cstring(&escaped_path, path, scratch_pool);
+ assert(NULL == strchr(escaped_path->data, '\n'));
+ printf("# dirs['%s'] = entries\n", escaped_path->data);
+ /* Print the machine-readable value. */
+ printf("dirs[_to_str(");
+ print_as_bytes(path);
+ printf(")] = entries\n");
return SVN_NO_ERROR;
}
@@ -384,15 +453,25 @@ main(int argc, const char *argv[])
cmd = NULL;
if (!cmd || !strcmp(cmd, "--entries"))
- err = entries_dump(path, NULL, pool);
+ {
+ print_prefix();
+ err = entries_dump(path, NULL, pool);
+ }
else if (!strcmp(cmd, "--subdirs"))
- err = directory_dump(path, pool);
+ {
+ err = directory_dump(path, pool);
+ }
else if (!strcmp(cmd, "--tree-dump"))
- err = tree_dump(path, pool);
+ {
+ print_prefix();
+ err = tree_dump(path, pool);
+ }
else
- err = svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
- "Invalid command '%s'",
- cmd);
+ {
+ err = svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
+ "Invalid command '%s'",
+ cmd);
+ }
if (err)
{
svn_handle_error2(err, stderr, FALSE, "entries-dump: ");
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/merge_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/merge_tests.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/merge_tests.py
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/merge_tests.py Wed Jun
3 04:00:20 2020
@@ -3323,15 +3323,11 @@ def merge_conflict_markers_matching_eol(
mu_path = sbox.ospath('A/mu')
- # CRLF is a string that will match a CRLF sequence read from a text file.
- # ### On Windows, we assume CRLF will be read as LF, so it's a poor test.
if os.name == 'nt':
- crlf = '\n'
+ native_nl = '\r\n'
else:
- crlf = '\r\n'
-
- # Strict EOL style matching breaks Windows tests at least with Python 2
- keep_eol_style = not svntest.main.is_os_windows()
+ native_nl = '\n'
+ crlf = '\r\n'
# Checkout a second working copy
wc_backup = sbox.add_wc_path('backup')
@@ -3349,8 +3345,8 @@ def merge_conflict_markers_matching_eol(
path_backup = os.path.join(wc_backup, 'A', 'mu')
# do the test for each eol-style
- for eol, eolchar in zip(['CRLF', 'CR', 'native', 'LF'],
- [crlf, '\015', '\n', '\012']):
+ for eol, eolchar in zip(['CRLF', 'CR','native', 'LF'],
+ [crlf, '\015', native_nl, '\012']):
# rewrite file mu and set the eol-style property.
svntest.main.file_write(mu_path, "This is the file 'mu'."+ eolchar, 'wb')
svntest.main.run_svn(None, 'propset', 'svn:eol-style', eol, mu_path)
@@ -3375,8 +3371,8 @@ def merge_conflict_markers_matching_eol(
svntest.main.run_svn(None, 'update', wc_backup)
# Make a local mod to mu
- svntest.main.file_append(mu_path,
- 'Original appended text for mu' + eolchar)
+ svntest.main.file_append_binary(mu_path,
+ 'Original appended text for mu' + eolchar)
# Commit the original change and note the 'theirs' revision number
svntest.main.run_svn(None, 'commit', '-m', 'test log', wc_dir)
@@ -3384,8 +3380,9 @@ def merge_conflict_markers_matching_eol(
theirs_rev = cur_rev
# Make a local mod to mu, will conflict with the previous change
- svntest.main.file_append(path_backup,
- 'Conflicting appended text for mu' + eolchar)
+ svntest.main.file_append_binary(path_backup,
+ 'Conflicting appended text for mu'
+ + eolchar)
# Create expected output tree for an update of the wc_backup.
expected_backup_output = svntest.wc.State(wc_backup, {
@@ -3445,7 +3442,7 @@ def merge_conflict_markers_matching_eol(
expected_backup_disk,
expected_backup_status,
expected_backup_skip,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
# cleanup for next run
svntest.main.run_svn(None, 'revert', '-R', wc_backup)
@@ -3468,15 +3465,7 @@ def merge_eolstyle_handling(sbox):
mu_path = sbox.ospath('A/mu')
- # CRLF is a string that will match a CRLF sequence read from a text file.
- # ### On Windows, we assume CRLF will be read as LF, so it's a poor test.
- if os.name == 'nt':
- crlf = '\n'
- else:
- crlf = '\r\n'
-
- # Strict EOL style matching breaks Windows tests at least with Python 2
- keep_eol_style = not svntest.main.is_os_windows()
+ crlf = '\r\n'
# Checkout a second working copy
wc_backup = sbox.add_wc_path('backup')
@@ -3518,7 +3507,7 @@ def merge_eolstyle_handling(sbox):
expected_backup_disk,
expected_backup_status,
expected_backup_skip,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
# Test 2: now change the eol-style property to another value and commit,
# merge this revision in the still changed mu in the second working copy;
@@ -3549,7 +3538,7 @@ def merge_eolstyle_handling(sbox):
expected_backup_disk,
expected_backup_status,
expected_backup_skip,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
# Test 3: now delete the eol-style property and commit, merge this revision
# in the still changed mu in the second working copy; there should be no
@@ -3578,7 +3567,7 @@ def merge_eolstyle_handling(sbox):
expected_backup_disk,
expected_backup_status,
expected_backup_skip,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
#----------------------------------------------------------------------
def create_deep_trees(wc_dir):
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/patch_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/patch_tests.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/patch_tests.py
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/patch_tests.py Wed Jun
3 04:00:20 2020
@@ -1574,15 +1574,7 @@ def patch_no_svn_eol_style(sbox):
patch_file_path = sbox.get_tempname('my.patch')
mu_path = sbox.ospath('A/mu')
- # CRLF is a string that will match a CRLF sequence read from a text file.
- # ### On Windows, we assume CRLF will be read as LF, so it's a poor test.
- if os.name == 'nt':
- crlf = '\n'
- else:
- crlf = '\r\n'
-
- # Strict EOL style matching breaks Windows tests at least with Python 2
- keep_eol_style = not svntest.main.is_os_windows()
+ crlf = '\r\n'
eols = [crlf, '\015', '\n', '\012']
for target_eol in eols:
@@ -1603,7 +1595,7 @@ def patch_no_svn_eol_style(sbox):
]
# Set mu contents
- svntest.main.file_write(mu_path, ''.join(mu_contents))
+ svntest.main.file_write(mu_path, ''.join(mu_contents), mode='wb')
unidiff_patch = [
"Index: mu",
@@ -1647,7 +1639,8 @@ def patch_no_svn_eol_style(sbox):
target_eol,
]
- svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch),
+ mode='wb')
expected_output = wc.State(wc_dir, {
'A/mu' : Item(status='U '),
@@ -1666,7 +1659,8 @@ def patch_no_svn_eol_style(sbox):
expected_disk,
expected_status,
expected_skip,
- [], True, True, keep_eol_style)
+ [], True, True,
+ keep_eol_style=True)
expected_output = ["Reverted '" + mu_path + "'\n"]
svntest.actions.run_and_verify_svn(expected_output, [],
@@ -1681,17 +1675,13 @@ def patch_with_svn_eol_style(sbox):
patch_file_path = sbox.get_tempname('my.patch')
mu_path = sbox.ospath('A/mu')
- # CRLF is a string that will match a CRLF sequence read from a text file.
- # ### On Windows, we assume CRLF will be read as LF, so it's a poor test.
if os.name == 'nt':
- crlf = '\n'
+ native_nl = '\r\n'
else:
- crlf = '\r\n'
-
- # Strict EOL style matching breaks Windows tests at least with Python 2
- keep_eol_style = not svntest.main.is_os_windows()
+ native_nl = '\n'
+ crlf = '\r\n'
- eols = [crlf, '\015', '\n', '\012']
+ eols = [crlf, '\015', native_nl, '\012']
eol_styles = ['CRLF', 'CR', 'native', 'LF']
rev = 1
for target_eol, target_eol_style in zip(eols, eol_styles):
@@ -1714,7 +1704,7 @@ def patch_with_svn_eol_style(sbox):
# Set mu contents
svntest.main.run_svn(None, 'rm', mu_path)
svntest.main.run_svn(None, 'commit', '-m', 'delete mu', mu_path)
- svntest.main.file_write(mu_path, ''.join(mu_contents))
+ svntest.main.file_write(mu_path, ''.join(mu_contents), mode='wb')
svntest.main.run_svn(None, 'add', mu_path)
svntest.main.run_svn(None, 'propset', 'svn:eol-style', target_eol_style,
mu_path)
@@ -1762,7 +1752,8 @@ def patch_with_svn_eol_style(sbox):
target_eol,
]
- svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch),
+ mode='wb')
expected_output = [
'U %s\n' % sbox.ospath('A/mu'),
@@ -1786,7 +1777,7 @@ def patch_with_svn_eol_style(sbox):
None, # expected err
1, # check-props
1, # dry-run
- keep_eol_style) # keep-eol-style
+ keep_eol_style=True)
expected_output = ["Reverted '" + mu_path + "'\n"]
svntest.actions.run_and_verify_svn(expected_output, [], 'revert', '-R',
wc_dir)
@@ -1800,17 +1791,13 @@ def patch_with_svn_eol_style_uncommitted
patch_file_path = sbox.get_tempname('my.patch')
mu_path = sbox.ospath('A/mu')
- # CRLF is a string that will match a CRLF sequence read from a text file.
- # ### On Windows, we assume CRLF will be read as LF, so it's a poor test.
if os.name == 'nt':
- crlf = '\n'
+ native_nl = '\r\n'
else:
- crlf = '\r\n'
-
- # Strict EOL style matching breaks Windows tests at least with Python 2
- keep_eol_style = not svntest.main.is_os_windows()
+ native_nl = '\n'
+ crlf = '\r\n'
- eols = [crlf, '\015', '\n', '\012']
+ eols = [crlf, '\015', native_nl, '\012']
eol_styles = ['CRLF', 'CR', 'native', 'LF']
for target_eol, target_eol_style in zip(eols, eol_styles):
for patch_eol in eols:
@@ -1830,7 +1817,7 @@ def patch_with_svn_eol_style_uncommitted
]
# Set mu contents
- svntest.main.file_write(mu_path, ''.join(mu_contents))
+ svntest.main.file_write(mu_path, ''.join(mu_contents), mode='wb')
svntest.main.run_svn(None, 'propset', 'svn:eol-style', target_eol_style,
mu_path)
@@ -1876,7 +1863,8 @@ def patch_with_svn_eol_style_uncommitted
target_eol,
]
- svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+ svntest.main.file_write(patch_file_path, ''.join(unidiff_patch),
+ mode='wb')
expected_output = wc.State(wc_dir, {
'A/mu' : Item(status='U '),
@@ -1899,7 +1887,7 @@ def patch_with_svn_eol_style_uncommitted
None, # expected err
1, # check-props
1, # dry-run
- keep_eol_style) # keep-eol-style
+ keep_eol_style=True)
expected_output = ["Reverted '" + mu_path + "'\n"]
svntest.actions.run_and_verify_svn(expected_output, [], 'revert', '-R',
wc_dir)
Modified:
subversion/branches/1.14.x/subversion/tests/cmdline/svndumpfilter_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/svndumpfilter_tests.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/svndumpfilter_tests.py
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/svndumpfilter_tests.py
Wed Jun 3 04:00:20 2020
@@ -71,7 +71,7 @@ def filter_and_return_output(dump, bufsi
# Since we call svntest.main.run_command_stdin() in binary mode,
# normalize the stderr line endings on Windows ourselves.
if sys.platform == 'win32':
- errput = map(lambda x : x.replace('\r\n', '\n'), errput)
+ errput = [x.replace('\r\n', '\n') for x in errput]
return output, errput
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/svntest/actions.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/svntest/actions.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/svntest/actions.py
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/svntest/actions.py Wed
Jun 3 04:00:20 2020
@@ -418,7 +418,7 @@ def run_and_verify_svnrdump(dumpfile_con
# Since main.run_svnrdump() uses binary mode, normalize the stderr
# line endings on Windows ourselves.
if sys.platform == 'win32':
- err = map(lambda x : x.replace('\r\n', '\n'), err)
+ err = [x.replace('\r\n', '\n') for x in err]
# Ignore "consider upgrade" warnings to allow regression tests to pass
# when run against a 1.6 mod_dav_svn.
@@ -1923,7 +1923,7 @@ def _run_and_verify_resolve(cmd, expecte
"Merge conflicts in '" + path + "' marked as resolved.\n" for path in
expected_paths]),
verify.UnorderedRegexListOutput([
- "Conflict in property.*at '" + path + "' marked as resolved.\n" \
+ "Conflict in property.*at '" + re.escape(path) + "' marked as
resolved.\n" \
for path in expected_paths]),
verify.UnorderedOutput([
"Tree conflict at '" + path + "' marked as resolved.\n" for path in
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/svntest/main.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/svntest/main.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/svntest/main.py
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/svntest/main.py Wed Jun
3 04:00:20 2020
@@ -527,10 +527,10 @@ def wait_on_pipe(waiter, binary_mode, st
# We always expect STDERR to be strings, not byte-arrays.
if not isinstance(stderr, str):
- stderr = stderr.decode("utf-8")
+ stderr = stderr.decode("utf-8", 'surrogateescape')
if not binary_mode:
if not isinstance(stdout, str):
- stdout = stdout.decode("utf-8")
+ stdout = stdout.decode("utf-8", 'surrogateescape')
# Normalize Windows line endings if in text mode.
if windows:
@@ -902,8 +902,6 @@ def run_entriesdump(path):
### report on this? or continue to just skip it?
return None
- class Entry(object):
- pass
entries = { }
exec(''.join(filter_dbg(stdout_lines)))
return entries
@@ -927,8 +925,6 @@ def run_entriesdump_tree(path):
### report on this? or continue to just skip it?
return None
- class Entry(object):
- pass
dirs = { }
exec(''.join(filter_dbg(stdout_lines)))
return dirs
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/svntest/wc.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/svntest/wc.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/svntest/wc.py Wed Jun
3 04:00:20 2020
@@ -28,6 +28,7 @@ import sys
import re
import logging
import pprint
+import io
if sys.version_info[0] >= 3:
# Python >=3.0
@@ -686,10 +687,18 @@ class State:
if os.path.isfile(node):
try:
if keep_eol_style:
- contents = open(node, 'r', newline='').read()
+
+ contents = io.open(node, 'r', newline='',
+ encoding='utf-8').read()
else:
- contents = open(node, 'r').read()
+ contents = io.open(node, 'r', encoding='utf-8').read()
+ if not isinstance(contents, str):
+ # Python 2: contents is read as an unicode object,
+ # but we expect it is a str.
+ contents = contents.encode()
except:
+ # If the file contains non UTF-8 character, we treat its
+ # content as binary represented as a bytes object.
contents = open(node, 'rb').read()
else:
contents = None
Modified: subversion/branches/1.14.x/subversion/tests/cmdline/update_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.14.x/subversion/tests/cmdline/update_tests.py?rev=1878415&r1=1878414&r2=1878415&view=diff
==============================================================================
--- subversion/branches/1.14.x/subversion/tests/cmdline/update_tests.py
(original)
+++ subversion/branches/1.14.x/subversion/tests/cmdline/update_tests.py Wed Jun
3 04:00:20 2020
@@ -1650,15 +1650,11 @@ def conflict_markers_matching_eol(sbox):
mu_path = sbox.ospath('A/mu')
- # CRLF is a string that will match a CRLF sequence read from a text file.
- # ### On Windows, we assume CRLF will be read as LF, so it's a poor test.
if os.name == 'nt':
- crlf = '\n'
+ native_nl = '\r\n'
else:
- crlf = '\r\n'
-
- # Strict EOL style matching breaks Windows tests at least with Python 2
- keep_eol_style = not svntest.main.is_os_windows()
+ native_nl = '\n'
+ crlf = '\r\n'
# Checkout a second working copy
wc_backup = sbox.add_wc_path('backup')
@@ -1677,7 +1673,7 @@ def conflict_markers_matching_eol(sbox):
# do the test for each eol-style
for eol, eolchar in zip(['CRLF', 'CR', 'native', 'LF'],
- [crlf, '\015', '\n', '\012']):
+ [crlf, '\015', native_nl, '\012']):
# rewrite file mu and set the eol-style property.
svntest.main.file_write(mu_path, "This is the file 'mu'."+ eolchar, 'wb')
svntest.main.run_svn(None, 'propset', 'svn:eol-style', eol, mu_path)
@@ -1704,8 +1700,8 @@ def conflict_markers_matching_eol(sbox):
svntest.main.run_svn(None, 'update', wc_backup)
# Make a local mod to mu
- svntest.main.file_append(mu_path,
- 'Original appended text for mu' + eolchar)
+ svntest.main.file_append_binary(mu_path,
+ 'Original appended text for mu' + eolchar)
# Commit the original change and note the 'theirs' revision number
svntest.main.run_svn(None, 'commit', '-m', 'test log', wc_dir)
@@ -1713,8 +1709,9 @@ def conflict_markers_matching_eol(sbox):
theirs_rev = cur_rev
# Make a local mod to mu, will conflict with the previous change
- svntest.main.file_append(path_backup,
- 'Conflicting appended text for mu' + eolchar)
+ svntest.main.file_append_binary(path_backup,
+ 'Conflicting appended text for mu'
+ + eolchar)
# Create expected output tree for an update of the wc_backup.
expected_backup_output = svntest.wc.State(wc_backup, {
@@ -1764,7 +1761,7 @@ def conflict_markers_matching_eol(sbox):
expected_backup_output,
expected_backup_disk,
expected_backup_status,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
# cleanup for next run
svntest.main.run_svn(None, 'revert', '-R', wc_backup)
@@ -1785,15 +1782,7 @@ def update_eolstyle_handling(sbox):
mu_path = sbox.ospath('A/mu')
- # CRLF is a string that will match a CRLF sequence read from a text file.
- # ### On Windows, we assume CRLF will be read as LF, so it's a poor test.
- if os.name == 'nt':
- crlf = '\n'
- else:
- crlf = '\r\n'
-
- # Strict EOL style matching breaks Windows tests at least with Python 2
- keep_eol_style = not svntest.main.is_os_windows()
+ crlf = '\r\n'
# Checkout a second working copy
wc_backup = sbox.add_wc_path('backup')
@@ -1825,7 +1814,7 @@ def update_eolstyle_handling(sbox):
expected_backup_output,
expected_backup_disk,
expected_backup_status,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
# Test 2: now change the eol-style property to another value and commit,
# update the still changed mu in the second working copy; there should be
@@ -1851,7 +1840,7 @@ def update_eolstyle_handling(sbox):
expected_backup_output,
expected_backup_disk,
expected_backup_status,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
# Test 3: now delete the eol-style property and commit, update the still
# changed mu in the second working copy; there should be no conflict!
@@ -1876,7 +1865,7 @@ def update_eolstyle_handling(sbox):
expected_backup_output,
expected_backup_disk,
expected_backup_status,
- keep_eol_style=keep_eol_style)
+ keep_eol_style=True)
# Bug in which "update" put a bogus revision number on a schedule-add file,
# causing the wrong version of it to be committed.