You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/03/06 19:27:05 UTC

svn commit: r1297633 - in /subversion/trunk/subversion/tests/cmdline: svnsync_tests.py svntest/main.py svntest/sandbox.py

Author: hwright
Date: Tue Mar  6 18:27:05 2012
New Revision: 1297633

URL: http://svn.apache.org/viewvc?rev=1297633&view=rev
Log:
Remove a couple of custom Python methods which are now part of the standard
library.

* subversion/tests/cmdline/svnsync_tests.py
  (setup_and_sync, copy_delete_unreadable_child): Use urllib versions.

* subversion/tests/cmdline/svntest/main.py
  (pathname2url, url2pathname): Remove.
  (_create_parser, execute_tests): Use urllib versions.

* subversion/tests/cmdline/svntest/sandbox.py
  (Sandbox): Same.

Modified:
    subversion/trunk/subversion/tests/cmdline/svnsync_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py
    subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py

Modified: subversion/trunk/subversion/tests/cmdline/svnsync_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnsync_tests.py?rev=1297633&r1=1297632&r2=1297633&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnsync_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnsync_tests.py Tue Mar  6 18:27:05 2012
@@ -28,7 +28,7 @@
 import sys, os
 
 # Test suite-specific modules
-import locale, re
+import locale, re, urllib
 
 # Our testing module
 import svntest
@@ -191,14 +191,16 @@ def setup_and_sync(sbox, dump_file_conte
   repo_url = sbox.repo_url
   cwd = os.getcwd()
   if is_src_ra_local:
-    repo_url = svntest.main.file_scheme_prefix + svntest.main.pathname2url(os.path.join(cwd, sbox.repo_dir))
+    repo_url = svntest.main.file_scheme_prefix + \
+                        urllib.pathname2url(os.path.join(cwd, sbox.repo_dir))
 
   if subdir:
     repo_url = repo_url + subdir
 
   dest_repo_url = dest_sbox.repo_url
   if is_dest_ra_local:
-    dest_repo_url = svntest.main.file_scheme_prefix + svntest.main.pathname2url(os.path.join(cwd, dest_sbox.repo_dir))
+    dest_repo_url = svntest.main.file_scheme_prefix + \
+                    urllib.pathname2url(os.path.join(cwd, dest_sbox.repo_dir))
   run_init(dest_repo_url, repo_url, source_prop_encoding)
 
   run_sync(dest_repo_url, repo_url,
@@ -1029,7 +1031,7 @@ def copy_delete_unreadable_child(sbox):
       % (authz, authz))
 
   dest_url = svntest.main.file_scheme_prefix \
-             + svntest.main.pathname2url(os.path.abspath(dest_sbox.repo_dir))
+                    + urllib.pathname2url(os.path.abspath(dest_sbox.repo_dir))
   run_init(dest_url, sbox.repo_url)
   run_sync(dest_url)
 

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1297633&r1=1297632&r2=1297633&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Tue Mar  6 18:27:05 2012
@@ -132,23 +132,6 @@ wc_author2 = 'jconstant' # use the same 
 # Set C locale for command line programs
 os.environ['LC_ALL'] = 'C'
 
-# This function mimics the Python 2.3 urllib function of the same name.
-def pathname2url(path):
-  """Convert the pathname PATH from the local syntax for a path to the form
-  used in the path component of a URL. This does not produce a complete URL.
-  The return value will already be quoted using the quote() function."""
-
-  # Don't leave ':' in file://C%3A/ escaped as our canonicalization
-  # rules will replace this with a ':' on input.
-  return urllib_parse_quote(path.replace('\\', '/')).replace('%3A', ':')
-
-# This function mimics the Python 2.3 urllib function of the same name.
-def url2pathname(path):
-  """Convert the path component PATH from an encoded URL to the local syntax
-  for a path. This does not accept a complete URL. This function uses
-  unquote() to decode PATH."""
-  return os.path.normpath(urllib_parse_unquote(path))
-
 ######################################################################
 # The locations of the svn, svnadmin and svnlook binaries, relative to
 # the only scripts that import this file right now (they live in ../).
@@ -1551,7 +1534,8 @@ def _create_parser():
   # most of the defaults are None, but some are other values, set them here
   parser.set_defaults(
         server_minor_version=SVN_VER_MINOR,
-        url=file_scheme_prefix + pathname2url(os.path.abspath(os.getcwd())),
+        url=file_scheme_prefix + \
+                        urllib.pathname2url(os.path.abspath(os.getcwd())),
         http_library=_default_http_library)
 
   return parser
@@ -1719,7 +1703,8 @@ def execute_tests(test_list, serial_only
                    "or function '%s'\n" % arg)
 
   # Calculate pristine_greek_repos_url from test_area_url.
-  pristine_greek_repos_url = options.test_area_url + '/' + pathname2url(pristine_greek_repos_dir)
+  pristine_greek_repos_url = options.test_area_url + '/' + \
+                                urllib.pathname2url(pristine_greek_repos_dir)
 
   if options.use_jsvn:
     if options.svn_bin is None:

Modified: subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py?rev=1297633&r1=1297632&r2=1297633&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Tue Mar  6 18:27:05 2012
@@ -24,6 +24,7 @@
 import os
 import shutil
 import copy
+import urllib
 
 import svntest
 
@@ -49,7 +50,7 @@ class Sandbox:
     if not read_only:
       self.repo_dir = os.path.join(svntest.main.general_repo_dir, self.name)
       self.repo_url = (svntest.main.options.test_area_url + '/'
-                       + svntest.main.pathname2url(self.repo_dir))
+                       + urllib.pathname2url(self.repo_dir))
     else:
       self.repo_dir = svntest.main.pristine_greek_repos_dir
       self.repo_url = svntest.main.pristine_greek_repos_url
@@ -126,7 +127,7 @@ class Sandbox:
     path = (os.path.join(svntest.main.general_repo_dir, self.name)
             + '.' + suffix)
     url = svntest.main.options.test_area_url + \
-                                        '/' + svntest.main.pathname2url(path)
+                                        '/' + urllib.pathname2url(path)
     self.add_test_path(path, remove)
     return path, url