subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1746927 [7/8] - in /subversion/branches/authzperf: ./ build/ contrib/client-side/ contrib/client-side/svnmerge/ contrib/hook-scripts/ contrib/server-side/ contrib/server-side/fsfsfixer/fixer/ notes/directory-index/ notes/move-tracking/ sub...
Date Sun, 05 Jun 2016 15:03:54 GMT
Modified: subversion/branches/authzperf/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/svntest/sandbox.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/svntest/sandbox.py Sun Jun  5 15:03:52 2016
@@ -434,7 +434,8 @@ class Sandbox:
   def simple_append(self, dest, contents, truncate=False):
     """Append CONTENTS to file DEST, optionally truncating it first.
        DEST is a relpath relative to the WC."""
-    open(self.ospath(dest), truncate and 'wb' or 'ab').write(contents)
+    svntest.main.file_write(self.ospath(dest), contents,
+                            truncate and 'wb' or 'ab')
 
   def simple_lock(self, *targets):
     """Lock TARGETS in the WC.

Modified: subversion/branches/authzperf/subversion/tests/cmdline/svntest/testcase.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/svntest/testcase.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/svntest/testcase.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/svntest/testcase.py Sun Jun  5 15:03:52 2016
@@ -141,9 +141,9 @@ class FunctionTestCase(TestCase):
     # docstring on it.
     assert isinstance(func, types.FunctionType)
 
-    name = func.func_name
+    name = func.__name__
 
-    assert func.func_code.co_argcount == 1, \
+    assert func.__code__.co_argcount == 1, \
         '%s must take an sbox argument' % name
 
     doc = func.__doc__.strip()
@@ -165,13 +165,13 @@ class FunctionTestCase(TestCase):
     self.skip_cross_check = skip_cross_check
 
   def get_function_name(self):
-    return self.func.func_name
+    return self.func.__name__
 
   def get_sandbox_name(self):
     """Base the sandbox's name on the name of the file in which the
     function was defined."""
 
-    filename = self.func.func_code.co_filename
+    filename = self.func.__code__.co_filename
     return os.path.splitext(os.path.basename(filename))[0]
 
   def run(self, sandbox):

Modified: subversion/branches/authzperf/subversion/tests/cmdline/svntest/tree.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/svntest/tree.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/svntest/tree.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/svntest/tree.py Sun Jun  5 15:03:52 2016
@@ -499,6 +499,7 @@ def create_from_path(path, contents=None
 
 
 eol_re = re.compile(r'(\r\n|\r)')
+eol_re_binary = re.compile(br'(\r\n|\r)')
 
 # helper for build_tree_from_wc()
 def get_props(paths):
@@ -544,7 +545,10 @@ def get_props(paths):
       # contains a CR character XML-encoded as '
'.  The XML
       # parser converts it back into a CR character.  So again convert
       # all end-of-line variants into a single LF:
-      value = eol_re.sub('\n', value)
+      if isinstance(value, str):
+        value = eol_re.sub('\n', value)
+      else:
+        value = eol_re_binary.sub(b'\n', value)
       file_props[name] = value
     files[filename] = file_props
 
@@ -715,7 +719,7 @@ def _dump_tree(n,indent="",stream=sys.st
   the SVNTreeNode N. Prefix each line with the string INDENT."""
 
   # Code partially stolen from Dave Beazley
-  tmp_children = sorted(n.children or [])
+  tmp_children = sorted(n.children or [], key=SVNTreeNode.get_printable_path)
 
   if n.name == root_node_name:
     stream.write("%s%s\n" % (indent, "ROOT"))
@@ -862,10 +866,16 @@ def build_tree_from_diff_summarize(lines
 #   process for every file and dir in the working copy!
 
 
-def build_tree_from_wc(wc_path, load_props=0, ignore_svn=1):
+def build_tree_from_wc(wc_path, load_props=0, ignore_svn=1, keep_eol_style=False):
     """Takes WC_PATH as the path to a working copy.  Walks the tree below
     that path, and creates the tree based on the actual found
     files.  If IGNORE_SVN is true, then exclude SVN admin dirs from the tree.
-    If LOAD_PROPS is true, the props will be added to the tree."""
+    If LOAD_PROPS is true, the props will be added to the tree.
+
+    If KEEP_EOL_STYLE is set, don't let Python normalize the EOL when
+    reading working copy contents as text files.  It has no effect on
+    binary files.
+    """
 
-    return svntest.wc.State.from_wc(wc_path, load_props, ignore_svn).old_tree()
+    return svntest.wc.State.from_wc(wc_path, load_props, ignore_svn,
+                                    keep_eol_style).old_tree()

Modified: subversion/branches/authzperf/subversion/tests/cmdline/svntest/verify.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/svntest/verify.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/svntest/verify.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/svntest/verify.py Sun Jun  5 15:03:52 2016
@@ -189,7 +189,7 @@ class RegexOutput(ExpectedOutput):
 
   def __init__(self, expected, match_all=True):
     "EXPECTED is a regular expression string."
-    assert isinstance(expected, str)
+    assert isinstance(expected, str) or isinstance(expected, bytes)
     ExpectedOutput.__init__(self, expected, match_all)
     self.expected_re = re.compile(expected)
 
@@ -416,9 +416,10 @@ def compare_and_display_lines(message, l
   if not isinstance(expected, ExpectedOutput):
     expected = ExpectedOutput(expected)
 
-  if isinstance(actual, str):
-    actual = [actual]
-  actual = svntest.main.filter_dbg(actual)
+  actual = svntest.main.ensure_list(actual)
+  if len(actual) > 0:
+    is_binary = not isinstance(actual[0], str)
+    actual = svntest.main.filter_dbg(actual, is_binary)
 
   if not expected.matches(actual):
     expected.display_differences(message, label, actual)
@@ -484,7 +485,7 @@ class DumpParser:
     return m.group(1)
 
   def parse_blank(self, required=True):
-    if self.lines[self.current] != '\n':  # Works on Windows
+    if self.lines[self.current] != b'\n':  # Works on Windows
       if required:
         raise SVNDumpParseError("expected blank at line %d\n%s"
                                 % (self.current, self.lines[self.current]))
@@ -494,7 +495,7 @@ class DumpParser:
     return True
 
   def parse_header(self, header):
-    regex = '([^:]*): (.*)$'
+    regex = b'([^:]*): (.*)$'
     m = re.match(regex, self.lines[self.current])
     if not m:
       raise SVNDumpParseError("expected a header at line %d, but found:\n%s"
@@ -504,80 +505,80 @@ class DumpParser:
 
   def parse_headers(self):
     headers = []
-    while self.lines[self.current] != '\n':
+    while self.lines[self.current] != b'\n':
       key, val = self.parse_header(self)
       headers.append((key, val))
     return headers
 
 
   def parse_boolean(self, header, required):
-    return self.parse_line(header + ': (false|true)$', required)
+    return self.parse_line(header + b': (false|true)$', required)
 
   def parse_format(self):
-    return self.parse_line('SVN-fs-dump-format-version: ([0-9]+)$')
+    return self.parse_line(b'SVN-fs-dump-format-version: ([0-9]+)$')
 
   def parse_uuid(self):
-    return self.parse_line('UUID: ([0-9a-z-]+)$')
+    return self.parse_line(b'UUID: ([0-9a-z-]+)$')
 
   def parse_revision(self):
-    return self.parse_line('Revision-number: ([0-9]+)$')
+    return self.parse_line(b'Revision-number: ([0-9]+)$')
 
   def parse_prop_delta(self):
-    return self.parse_line('Prop-delta: (false|true)$', required=False)
+    return self.parse_line(b'Prop-delta: (false|true)$', required=False)
 
   def parse_prop_length(self, required=True):
-    return self.parse_line('Prop-content-length: ([0-9]+)$', required)
+    return self.parse_line(b'Prop-content-length: ([0-9]+)$', required)
 
   def parse_content_length(self, required=True):
-    return self.parse_line('Content-length: ([0-9]+)$', required)
+    return self.parse_line(b'Content-length: ([0-9]+)$', required)
 
   def parse_path(self):
-    path = self.parse_line('Node-path: (.*)$', required=False)
+    path = self.parse_line(b'Node-path: (.*)$', required=False)
     return path
 
   def parse_kind(self):
-    return self.parse_line('Node-kind: (.+)$', required=False)
+    return self.parse_line(b'Node-kind: (.+)$', required=False)
 
   def parse_action(self):
-    return self.parse_line('Node-action: ([0-9a-z-]+)$')
+    return self.parse_line(b'Node-action: ([0-9a-z-]+)$')
 
   def parse_copyfrom_rev(self):
-    return self.parse_line('Node-copyfrom-rev: ([0-9]+)$', required=False)
+    return self.parse_line(b'Node-copyfrom-rev: ([0-9]+)$', required=False)
 
   def parse_copyfrom_path(self):
-    path = self.parse_line('Node-copyfrom-path: (.+)$', required=False)
+    path = self.parse_line(b'Node-copyfrom-path: (.+)$', required=False)
     if not path and self.lines[self.current] == 'Node-copyfrom-path: \n':
       self.current += 1
       path = ''
     return path
 
   def parse_copy_md5(self):
-    return self.parse_line('Text-copy-source-md5: ([0-9a-z]+)$', required=False)
+    return self.parse_line(b'Text-copy-source-md5: ([0-9a-z]+)$', required=False)
 
   def parse_copy_sha1(self):
-    return self.parse_line('Text-copy-source-sha1: ([0-9a-z]+)$', required=False)
+    return self.parse_line(b'Text-copy-source-sha1: ([0-9a-z]+)$', required=False)
 
   def parse_text_md5(self):
-    return self.parse_line('Text-content-md5: ([0-9a-z]+)$', required=False)
+    return self.parse_line(b'Text-content-md5: ([0-9a-z]+)$', required=False)
 
   def parse_text_sha1(self):
-    return self.parse_line('Text-content-sha1: ([0-9a-z]+)$', required=False)
+    return self.parse_line(b'Text-content-sha1: ([0-9a-z]+)$', required=False)
 
   def parse_text_delta(self):
-    return self.parse_line('Text-delta: (false|true)$', required=False)
+    return self.parse_line(b'Text-delta: (false|true)$', required=False)
 
   def parse_text_delta_base_md5(self):
-    return self.parse_line('Text-delta-base-md5: ([0-9a-f]+)$', required=False)
+    return self.parse_line(b'Text-delta-base-md5: ([0-9a-f]+)$', required=False)
 
   def parse_text_delta_base_sha1(self):
-    return self.parse_line('Text-delta-base-sha1: ([0-9a-f]+)$', required=False)
+    return self.parse_line(b'Text-delta-base-sha1: ([0-9a-f]+)$', required=False)
 
   def parse_text_length(self):
-    return self.parse_line('Text-content-length: ([0-9]+)$', required=False)
+    return self.parse_line(b'Text-content-length: ([0-9]+)$', required=False)
 
   def get_props(self):
     props = []
-    while not re.match('PROPS-END$', self.lines[self.current]):
+    while not re.match(b'PROPS-END$', self.lines[self.current]):
       props.append(self.lines[self.current])
       self.current += 1
     self.current += 1
@@ -593,7 +594,7 @@ class DumpParser:
         curprop[0] += 1
 
         # key / value
-        key = ''
+        key = b''
         while len(key) != klen + 1:
           key += props[curprop[0]]
           curprop[0] += 1
@@ -601,10 +602,10 @@ class DumpParser:
 
         return key
 
-      if props[curprop[0]].startswith('K'):
+      if props[curprop[0]].startswith(b'K'):
         key = read_key_or_value(curprop)
         value = read_key_or_value(curprop)
-      elif props[curprop[0]].startswith('D'):
+      elif props[curprop[0]].startswith(b'D'):
         key = read_key_or_value(curprop)
         value = None
       else:
@@ -614,7 +615,7 @@ class DumpParser:
     return prophash
 
   def get_content(self, length):
-    content = ''
+    content = b''
     while len(content) < length:
       content += self.lines[self.current]
       self.current += 1
@@ -637,22 +638,22 @@ class DumpParser:
     headers = dict(headers_list)
 
     # Content-length must be last, if present
-    if 'Content-length' in headers and headers_list[-1][0] != 'Content-length':
+    if b'Content-length' in headers and headers_list[-1][0] != b'Content-length':
       raise SVNDumpParseError("'Content-length' header is not last, "
                               "in header block ending at line %d"
                               % (self.current,))
 
     # parse the remaining optional headers and store in specific keys in NODE
     for key, header, regex in [
-        ('copyfrom_rev',    'Node-copyfrom-rev',    '([0-9]+)$'),
-        ('copyfrom_path',   'Node-copyfrom-path',   '(.*)$'),
-        ('copy_md5',        'Text-copy-source-md5', '([0-9a-z]+)$'),
-        ('copy_sha1',       'Text-copy-source-sha1','([0-9a-z]+)$'),
-        ('prop_length',     'Prop-content-length',  '([0-9]+)$'),
-        ('text_length',     'Text-content-length',  '([0-9]+)$'),
-        ('text_md5',        'Text-content-md5',     '([0-9a-z]+)$'),
-        ('text_sha1',       'Text-content-sha1',    '([0-9a-z]+)$'),
-        ('content_length',  'Content-length',       '([0-9]+)$'),
+        ('copyfrom_rev',    b'Node-copyfrom-rev',    b'([0-9]+)$'),
+        ('copyfrom_path',   b'Node-copyfrom-path',   b'(.*)$'),
+        ('copy_md5',        b'Text-copy-source-md5', b'([0-9a-z]+)$'),
+        ('copy_sha1',       b'Text-copy-source-sha1',b'([0-9a-z]+)$'),
+        ('prop_length',     b'Prop-content-length',  b'([0-9]+)$'),
+        ('text_length',     b'Text-content-length',  b'([0-9]+)$'),
+        ('text_md5',        b'Text-content-md5',     b'([0-9a-z]+)$'),
+        ('text_sha1',       b'Text-content-sha1',    b'([0-9a-z]+)$'),
+        ('content_length',  b'Content-length',       b'([0-9]+)$'),
         ]:
       if not header in headers:
         node[key] = None
@@ -743,7 +744,7 @@ def compare_dump_files(message, label, e
   for parsed in [parsed_expected, parsed_actual]:
     for rev_name, rev_record in parsed.items():
       #print "Found %s" % (rev_name,)
-      if 'nodes' in rev_record:
+      if b'nodes' in rev_record:
         #print "Found %s.%s" % (rev_name, 'nodes')
         for path_name, path_record in rev_record['nodes'].items():
           #print "Found %s.%s.%s" % (rev_name, 'nodes', path_name)
@@ -765,8 +766,8 @@ def compare_dump_files(message, label, e
               action_record['blanks'] = 0
 
   if parsed_expected != parsed_actual:
-    print 'DIFF of raw dumpfiles (including expected differences)'
-    print ''.join(ndiff(expected, actual))
+    print('DIFF of raw dumpfiles (including expected differences)')
+    print(''.join(ndiff(expected, actual)))
     raise svntest.Failure('DIFF of parsed dumpfiles (ignoring expected differences)\n'
                           + '\n'.join(ndiff(
           pprint.pformat(parsed_expected).splitlines(),

Modified: subversion/branches/authzperf/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/svntest/wc.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/svntest/wc.py Sun Jun  5 15:03:52 2016
@@ -26,16 +26,17 @@
 import os
 import sys
 import re
-import urllib
 import logging
 import pprint
 
 if sys.version_info[0] >= 3:
   # Python >=3.0
   from io import StringIO
+  from urllib.parse import quote as urllib_quote
 else:
   # Python <3.0
   from cStringIO import StringIO
+  from urllib import quote as urllib_quote
 
 import svntest
 
@@ -172,7 +173,7 @@ class State:
     "Remove PATHS recursively from the state (the paths must exist)."
     for subtree_path in paths:
       subtree_path = to_relpath(subtree_path)
-      for path, item in self.desc.items():
+      for path, item in svntest.main.ensure_list(self.desc.items()):
         if path == subtree_path or path[:len(subtree_path) + 1] == subtree_path + '/':
           del self.desc[path]
 
@@ -201,7 +202,7 @@ class State:
       for path in args:
         try:
           path_ref = self.desc[to_relpath(path)]
-        except KeyError, e:
+        except KeyError as e:
           e.args = ["Path '%s' not present in WC state descriptor" % path]
           raise
         path_ref.tweak(**kw)
@@ -225,13 +226,13 @@ class State:
 
     """
     temp = {}
-    for src, dst in sorted(moves.items(), key=lambda (src, dst): src)[::-1]:
+    for src, dst in sorted(moves.items(), key=lambda pair: pair[0])[::-1]:
       temp[src] = {}
-      for path, item in self.desc.items():
+      for path, item in svntest.main.ensure_list(self.desc.items()):
         if path == src or path[:len(src) + 1] == src + '/':
           temp[src][path] = item;
           del self.desc[path]
-    for src, dst in sorted(moves.items(), key=lambda (src, dst): dst):
+    for src, dst in sorted(moves.items(), key=lambda pair: pair[1]):
       for path, item in temp[src].items():
         if path == src:
           new_path = dst
@@ -273,7 +274,7 @@ class State:
           os.makedirs(dirpath)
 
         # write out the file contents now
-        open(fullpath, 'wb').write(item.contents)
+        svntest.main.file_write(fullpath, item.contents, 'wb')
 
   def normalize(self):
     """Return a "normalized" version of self.
@@ -380,7 +381,7 @@ class State:
 
   def tweak_for_entries_compare(self):
     for path, item in self.desc.copy().items():
-      if item.status:
+      if item.status and path in self.desc:
         # If this is an unversioned tree-conflict, remove it.
         # These are only in their parents' THIS_DIR, they don't have entries.
         if item.status[0] in '!?' and item.treeconflict == 'C' and \
@@ -656,13 +657,18 @@ class State:
     return cls('', desc)
 
   @classmethod
-  def from_wc(cls, base, load_props=False, ignore_svn=True):
+  def from_wc(cls, base, load_props=False, ignore_svn=True,
+              keep_eol_style=False):
     """Create a State object from a working copy.
 
     Walks the tree at PATH, building a State based on the actual files
     and directories found. If LOAD_PROPS is True, then the properties
     will be loaded for all nodes (Very Expensive!). If IGNORE_SVN is
     True, then the .svn subdirectories will be excluded from the State.
+
+    If KEEP_EOL_STYLE is set, don't let Python normalize the EOL when
+    reading working copy contents as text files.  It has no effect on
+    binary files.
     """
     if not base:
       # we're going to walk the base, and the OS wants "."
@@ -678,7 +684,13 @@ class State:
       for name in dirs + files:
         node = os.path.join(dirpath, name)
         if os.path.isfile(node):
-          contents = open(node, 'r').read()
+          try:
+            if keep_eol_style:
+              contents = open(node, 'r', newline='').read()
+            else:
+              contents = open(node, 'r').read()
+          except:
+            contents = open(node, 'rb').read()
         else:
           contents = None
         desc[repos_join(parent, name)] = StateItem(contents=contents)
@@ -1073,7 +1085,7 @@ def repos_join(base, path):
 def svn_uri_quote(url):
   # svn defines a different set of "safe" characters than Python does, so
   # we need to avoid escaping them. see subr/path.c:uri_char_validity[]
-  return urllib.quote(url, "!$&'()*+,-./:=@_~")
+  return urllib_quote(url, "!$&'()*+,-./:=@_~")
 
 
 # ------------

Modified: subversion/branches/authzperf/subversion/tests/cmdline/trans_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/trans_tests.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/trans_tests.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/trans_tests.py Sun Jun  5 15:03:52 2016
@@ -562,9 +562,9 @@ def eol_change_is_text_mod(sbox):
   foo_path = os.path.join(wc_dir, 'foo')
   f = open(foo_path, 'wb')
   if svntest.main.windows:
-    f.write("1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n")
+    f.write(b"1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n")
   else:
-    f.write("1\n2\n3\n4\n5\n6\n7\n8\n9\n")
+    f.write(b"1\n2\n3\n4\n5\n6\n7\n8\n9\n")
   f.close()
 
   # commit the file
@@ -591,10 +591,10 @@ def eol_change_is_text_mod(sbox):
   # check 2: do the files have the right contents now?
   contents = open(foo_path, 'rb').read()
   if svntest.main.windows:
-    if contents != "1\n2\n3\n4\n5\n6\n7\n8\n9\n":
+    if contents != b"1\n2\n3\n4\n5\n6\n7\n8\n9\n":
       raise svntest.Failure
   else:
-    if contents != "1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n":
+    if contents != b"1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n":
       raise svntest.Failure
 
   foo_base_path = svntest.wc.text_base_path(foo_path)

Modified: subversion/branches/authzperf/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/update_tests.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/update_tests.py Sun Jun  5 15:03:52 2016
@@ -92,7 +92,7 @@ def update_binary_file(sbox):
 
   # Make a change to the binary file in the original working copy
   svntest.main.file_append(theta_path, "revision 3 text")
-  theta_contents_r3 = theta_contents + "revision 3 text"
+  theta_contents_r3 = theta_contents + b"revision 3 text"
 
   # Created expected output tree for 'svn ci'
   expected_output = svntest.wc.State(wc_dir, {
@@ -113,7 +113,7 @@ def update_binary_file(sbox):
 
   # Make a local mod to theta
   svntest.main.file_append(theta_backup_path, "extra theta text")
-  theta_contents_local = theta_contents + "extra theta text"
+  theta_contents_local = theta_contents + b"extra theta text"
 
   # Create expected output tree for an update of wc_backup.
   expected_output = svntest.wc.State(wc_backup, {
@@ -196,9 +196,9 @@ def update_binary_file_2(sbox):
 
   # Make some mods to the binary files.
   svntest.main.file_append(theta_path, "foobar")
-  new_theta_contents = theta_contents + "foobar"
+  new_theta_contents = theta_contents + b"foobar"
   svntest.main.file_append(zeta_path, "foobar")
-  new_zeta_contents = zeta_contents + "foobar"
+  new_zeta_contents = zeta_contents + b"foobar"
 
   # Created expected output tree for 'svn ci'
   expected_output = svntest.wc.State(wc_dir, {
@@ -286,7 +286,7 @@ def update_binary_file_3(sbox):
 
   # Make some mods to the binary files.
   svntest.main.file_append(theta_path, "foobar")
-  new_theta_contents = theta_contents + "foobar"
+  new_theta_contents = theta_contents + b"foobar"
 
   # Created expected output tree for 'svn ci'
   expected_output = svntest.wc.State(wc_dir, {
@@ -1657,6 +1657,9 @@ def conflict_markers_matching_eol(sbox):
   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()
+
   # Checkout a second working copy
   wc_backup = sbox.add_wc_path('backup')
   svntest.actions.run_and_verify_svn(None, [], 'checkout',
@@ -1757,10 +1760,11 @@ def conflict_markers_matching_eol(sbox):
     expected_backup_status.tweak(wc_rev = cur_rev)
 
     # Do the update and check the results in three ways.
-    svntest.actions.run_and_verify_update(wc_backup,
-                                          expected_backup_output,
-                                          expected_backup_disk,
-                                          expected_backup_status)
+    svntest.actions.run_and_verify_update2(wc_backup,
+                                           expected_backup_output,
+                                           expected_backup_disk,
+                                           expected_backup_status,
+                                           keep_eol_style=keep_eol_style)
 
     # cleanup for next run
     svntest.main.run_svn(None, 'revert', '-R', wc_backup)
@@ -1788,6 +1792,9 @@ def update_eolstyle_handling(sbox):
   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()
+
   # Checkout a second working copy
   wc_backup = sbox.add_wc_path('backup')
   svntest.actions.run_and_verify_svn(None, [], 'checkout',
@@ -1814,10 +1821,11 @@ def update_eolstyle_handling(sbox):
   expected_backup_status = svntest.actions.get_virginal_state(wc_backup, 2)
   expected_backup_status.tweak('A/mu', status='M ')
 
-  svntest.actions.run_and_verify_update(wc_backup,
-                                        expected_backup_output,
-                                        expected_backup_disk,
-                                        expected_backup_status)
+  svntest.actions.run_and_verify_update2(wc_backup,
+                                         expected_backup_output,
+                                         expected_backup_disk,
+                                         expected_backup_status,
+                                         keep_eol_style=keep_eol_style)
 
   # 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
@@ -1839,10 +1847,11 @@ def update_eolstyle_handling(sbox):
   expected_backup_status = svntest.actions.get_virginal_state(wc_backup, 3)
   expected_backup_status.tweak('A/mu', status='M ')
 
-  svntest.actions.run_and_verify_update(wc_backup,
-                                        expected_backup_output,
-                                        expected_backup_disk,
-                                        expected_backup_status)
+  svntest.actions.run_and_verify_update2(wc_backup,
+                                         expected_backup_output,
+                                         expected_backup_disk,
+                                         expected_backup_status,
+                                         keep_eol_style=keep_eol_style)
 
   # 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!
@@ -1863,10 +1872,11 @@ def update_eolstyle_handling(sbox):
 
   expected_backup_status = svntest.actions.get_virginal_state(wc_backup, 4)
   expected_backup_status.tweak('A/mu', status='M ')
-  svntest.actions.run_and_verify_update(wc_backup,
-                                        expected_backup_output,
-                                        expected_backup_disk,
-                                        expected_backup_status)
+  svntest.actions.run_and_verify_update2(wc_backup,
+                                         expected_backup_output,
+                                         expected_backup_disk,
+                                         expected_backup_status,
+                                         keep_eol_style=keep_eol_style)
 
 # Bug in which "update" put a bogus revision number on a schedule-add file,
 # causing the wrong version of it to be committed.

Modified: subversion/branches/authzperf/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/upgrade_tests.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/upgrade_tests.py Sun Jun  5 15:03:52 2016
@@ -36,6 +36,7 @@ import sys
 import tarfile
 import tempfile
 import logging
+import stat
 
 logger = logging.getLogger()
 
@@ -63,7 +64,7 @@ def replace_sbox_with_tarfile(sbox, tar_
                               dir=None):
   try:
     svntest.main.safe_rmtree(sbox.wc_dir)
-  except OSError, e:
+  except OSError as e:
     pass
 
   if not dir:
@@ -81,7 +82,7 @@ def replace_sbox_with_tarfile(sbox, tar_
 def replace_sbox_repo_with_tarfile(sbox, tar_filename, dir=None):
   try:
     svntest.main.safe_rmtree(sbox.repo_dir)
-  except OSError, e:
+  except OSError as e:
     pass
 
   if not dir:
@@ -130,7 +131,7 @@ def check_dav_cache(dir_path, wc_id, exp
 
   # Check if python's sqlite can read our db
   c.execute('select sqlite_version()')
-  sqlite_ver = map(int, c.fetchone()[0].split('.'))
+  sqlite_ver = svntest.main.ensure_list(map(int, c.fetchone()[0].split('.')))
 
   # SQLite versions have 3 or 4 number groups
   major = sqlite_ver[0]
@@ -157,7 +158,7 @@ def check_dav_cache(dir_path, wc_id, exp
     if row is None:
       raise svntest.Failure("no dav cache for '%s'" % (local_relpath))
     dav_cache = str(row[0])
-    if dav_cache != expected_dav_cache:
+    if dav_cache != str(expected_dav_cache):
       raise svntest.Failure(
               "wrong dav cache for '%s'\n  Found:    '%s'\n  Expected: '%s'" %
                 (local_relpath, dav_cache, expected_dav_cache))
@@ -378,9 +379,9 @@ def upgrade_wcprops(sbox):
   # to be.  (This could be smarter.)
   expected_dav_caches = {
    '' :
-    '(svn:wc:ra_dav:version-url 41 /svn-test-work/local_tmp/repos/!svn/ver/1)',
+    b'(svn:wc:ra_dav:version-url 41 /svn-test-work/local_tmp/repos/!svn/ver/1)',
    'iota' :
-    '(svn:wc:ra_dav:version-url 46 /svn-test-work/local_tmp/repos/!svn/ver/1/iota)',
+    b'(svn:wc:ra_dav:version-url 46 /svn-test-work/local_tmp/repos/!svn/ver/1/iota)',
   }
   check_dav_cache(sbox.wc_dir, 1, expected_dav_caches)
 
@@ -390,7 +391,7 @@ def xml_entries_relocate(path, from_url,
   adm_name = svntest.main.get_admin_name()
   entries = os.path.join(path, adm_name, 'entries')
   txt = open(entries).read().replace('url="' + from_url, 'url="' + to_url)
-  os.chmod(entries, 0777)
+  os.chmod(entries, svntest.main.S_ALL_RWX)
   open(entries, 'w').write(txt)
 
   for dirent in os.listdir(path):
@@ -408,8 +409,8 @@ def simple_entries_replace(path, from_ur
   adm_name = svntest.main.get_admin_name()
   entries = os.path.join(path, adm_name, 'entries')
   txt = open(entries).read().replace(from_url, to_url)
-  os.chmod(entries, 0777)
-  open(entries, 'wb').write(txt)
+  os.chmod(entries, svntest.main.S_ALL_RWX)
+  open(entries, 'wb').write(txt.encode())
 
   for dirent in os.listdir(path):
     item_path = os.path.join(path, dirent)
@@ -1143,21 +1144,21 @@ def upgrade_file_externals(sbox):
   svntest.main.run_svnadmin('setuuid', sbox.repo_dir,
                             '07146bbd-0b64-4aaf-ab70-cd76a0df2d41')
 
-  expected_output = svntest.verify.RegexOutput('r2 committed.*')
+  expected_output = svntest.verify.RegexOutput(b'r2 committed.*')
   svntest.actions.run_and_verify_svnmucc(expected_output, [],
                                          '-m', 'r2',
                                          'propset', 'svn:externals',
                                          '^/A/B/E EX\n^/A/mu muX',
                                          sbox.repo_url + '/A/B/F')
 
-  expected_output = svntest.verify.RegexOutput('r3 committed.*')
+  expected_output = svntest.verify.RegexOutput(b'r3 committed.*')
   svntest.actions.run_and_verify_svnmucc(expected_output, [],
                                          '-m', 'r3',
                                          'propset', 'svn:externals',
                                          '^/A/B/F FX\n^/A/B/lambda lambdaX',
                                          sbox.repo_url + '/A/C')
 
-  expected_output = svntest.verify.RegexOutput('r4 committed.*')
+  expected_output = svntest.verify.RegexOutput(b'r4 committed.*')
   svntest.actions.run_and_verify_svnmucc(expected_output, [],
                                          '-m', 'r4',
                                          'propset', 'pname1', 'pvalue1',
@@ -1462,14 +1463,15 @@ def auto_analyze(sbox):
   # svntest.main.chmod_tree will not reset it.)
   for path, subdirs, files in os.walk(sbox.wc_dir):
     for d in subdirs:
-      os.chmod(os.path.join(path, d), 0555)
+      os.chmod(os.path.join(path, d), svntest.main.S_ALL_RX)
     for f in files:
-      os.chmod(os.path.join(path, f), 0444)
+      os.chmod(os.path.join(path, f), svntest.main.S_ALL_READ)
 
   state = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
   svntest.actions.run_and_verify_status(sbox.wc_dir, state)
 
-  svntest.main.chmod_tree(sbox.wc_dir, 0666, 0022)
+  svntest.main.chmod_tree(sbox.wc_dir, svntest.main.S_ALL_RW,
+                          stat.S_IWGRP | stat.S_IWOTH)
 
   state = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
   svntest.actions.run_and_verify_status(sbox.wc_dir, state)

Modified: subversion/branches/authzperf/subversion/tests/cmdline/wc_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/cmdline/wc_tests.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/cmdline/wc_tests.py (original)
+++ subversion/branches/authzperf/subversion/tests/cmdline/wc_tests.py Sun Jun  5 15:03:52 2016
@@ -142,7 +142,7 @@ def status_with_corrupt_wc_db(sbox):
 
   sbox.build(read_only = True)
   with open(sbox.ospath(".svn/wc.db"), 'wb') as fd:
-    fd.write('\0' * 17)
+    fd.write(b'\0' * 17)
   svntest.actions.run_and_verify_svn(
     None,
     r"[^ ]+ E155016: The working copy database at '.*' is corrupt",
@@ -189,7 +189,7 @@ def status_with_missing_wc_db_and_maybe_
 
   sbox.build(read_only = True)
   with open(sbox.ospath(".svn/entries"), 'ab') as fd:
-    fd.write('something\n')
+    fd.write(b'something\n')
     os.remove(sbox.ospath(".svn/wc.db"))
   svntest.actions.run_and_verify_svn(
     None,

Modified: subversion/branches/authzperf/subversion/tests/libsvn_client/conflicts-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_client/conflicts-test.c?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_client/conflicts-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_client/conflicts-test.c Sun Jun  5 15:03:52 2016
@@ -61,6 +61,7 @@ status_func(void *baton, const char *pat
 static const char *trunk_path = "A";
 static const char *branch_path = "A_branch";
 static const char *new_file_name = "newfile.txt";
+static const char *deleted_file_name = "mu";
 
 /* File property content. */
 static const char *propval_trunk = "This is a property on the trunk.";
@@ -457,9 +458,11 @@ static const char *new_dir_name = "newdi
 
 /* A helper function which prepares a working copy for the tests below. */
 static svn_error_t *
-create_wc_with_dir_add_vs_dir_add_merge_conflict(svn_test__sandbox_t *b,
-                                                 svn_boolean_t file_change,
-                                                 svn_boolean_t with_move)
+create_wc_with_dir_add_vs_dir_add_merge_conflict(
+  svn_test__sandbox_t *b,
+  svn_boolean_t file_change_on_trunk,
+  svn_boolean_t with_move,
+  svn_boolean_t file_change_on_branch)
 {
   static const char *new_dir_path;
   static const char *new_file_path;
@@ -500,10 +503,11 @@ create_wc_with_dir_add_vs_dir_add_merge_
   SVN_ERR(sbox_wc_add(b, new_file_path));
   SVN_ERR(sbox_wc_propset(b, "prop", propval_trunk, new_file_path));
   SVN_ERR(sbox_wc_commit(b, ""));
-  if (file_change)
+  if (file_change_on_trunk)
     {
       SVN_ERR(sbox_file_write(b, new_file_path,
-                              "This is a change to the new file\n"));
+                              "This is a change to the new file"
+                              "on the trunk\n"));
       SVN_ERR(sbox_wc_commit(b, ""));
     }
   if (with_move)
@@ -529,6 +533,14 @@ create_wc_with_dir_add_vs_dir_add_merge_
   SVN_ERR(sbox_wc_propset(b, "prop", propval_branch, new_file_path));
   SVN_ERR(sbox_wc_commit(b, ""));
 
+  if (file_change_on_branch)
+    {
+      SVN_ERR(sbox_file_write(b, new_file_path,
+                              "This is a change to the new file "
+                              "on the branch\n"));
+      SVN_ERR(sbox_wc_commit(b, ""));
+    }
+
   /* Run a merge from the trunk to the branch. */
   SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
 
@@ -596,7 +608,8 @@ test_option_merge_incoming_added_dir_ign
   SVN_ERR(svn_test__sandbox_create(b, "incoming_added_dir_ignore",
                                    opts, pool));
 
-  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, FALSE, FALSE));
+  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, FALSE, FALSE,
+                                                           FALSE));
 
   /* Resolve the tree conflict. */
   SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
@@ -666,7 +679,8 @@ test_option_merge_incoming_added_dir_mer
   SVN_ERR(svn_test__sandbox_create(b, "incoming_added_dir_merge",
                                    opts, pool));
 
-  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, FALSE, FALSE));
+  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, FALSE, FALSE,
+                                                           FALSE));
 
   /* Resolve the tree conflict. */
   SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
@@ -758,7 +772,8 @@ test_option_merge_incoming_added_dir_mer
   SVN_ERR(svn_test__sandbox_create(b, "incoming_added_dir_merge2",
                                    opts, pool));
 
-  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, TRUE, FALSE));
+  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, TRUE, FALSE,
+                                                           FALSE));
 
   /* Resolve the tree conflict. */
   SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
@@ -849,7 +864,8 @@ test_option_merge_incoming_added_dir_mer
   SVN_ERR(svn_test__sandbox_create(b, "incoming_added_dir_merge3",
                                    opts, pool));
 
-  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, TRUE, TRUE));
+  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, TRUE, TRUE,
+                                                           FALSE));
 
   /* Resolve the tree conflict. */
   SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
@@ -941,6 +957,420 @@ test_option_merge_incoming_added_dir_mer
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_option_merge_incoming_added_dir_replace(const svn_test_opts_t *opts,
+                                             apr_pool_t *pool)
+{
+  svn_client_ctx_t *ctx;
+  svn_client_conflict_t *conflict;
+  const char *new_dir_path;
+  svn_boolean_t text_conflicted;
+  apr_array_header_t *props_conflicted;
+  svn_boolean_t tree_conflicted;
+  struct status_baton sb;
+  struct svn_client_status_t *status;
+  svn_opt_revision_t opt_rev;
+  svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+
+  SVN_ERR(svn_test__sandbox_create(b, "incoming_added_dir_replace",
+                                   opts, pool));
+
+  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, FALSE, FALSE,
+                                                           FALSE));
+
+  /* Resolve the tree conflict. */
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+  new_dir_path = svn_relpath_join(branch_path, new_dir_name, b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_dir_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_tree_get_details(conflict, b->pool));
+  SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+            conflict,
+            svn_client_conflict_option_merge_incoming_added_dir_replace,
+            b->pool));
+
+  /* Ensure that the directory has the expected status. */
+  opt_rev.kind = svn_opt_revision_working;
+  sb.result_pool = b->pool;
+  SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, new_dir_path),
+                             &opt_rev, svn_depth_unknown, TRUE, TRUE,
+                             TRUE, TRUE, FALSE, TRUE, NULL,
+                             status_func, &sb, b->pool));
+  status = sb.status;
+  SVN_TEST_ASSERT(status->kind == svn_node_dir);
+  SVN_TEST_ASSERT(status->versioned);
+  SVN_TEST_ASSERT(!status->conflicted);
+  SVN_TEST_ASSERT(status->node_status == svn_wc_status_replaced);
+  SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+  SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+  SVN_TEST_ASSERT(status->copied);
+  SVN_TEST_ASSERT(!status->switched);
+  SVN_TEST_ASSERT(!status->file_external);
+  SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+  SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_dir_path),
+                                  ctx, b->pool, b->pool));
+
+  /* The directory should not be in conflict. */
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(!text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  return SVN_NO_ERROR;
+}
+
+/* This test currently fails to meet expectations. Our merge code doesn't
+ * support a merge of files which were added in the same revision as their
+ * parent directory and were not modified since. */
+static svn_error_t *
+test_option_merge_incoming_added_dir_replace_and_merge(
+  const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_client_ctx_t *ctx;
+  svn_client_conflict_t *conflict;
+  const char *new_dir_path;
+  const char *new_file_path;
+  svn_boolean_t text_conflicted;
+  apr_array_header_t *props_conflicted;
+  svn_boolean_t tree_conflicted;
+  struct status_baton sb;
+  struct svn_client_status_t *status;
+  svn_opt_revision_t opt_rev;
+  svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+
+  SVN_ERR(svn_test__sandbox_create(b, "incoming_added_dir_replace_and_merge",
+                                   opts, pool));
+
+  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, FALSE, FALSE,
+                                                           FALSE));
+
+  /* Resolve the tree conflict. */
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+  new_dir_path = svn_relpath_join(branch_path, new_dir_name, b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_dir_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_tree_get_details(conflict, b->pool));
+  SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+            conflict,
+            svn_client_conflict_option_merge_incoming_added_dir_replace_and_merge,
+            b->pool));
+
+  /* Ensure that the directory has the expected status. */
+  opt_rev.kind = svn_opt_revision_working;
+  sb.result_pool = b->pool;
+  SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, new_dir_path),
+                             &opt_rev, svn_depth_unknown, TRUE, TRUE,
+                             TRUE, TRUE, FALSE, TRUE, NULL,
+                             status_func, &sb, b->pool));
+  status = sb.status;
+  SVN_TEST_ASSERT(status->kind == svn_node_dir);
+  SVN_TEST_ASSERT(status->versioned);
+  SVN_TEST_ASSERT(!status->conflicted);
+  SVN_TEST_ASSERT(status->node_status == svn_wc_status_replaced);
+  SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+  SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+  SVN_TEST_ASSERT(status->copied);
+  SVN_TEST_ASSERT(!status->switched);
+  SVN_TEST_ASSERT(!status->file_external);
+  SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+  SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_dir_path),
+                                  ctx, b->pool, b->pool));
+
+  /* The directory should not be in conflict. */
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(!text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  /* We should have a text conflict in the file. */
+  new_file_path = svn_relpath_join(branch_path,
+                                   svn_relpath_join(new_dir_name,
+                                                    new_file_name, b->pool),
+                                   b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_file_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  return SVN_NO_ERROR;
+}
+
+/* Same test as above, but with an additional file change on the branch
+ * which makes resolution work as expected. */
+static svn_error_t *
+test_option_merge_incoming_added_dir_replace_and_merge2(
+  const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_client_ctx_t *ctx;
+  svn_client_conflict_t *conflict;
+  const char *new_dir_path;
+  const char *new_file_path;
+  svn_boolean_t text_conflicted;
+  apr_array_header_t *props_conflicted;
+  svn_boolean_t tree_conflicted;
+  struct status_baton sb;
+  struct svn_client_status_t *status;
+  svn_opt_revision_t opt_rev;
+  svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+
+  SVN_ERR(svn_test__sandbox_create(b, "incoming_added_dir_replace_and_merge",
+                                   opts, pool));
+
+  SVN_ERR(create_wc_with_dir_add_vs_dir_add_merge_conflict(b, FALSE, FALSE,
+                                                           TRUE));
+
+  /* Resolve the tree conflict. */
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+  new_dir_path = svn_relpath_join(branch_path, new_dir_name, b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_dir_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_tree_get_details(conflict, b->pool));
+  SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+            conflict,
+            svn_client_conflict_option_merge_incoming_added_dir_replace_and_merge,
+            b->pool));
+
+  /* Ensure that the directory has the expected status. */
+  opt_rev.kind = svn_opt_revision_working;
+  sb.result_pool = b->pool;
+  SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, new_dir_path),
+                             &opt_rev, svn_depth_unknown, TRUE, TRUE,
+                             TRUE, TRUE, FALSE, TRUE, NULL,
+                             status_func, &sb, b->pool));
+  status = sb.status;
+  SVN_TEST_ASSERT(status->kind == svn_node_dir);
+  SVN_TEST_ASSERT(status->versioned);
+  SVN_TEST_ASSERT(!status->conflicted);
+  SVN_TEST_ASSERT(status->node_status == svn_wc_status_replaced);
+  SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+  SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+  SVN_TEST_ASSERT(status->copied);
+  SVN_TEST_ASSERT(!status->switched);
+  SVN_TEST_ASSERT(!status->file_external);
+  SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+  SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_dir_path),
+                                  ctx, b->pool, b->pool));
+
+  /* The directory should not be in conflict. */
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(!text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  /* We should have a text conflict in the file. */
+  new_file_path = svn_relpath_join(branch_path,
+                                   svn_relpath_join(new_dir_name,
+                                                    new_file_name, b->pool),
+                                   b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, new_file_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  return SVN_NO_ERROR;
+}
+
+/* A helper function which prepares a working copy for the tests below. */
+static svn_error_t *
+create_wc_with_incoming_delete_merge_conflict(svn_test__sandbox_t *b)
+{
+  svn_client_ctx_t *ctx;
+  static const char *trunk_url;
+  svn_opt_revision_t opt_rev;
+  const char *deleted_path;
+
+  SVN_ERR(sbox_add_and_commit_greek_tree(b));
+
+  /* Create a branch of node "A". */
+  SVN_ERR(sbox_wc_copy(b, trunk_path, branch_path));
+  SVN_ERR(sbox_wc_commit(b, ""));
+
+  /* Delete a file on the trunk. */
+  deleted_path = svn_relpath_join(trunk_path, deleted_file_name, b->pool);
+  SVN_ERR(sbox_wc_delete(b, deleted_path));
+  SVN_ERR(sbox_wc_commit(b, ""));
+
+  /* Modify a file on the branch. */
+  deleted_path = svn_relpath_join(branch_path, deleted_file_name, b->pool);
+  SVN_ERR(sbox_file_write(b, deleted_path,
+                          "This is a modified file on the branch\n"));
+  SVN_ERR(sbox_wc_commit(b, ""));
+
+  /* Run a merge from the trunk to the branch. */
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+
+  SVN_ERR(sbox_wc_update(b, "", SVN_INVALID_REVNUM));
+  trunk_url = apr_pstrcat(b->pool, b->repos_url, "/", trunk_path, SVN_VA_NULL);
+
+  opt_rev.kind = svn_opt_revision_head;
+  opt_rev.value.number = SVN_INVALID_REVNUM;
+  /* This should raise an "incoming delete vs local edit" tree conflict. */
+  SVN_ERR(svn_client_merge_peg5(trunk_url, NULL, &opt_rev,
+                                sbox_wc_path(b, branch_path),
+                                svn_depth_infinity,
+                                FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
+                                NULL, ctx, b->pool));
+
+  return SVN_NO_ERROR;
+}
+
+/* Test 'incoming delete ignore' option. */
+static svn_error_t *
+test_option_merge_incoming_delete_ignore(
+  const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+  svn_client_ctx_t *ctx;
+  const char *deleted_path;
+  svn_client_conflict_t *conflict;
+  svn_boolean_t tree_conflicted;
+  svn_boolean_t text_conflicted;
+  apr_array_header_t *props_conflicted;
+  struct status_baton sb;
+  struct svn_client_status_t *status;
+  svn_opt_revision_t opt_rev;
+
+  SVN_ERR(svn_test__sandbox_create(b, "incoming_delete_ignore",
+                                   opts, pool));
+
+  SVN_ERR(create_wc_with_incoming_delete_merge_conflict(b));
+
+  /* Resolve the tree conflict. */
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+  deleted_path = svn_relpath_join(branch_path, deleted_file_name, b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_tree_get_details(conflict, b->pool));
+  SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+            conflict, svn_client_conflict_option_incoming_delete_ignore,
+            b->pool));
+
+  /* Ensure that the deleted file has the expected status. */
+  opt_rev.kind = svn_opt_revision_working;
+  sb.result_pool = b->pool;
+  SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, deleted_path),
+                             &opt_rev, svn_depth_unknown, TRUE, TRUE,
+                             TRUE, TRUE, FALSE, TRUE, NULL,
+                             status_func, &sb, b->pool));
+  status = sb.status;
+  SVN_TEST_ASSERT(status->kind == svn_node_file);
+  SVN_TEST_ASSERT(status->versioned);
+  SVN_TEST_ASSERT(!status->conflicted);
+  SVN_TEST_ASSERT(status->node_status == svn_wc_status_normal);
+  SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+  SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+  SVN_TEST_ASSERT(!status->copied);
+  SVN_TEST_ASSERT(!status->switched);
+  SVN_TEST_ASSERT(!status->file_external);
+  SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+  SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+  
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
+                                  ctx, b->pool, b->pool));
+
+  /* The file should not be in conflict. */
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(!text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  return SVN_NO_ERROR;
+}
+
+/* Test 'incoming delete accept' option. */
+static svn_error_t *
+test_option_merge_incoming_delete_accept(
+  const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+  svn_test__sandbox_t *b = apr_palloc(pool, sizeof(*b));
+  svn_client_ctx_t *ctx;
+  const char *deleted_path;
+  svn_client_conflict_t *conflict;
+  svn_boolean_t tree_conflicted;
+  svn_boolean_t text_conflicted;
+  apr_array_header_t *props_conflicted;
+  struct status_baton sb;
+  struct svn_client_status_t *status;
+  svn_opt_revision_t opt_rev;
+
+  SVN_ERR(svn_test__sandbox_create(b, "incoming_delete_accept",
+                                   opts, pool));
+
+  SVN_ERR(create_wc_with_incoming_delete_merge_conflict(b));
+
+  /* Resolve the tree conflict. */
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+  deleted_path = svn_relpath_join(branch_path, deleted_file_name, b->pool);
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
+                                  ctx, b->pool, b->pool));
+  SVN_ERR(svn_client_conflict_tree_get_details(conflict, b->pool));
+  SVN_ERR(svn_client_conflict_tree_resolve_by_id(
+            conflict, svn_client_conflict_option_incoming_delete_accept,
+            b->pool));
+
+  /* Ensure that the deleted file has the expected status. */
+  opt_rev.kind = svn_opt_revision_working;
+  sb.result_pool = b->pool;
+  SVN_ERR(svn_client_status6(NULL, ctx, sbox_wc_path(b, deleted_path),
+                             &opt_rev, svn_depth_unknown, TRUE, TRUE,
+                             TRUE, TRUE, FALSE, TRUE, NULL,
+                             status_func, &sb, b->pool));
+  status = sb.status;
+  SVN_TEST_ASSERT(status->kind == svn_node_file);
+  SVN_TEST_ASSERT(status->versioned);
+  SVN_TEST_ASSERT(!status->conflicted);
+  SVN_TEST_ASSERT(status->node_status == svn_wc_status_deleted);
+  SVN_TEST_ASSERT(status->text_status == svn_wc_status_normal);
+  SVN_TEST_ASSERT(status->prop_status == svn_wc_status_none);
+  SVN_TEST_ASSERT(!status->copied);
+  SVN_TEST_ASSERT(!status->switched);
+  SVN_TEST_ASSERT(!status->file_external);
+  SVN_TEST_ASSERT(status->moved_from_abspath == NULL);
+  SVN_TEST_ASSERT(status->moved_to_abspath == NULL);
+
+  SVN_ERR(svn_client_conflict_get(&conflict, sbox_wc_path(b, deleted_path),
+                                  ctx, b->pool, b->pool));
+
+  /* The file should not be in conflict. */
+  SVN_ERR(svn_client_conflict_get_conflicted(&text_conflicted,
+                                             &props_conflicted,
+                                             &tree_conflicted,
+                                             conflict, b->pool, b->pool));
+  SVN_TEST_ASSERT(!text_conflicted &&
+                  props_conflicted->nelts == 0 &&
+                  !tree_conflicted);
+
+  return SVN_NO_ERROR;
+}
+
 /* ========================================================================== */
 
 
@@ -965,6 +1395,16 @@ static struct svn_test_descriptor_t test
                        "test incoming add dir merge with file change"),
     SVN_TEST_OPTS_XFAIL(test_option_merge_incoming_added_dir_merge3,
                        "test incoming add dir merge with move history"),
+    SVN_TEST_OPTS_PASS(test_option_merge_incoming_added_dir_replace,
+                       "test incoming add dir replace"),
+    SVN_TEST_OPTS_XFAIL(test_option_merge_incoming_added_dir_replace_and_merge,
+                       "test incoming add dir replace and merge"),
+    SVN_TEST_OPTS_PASS(test_option_merge_incoming_added_dir_replace_and_merge2,
+                       "test incoming add dir replace and merge"),
+    SVN_TEST_OPTS_PASS(test_option_merge_incoming_delete_ignore,
+                       "test merge incoming delete ignore"),
+    SVN_TEST_OPTS_PASS(test_option_merge_incoming_delete_accept,
+                       "test merge incoming delete accept"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c Sun Jun  5 15:03:52 2016
@@ -7137,9 +7137,9 @@ commit_with_locked_rep_cache(const svn_t
   const char *fs_path;
   const char *statements[] = { "SELECT MAX(revision) FROM rep_cache", NULL };
 
-  if (strcmp(opts->fs_type, SVN_FS_TYPE_FSFS) != 0)
+  if (strcmp(opts->fs_type, SVN_FS_TYPE_BDB) == 0)
     return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
-                            "this will test FSFS repositories only");
+                            "this will not test BDB repositories");
 
   if (opts->server_minor_version && (opts->server_minor_version < 6))
     return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,

Modified: subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c Sun Jun  5 15:03:52 2016
@@ -737,7 +737,7 @@ test_info(const svn_test_opts_t *opts,
           apr_pool_t *pool)
 {
   svn_fs_t *fs;
-  const svn_fs_fsfs_info_t *fsfs_info;
+  const svn_fs_fsx_info_t *fsx_info;
   const svn_fs_info_placeholder_t *info;
 
   SVN_ERR(create_packed_filesystem(REPO_NAME, opts, MAX_REV, SHARD_SIZE,
@@ -753,9 +753,9 @@ test_info(const svn_test_opts_t *opts,
   if (strcmp(opts->fs_type, "fsx") != 0)
     return SVN_NO_ERROR;
 
-  fsfs_info = (const void *)info;
-  SVN_TEST_ASSERT(fsfs_info->shard_size == SHARD_SIZE);
-  SVN_TEST_ASSERT(fsfs_info->min_unpacked_rev
+  fsx_info = (const void *)info;
+  SVN_TEST_ASSERT(fsx_info->shard_size == SHARD_SIZE);
+  SVN_TEST_ASSERT(fsx_info->min_unpacked_rev
                   == (MAX_REV + 1) / SHARD_SIZE * SHARD_SIZE);
 
   return SVN_NO_ERROR;
@@ -873,7 +873,7 @@ test_batch_fsync(const svn_test_opts_t *
   SVN_ERR(svn_fs_x__batch_fsync_init());
 
   /* We use and re-use the same batch object throughout this test. */
-  SVN_ERR(svn_fs_x__batch_fsync_create(&batch, pool));
+  SVN_ERR(svn_fs_x__batch_fsync_create(&batch, TRUE, pool));
 
   /* The working directory is new. */
   SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, abspath, pool));

Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c Sun Jun  5 15:03:52 2016
@@ -674,6 +674,68 @@ test_file_readline(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_open_uniquely_named(apr_pool_t *pool)
+{
+  const char *tmp_dir;
+  apr_file_t *file;
+  const char *path;
+  svn_error_t *err;
+
+  SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "test_open_uniquely_named",
+                                    pool));
+
+  /* Test #1: File 'foo.tmp' doesn't exist. */
+  SVN_ERR(svn_io_open_uniquely_named(&file, &path, tmp_dir, "foo", ".tmp",
+                                     svn_io_file_del_none, pool, pool));
+  SVN_TEST_STRING_ASSERT(path, svn_dirent_join(tmp_dir, "foo.tmp", pool));
+  SVN_ERR(svn_io_file_close(file, pool));
+
+  /* Test #2: File 'foo.tmp' is already exist. */
+  SVN_ERR(svn_io_open_uniquely_named(NULL, &path, tmp_dir, "foo", ".tmp",
+                                     svn_io_file_del_none, pool, pool));
+  SVN_TEST_STRING_ASSERT(path, svn_dirent_join(tmp_dir, "foo.2.tmp", pool));
+
+  /* Test #3: Directory named 'bar.tmp' is already exist. */
+  SVN_ERR(svn_io_dir_make(svn_dirent_join(tmp_dir, "bar.tmp", pool),
+                          APR_OS_DEFAULT, pool));
+  SVN_ERR(svn_io_open_uniquely_named(NULL, &path, tmp_dir, "bar", ".tmp",
+                                     svn_io_file_del_none, pool, pool));
+  SVN_TEST_STRING_ASSERT(path, svn_dirent_join(tmp_dir, "bar.2.tmp", pool));
+
+
+  /* Test #4: Attempt create file in non-existing directory. */
+  err = svn_io_open_uniquely_named(NULL, &path,
+                                   svn_dirent_join(tmp_dir, "non-existing", pool),
+                                   NULL, NULL, svn_io_file_del_none, pool, pool);
+  if (err && APR_STATUS_IS_ENOENT(err->apr_err))
+    {
+      svn_error_clear(err);
+    }
+  else if (err)
+    {
+      return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+                               "Expected error APR_STATUS_IS_ENOTDIR() but "
+                               "got %s",
+                               svn_error_symbolic_name(err->apr_err));
+    }
+  else
+    {
+      SVN_TEST_ASSERT_ANY_ERROR(err);
+    }
+
+  /* Test #5: File 'yota.tmp' is already exist and readonly. */
+  SVN_ERR(svn_io_file_create_empty(svn_dirent_join(tmp_dir, "yota.tmp", pool),
+                                   pool));
+  SVN_ERR(svn_io_set_file_read_only(svn_dirent_join(tmp_dir, "yota.tmp", pool),
+                                    FALSE, pool));
+  SVN_ERR(svn_io_open_uniquely_named(NULL, &path, tmp_dir, "yota", ".tmp",
+                                    svn_io_file_del_none, pool, pool));
+  SVN_TEST_STRING_ASSERT(path, svn_dirent_join(tmp_dir, "yota.2.tmp", pool));
+
+  return SVN_NO_ERROR;
+}
+
 /* Move the read pointer in FILE to absolute position OFFSET and align
  * the read buffer to multiples of BLOCK_SIZE.  BUFFERED is set only if
  * FILE actually uses a read buffer.  Use POOL for allocations.
@@ -1073,6 +1135,8 @@ static struct svn_test_descriptor_t test
                    "test svn_io_read_length_line()"),
     SVN_TEST_PASS2(test_file_readline,
                    "test svn_io_file_readline()"),
+    SVN_TEST_PASS2(test_open_uniquely_named,
+                   "test svn_io_open_uniquely_named()"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/authzperf/subversion/tests/manual/tree-conflicts-add-vs-add.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/manual/tree-conflicts-add-vs-add.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/manual/tree-conflicts-add-vs-add.py (original)
+++ subversion/branches/authzperf/subversion/tests/manual/tree-conflicts-add-vs-add.py Sun Jun  5 15:03:52 2016
@@ -39,9 +39,9 @@ from itertools import product
 def run_cmd(cmd, verbose=True, shell=False):
   if verbose:
     if shell:
-      print '\n---', cmd
+      print('\n---', cmd)
     else:
-      print '\n---', ' '.join(cmd)
+      print('\n---', ' '.join(cmd))
   p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=shell)
   stdout,stderr = p.communicate()[0:2]
   if verbose and stdout:
@@ -254,7 +254,7 @@ def co(name, local_action, local_kind, i
   svn('up', ctx.WC)
 
   head = ctx.head()
-  print head
+  print(head)
 
   ctx.create_wc2()
   target = ctx.wc2(name)
@@ -289,7 +289,7 @@ def up(name, local_action, local_kind, i
   svn('up', ctx.WC)
 
   head = ctx.head()
-  print head
+  print(head)
 
   target = ctx.wc(name)
   incoming_action(ctx, target, incoming_kind, 'incoming')
@@ -401,12 +401,12 @@ try:
     if skip(row):
       continue
     name = nameof(row)
-    print name
+    print(name)
     test_func = row[0]
     results.append( (name, analyze( name, test_func( name, *row[1:] ) )) )
 except:
   if name:
-    print 'Error during', name
+    print('Error during', name)
   raise
 finally:
   lines = []
@@ -419,5 +419,5 @@ finally:
     else:
       lines.append('----- ' + name + ': nothing.')
   dump = '\n'.join(lines)
-  print dump
+  print(dump)
   rewrite_file('tree-conflicts-add-vs-add.py.results', dump)

Modified: subversion/branches/authzperf/tools/client-side/change-svn-wc-format.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/tools/client-side/change-svn-wc-format.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/tools/client-side/change-svn-wc-format.py (original)
+++ subversion/branches/authzperf/tools/client-side/change-svn-wc-format.py Sun Jun  5 15:03:52 2016
@@ -24,6 +24,7 @@
 import sys
 import os
 import getopt
+import stat
 try:
   my_getopt = getopt.gnu_getopt
 except AttributeError:
@@ -96,7 +97,7 @@ class WCFormatConverter:
       print("Parsing file '%s'" % entries.path)
     try:
       entries.parse(self.verbosity)
-    except UnrecognizedWCFormatException, e:
+    except UnrecognizedWCFormatException as e:
       if self.error_on_unrecognized:
         raise
       sys.stderr.write("%s, skipping\n" % e)
@@ -116,7 +117,7 @@ class WCFormatConverter:
       print("Checking whether WC format can be converted")
     try:
       entries.assert_valid_format(format_nbr, self.verbosity)
-    except LossyConversionException, e:
+    except LossyConversionException as e:
       # In --force mode, ignore complaints about lossy conversion.
       if self.force:
         print("WARNING: WC format conversion will be lossy. Dropping "\
@@ -265,11 +266,11 @@ class Entries:
     assert len(str(format_nbr)) <= self.format_nbr_bytes
     format_string = '%0' + str(self.format_nbr_bytes) + 'd'
 
-    os.chmod(self.path, 0600)
+    os.chmod(self.path, stat.S_IRUSR | stat.S_IWUSR)
     output = open(self.path, "r+", 0)
     output.write(format_string % format_nbr)
     output.close()
-    os.chmod(self.path, 0400)
+    os.chmod(self.path, stat.S_IRUSR)
 
 class Entry:
   "Describes an entry in a WC."
@@ -334,14 +335,14 @@ class Format:
     if os.path.exists(self.path):
       if verbosity >= 1:
         print("%s will be updated." % self.path)
-      os.chmod(self.path,0600)
+      os.chmod(self.path, stat.S_IRUSR | stat.S_IWUSR)
     else:
       if verbosity >= 1:
         print("%s does not exist, creating it." % self.path)
     format = open(self.path, "w")
     format.write(format_string % format_nbr)
     format.close()
-    os.chmod(self.path, 0400)
+    os.chmod(self.path, stat.S_IRUSR)
 
 class LocalException(Exception):
   """Root of local exception class hierarchy."""
@@ -405,7 +406,7 @@ def main():
 
   try:
     converter.change_wc_format(new_format_nbr)
-  except LocalException, e:
+  except LocalException as e:
     if debug:
       raise
     sys.stderr.write("%s\n" % e)

Modified: subversion/branches/authzperf/tools/client-side/mergeinfo-sanitizer.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/tools/client-side/mergeinfo-sanitizer.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/tools/client-side/mergeinfo-sanitizer.py (original)
+++ subversion/branches/authzperf/tools/client-side/mergeinfo-sanitizer.py Sun Jun  5 15:03:52 2016
@@ -106,14 +106,14 @@ def location_segment_callback(segment, p
 # This function does the authentication in an interactive way
 ##
 def prompt_func_ssl_unknown_cert(realm, failures, cert_info, may_save, pool):
-  print "The certificate details are as follows:"
-  print "--------------------------------------"
-  print "Issuer     : " + str(cert_info.issuer_dname)
-  print "Hostname   : " + str(cert_info.hostname)
-  print "ValidFrom  : " + str(cert_info.valid_from)
-  print "ValidUpto  : " + str(cert_info.valid_until)
-  print "Fingerprint: " + str(cert_info.fingerprint)
-  print ""
+  print("The certificate details are as follows:")
+  print("--------------------------------------")
+  print("Issuer     : " + str(cert_info.issuer_dname))
+  print("Hostname   : " + str(cert_info.hostname))
+  print("ValidFrom  : " + str(cert_info.valid_from))
+  print("ValidUpto  : " + str(cert_info.valid_until))
+  print("Fingerprint: " + str(cert_info.fingerprint))
+  print("")
   ssl_trust = core.svn_auth_cred_ssl_server_trust_t()
   if may_save:
     choice = raw_input( "accept (t)temporarily   (p)permanently: ")
@@ -166,7 +166,7 @@ def get_new_location_segments(parsed_ori
                                      revision_range.end, revision_range.start + 1, location_segment_callback)
           except svn.core.SubversionException:
             sys.stderr.write(" Could not find location segments for %s \n" % path)
-      except Exception, e:
+      except Exception as e:
         sys.stderr.write("")
 
 
@@ -182,13 +182,13 @@ def sanitize_mergeinfo(parsed_original_m
                                            mergeinfo, 1, temp_pool)
   #There should be no mergeinfo added by our population. There should only
   #be deletion of mergeinfo. so take it from diff_mergeinfo[0]
-  print "The bogus mergeinfo summary:"
+  print("The bogus mergeinfo summary:")
   bogus_mergeinfo_deleted = diff_mergeinfo[0]
   for bogus_mergeinfo_path in bogus_mergeinfo_deleted:
     sys.stdout.write(bogus_mergeinfo_path + ": ")
     for revision_range in bogus_mergeinfo_deleted[bogus_mergeinfo_path]:
       sys.stdout.write(str(revision_range.start + 1) + "-" + str(revision_range.end) + ",")
-    print ""
+    print("")
 
 ##
 # This function tries to 'propset the new mergeinfo into the working copy.
@@ -204,7 +204,7 @@ def fix_sanitized_mergeinfo(parsed_origi
     with open(hash_file, "r") as f:
       old_hash = pickle.load(f)
     f.close
-  except IOError, e:
+  except IOError as e:
     get_new_location_segments(parsed_original_mergeinfo, repo_root, wcpath, ctx)
     hasher(hash_file, newmergeinfo_file)
     try:
@@ -217,7 +217,7 @@ def fix_sanitized_mergeinfo(parsed_origi
     with open(newmergeinfo_file, "r") as f:
       new_hash = md5_of_file(f)
     f.close
-  except IOError, e:
+  except IOError as e:
     if not mergeinfo:
       get_new_location_segments(parsed_original_mergeinfo, repo_root, wcpath, ctx)
     hasher(hash_file, newmergeinfo_file)
@@ -233,7 +233,7 @@ def fix_sanitized_mergeinfo(parsed_origi
       os.remove(newmergeinfo_file)
       os.remove(hash_file)
   else:
-    print "The hashes are not matching. Probable chance of unwanted tweaking in the mergeinfo"
+    print("The hashes are not matching. Probable chance of unwanted tweaking in the mergeinfo")
 
 
 ##
@@ -242,8 +242,8 @@ def fix_sanitized_mergeinfo(parsed_origi
 def check_local_modifications(wcpath, temp_pool):
   has_local_mod = wc.svn_wc_revision_status(wcpath, None, 0, None, temp_pool)
   if has_local_mod.modified:
-    print """The working copy has local modifications. Please revert them or clean
-the working copy before running the script."""
+    print("""The working copy has local modifications. Please revert them or clean
+the working copy before running the script.""")
     sys.exit(1)
 
 def get_original_mergeinfo(wcpath, revision, depth, ctx, temp_pool):
@@ -263,7 +263,7 @@ def get_original_mergeinfo(wcpath, revis
 def main():
   try:
     opts, args = my_getopt(sys.argv[1:], "h?f", ["help", "fix"])
-  except Exception, e:
+  except Exception as e:
     sys.stderr.write(""" Improperly used """)
     sys.exit(1)
 
@@ -313,7 +313,7 @@ if __name__ == "__main__":
   try:
     main()
   except KeyboardInterrupt:
-    print ""
+    print("")
     sys.stderr.write("The script is interrupted and stopped manually.")
-    print ""
+    print("")
 

Modified: subversion/branches/authzperf/tools/client-side/svn-vendor.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/tools/client-side/svn-vendor.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/tools/client-side/svn-vendor.py (original)
+++ subversion/branches/authzperf/tools/client-side/svn-vendor.py Sun Jun  5 15:03:52 2016
@@ -313,7 +313,7 @@ class Config(dict):
             for s in o.helpmsg.split('\n'):
                 print("# %s" % s)
             print("%-20s: %s" % (k, str(o)))
-            print()
+            print("")
 
 
 class SvnVndImport(cmd.Cmd):
@@ -336,6 +336,13 @@ class SvnVndImport(cmd.Cmd):
                     "  'dereference' treats as normal files/dirs (and " +
                     "ignores dangling links);\n" +
                     "  'as-is' imports as symlinks"))
+        self.config.add_option('exec-permission',
+                ConfigOpt("preserve", "How 'executable' permission bits " +
+                    "are handled;\n" +
+                    "  'preserve' sets svn:executable property as in " +
+                    "imported sources;\n" +
+                    "  'clear' removes svn:executable on all new files " +
+                    "(but keeps it intact on existing files)."))
         self.config.add_option('save-diff-copied',
                 ConfigOpt(None, "Save 'svn diff' output on the " +
                     "moved/copied files and directories to this " +
@@ -419,7 +426,7 @@ class SvnVndImport(cmd.Cmd):
         except InvalidUsageException as e:
             if e.cmd is not None:
                 print("!!! Invalid usage of `%s' command: %s" % (e.cmd, e))
-                print()
+                print("")
                 self.onecmd("help " + e.cmd)
             else:
                 print("!!! %s" % e)
@@ -807,7 +814,28 @@ class SvnVndImport(cmd.Cmd):
         dirs_removed = []
         files_added = []
         files_removed = []
+        files_set_exec = []
+        files_clear_exec = []
+
         self.info(2, "  Creating dirs and copying files...")
+        def copyfile_helper(i, nk_wc):
+            '''Helper: copy a file and optionally, transfer permissions.'''
+            f = os.path.join(self.importdir, i)
+            t = os.path.join(self.wcdir, i)
+            shutil.copyfile(f, t)
+            # If exec-permission is 'clear', we don't need to do anything:
+            # shutil.copyfile will create the file as non-executable.
+            if self.config.get('exec-permission') == 'preserve':
+                # If the file is new, just copying the mode is enough:
+                # svn will set the svn:executable upon adding it.
+                if nk_wc == "F":
+                    # Existing file, check what the setting shall be
+                    if os.access(f, os.X_OK) and not os.access(t, os.X_OK):
+                        files_set_exec.append(i)
+                    elif not os.access(f, os.X_OK) and os.access(t, os.X_OK):
+                        files_clear_exec.append(i)
+                shutil.copymode(f, t)
+
         for i in sorted(self.items.keys()):
             e = self.items[i]
             nk_wc = e.state[S_WC]
@@ -822,8 +850,7 @@ class SvnVndImport(cmd.Cmd):
                     flg = "(added dir)"
                 elif nk_im == "F":
                     # New file added
-                    shutil.copyfile(os.path.join(self.importdir, i),
-                            os.path.join(self.wcdir, i))
+                    copyfile_helper(i, nk_wc);
                     files_added.append(i)
                     flg = "(added file)"
                 elif nk_im == "L":
@@ -856,8 +883,7 @@ class SvnVndImport(cmd.Cmd):
                 elif nk_im == "F":
                     # Symlink replaced with file.
                     self.run_svn(["rm", "--force", i])
-                    shutil.copyfile(os.path.join(self.importdir, i),
-                            os.path.join(self.wcdir, i))
+                    copyfile_helper(i, nk_wc);
                     files_added.append(i)
                     flg = "(replaced symlink with file)"
                 else:
@@ -874,8 +900,7 @@ class SvnVndImport(cmd.Cmd):
                     flg = "(replaced file with dir)"
                 elif nk_im == "F":
                     # Was a file, is a file - just copy contents
-                    shutil.copyfile(os.path.join(self.importdir, i),
-                            os.path.join(self.wcdir, i))
+                    copyfile_helper(i, nk_wc);
                     flg = "(copied)"
                 elif nk_im == "L":
                     # Was a file, now a symlink. Replace.
@@ -896,15 +921,17 @@ class SvnVndImport(cmd.Cmd):
                 elif nk_im == "F":
                     # Directory replaced with file. Need to remove dir
                     # immediately, as bulk removals/additions assume new files
-                    # and dirs already in place.
+                    # and dirs already in place. Also, removing a directory
+                    # removes all its descendants - mark them as removed.
                     self.run_svn(["rm", "--force", i])
-                    shutil.copyfile(os.path.join(self.importdir, i),
-                            os.path.join(self.wcdir, i))
+                    self.items.wc_remove(i)
+                    copyfile_helper(i, nk_wc);
                     files_added.append(i)
                     flg = "(replaced dir with file)"
                 elif nk_im == "L":
                     # Was a directory, now a symlink. Replace.
                     self.run_svn(["rm", "--force", i])
+                    self.items.wc_remove(i)
                     tim = os.readlink(os.path.join(self.importdir, i))
                     os.symlink(tim, os.path.join(self.wcdir, i))
                     files_added.append(i)
@@ -924,7 +951,7 @@ class SvnVndImport(cmd.Cmd):
             dirs_added, files_added))
         dirs_added = list(filter(lambda x: os.path.dirname(x) not in
             dirs_added, dirs_added))
-        self.info(2, "  Running SVN add/rm commands");
+        self.info(2, "  Running SVN add/rm/propset/propdel commands");
         if len(dirs_added):
             self.run_svn(["add"], dirs_added)
         if len(files_added):
@@ -933,6 +960,10 @@ class SvnVndImport(cmd.Cmd):
             self.run_svn(["rm"], dirs_removed)
         if len(files_removed):
             self.run_svn(["rm"], files_removed)
+        if len(files_set_exec):
+            self.run_svn(["propset", "svn:executable", "*"], files_set_exec)
+        if len(files_clear_exec):
+            self.run_svn(["propdel", "svn:executable"], files_clear_exec)
         # Save the diff for the copied/moved items
         diff_save = self.config.get('save-diff-copied')
         if diff_save is not None:
@@ -1010,7 +1041,7 @@ class SvnVndImport(cmd.Cmd):
         colsz = int((self.termwidth - 14) / 2)
         if len(self.prepare_ops):
             print("Currently recorded preparatory operations:")
-            print()
+            print("")
             print("%5s  %s  %-*s  %-*s" %
                     ("#", "Op", colsz, "Source", colsz, "Destination"))
             for id, o in enumerate(self.prepare_ops):
@@ -1022,10 +1053,10 @@ class SvnVndImport(cmd.Cmd):
                             (id, o[0], colsz, o[1], colsz, o[2]))
                 else:
                     print("%5d  %s  %-*s" % (id, o[0], colsz, o[1]))
-            print()
+            print("")
         else:
             print("No copies/moves/removals recorded")
-            print()
+            print("")
 
     def do_save(self, arg):
         '''
@@ -1131,7 +1162,7 @@ if __name__ == '__main__':
     if p.returncode != 0:
         print("%s: does not appear to be SVN working copy." % args.wcdir)
         print("`svn info' exited with status %d and returned:" % p.returncode)
-        print()
+        print("")
         print(se.decode())
         sys.exit(1)
     imp = SvnVndImport(args.wcdir, args.importdir, so.decode())

Modified: subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/copy_repo.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/copy_repo.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/copy_repo.py (original)
+++ subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/copy_repo.py Sun Jun  5 15:03:52 2016
@@ -296,15 +296,15 @@ def copy_repos(src, dst, count, separato
 def show_usage():
   """ Write a simple CL docstring """
 
-  print "Copies and duplicates repositories in a way that mimics larger deployments."
-  print
-  print "Usage:"
-  print "copy_repo.py SRC DST COUNT SEPARATOR_SIZE"
-  print
-  print "SRC            Immediate parent folder of all the repositories to copy."
-  print "DST            Folder to copy into; current contents will be lost."
-  print "COUNT          Number of copies to create of each source repository."
-  print "SEPARATOR_SIZE Additional spacing, in kBytes, between revisions."
+  print("Copies and duplicates repositories in a way that mimics larger deployments.")
+  print("")
+  print("Usage:")
+  print("copy_repo.py SRC DST COUNT SEPARATOR_SIZE")
+  print("")
+  print("SRC            Immediate parent folder of all the repositories to copy.")
+  print("DST            Folder to copy into; current contents will be lost.")
+  print("COUNT          Number of copies to create of each source repository.")
+  print("SEPARATOR_SIZE Additional spacing, in kBytes, between revisions.")
 
 #main function
 if len(argv) == 5:

Modified: subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/win_repo_bench.py
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/win_repo_bench.py?rev=1746927&r1=1746926&r2=1746927&view=diff
==============================================================================
--- subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/win_repo_bench.py (original)
+++ subversion/branches/authzperf/tools/dev/benchmarks/RepoPerf/win_repo_bench.py Sun Jun  5 15:03:52 2016
@@ -115,7 +115,7 @@ def run_cs_command(state, config, reposi
 
   # Display the operation
   repo_title = repository.replace('nonpacked', 'nopack')
-  print state, "\t", repo_title, "\t", prefix, "\t", config, "\t",
+  sys.stdout.write(state, "\t", repo_title, "\t", prefix, "\t", config, "\t ")
   sys.stdout.flush()
 
   # Execute the command and show the execution times
@@ -189,8 +189,8 @@ def run_test_cs_configurations(command,
       repeatedly with all servers on all repositories. """
 
   print
-  print command
-  print
+  print(command)
+  print("")
 
   for config in configurations:
     set_config(config)
@@ -215,7 +215,7 @@ def run_admin_command(state, config, rep
   else:
     extra = []
 
-  print state, "\t", repository, "\t", config, "\t",
+  sys.stdout.write(state, "\t", repository, "\t", config, "\t ")
   sys.stdout.flush()
   subprocess.call(["TimeWin.exe", exe] + args + extra)
 
@@ -241,9 +241,9 @@ def run_test_admin_configurations(comman
   """ Run svnadmin COMMAND with basic arguments ARGS in all configurations
       repeatedly on all repositories. """
 
-  print
-  print command
-  print
+  print("")
+  print(command)
+  print("")
 
   for config in configurations:
     # These two must be the innermost loops and must be in that order.



Mime
View raw message