Modified: 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnadmin_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/tests/cmdline/svnadmin_tests.py?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnadmin_tests.py 
(original)
+++ 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnadmin_tests.py 
Mon Jan 16 15:24:08 2012
@@ -1646,6 +1646,137 @@ def hotcopy_incremental_packed(sbox):
         None, None, [], "pack", os.path.join(cwd, sbox.repo_dir))
 
 
+def locking(sbox):
+  "svnadmin lock tests"
+  sbox.build(create_wc=False)
+  
+  comment_path = os.path.join(svntest.main.temp_dir, "comment")
+  svntest.main.file_write(comment_path, "dummy comment")
+
+  invalid_comment_path = os.path.join(svntest.main.temp_dir, "invalid_comment")
+  svntest.main.file_write(invalid_comment_path, "character  is invalid")
+
+  # Test illegal character in comment file.
+  expected_error = ".*svnadmin: E130004:.*"
+  svntest.actions.run_and_verify_svnadmin(None, None,
+                                          expected_error, "lock", 
+                                          sbox.repo_dir,
+                                          "iota", "jrandom",
+                                          invalid_comment_path)
+  
+  # Test locking path with --bypass-hooks
+  expected_output = "'iota' locked by user 'jrandom'."
+  svntest.actions.run_and_verify_svnadmin(None, expected_output,
+                                          None, "lock", 
+                                          sbox.repo_dir,
+                                          "iota", "jrandom",
+                                          comment_path,
+                                          "--bypass-hooks")
+
+  # Remove lock
+  svntest.actions.run_and_verify_svnadmin(None, None,
+                                          None, "rmlocks", 
+                                          sbox.repo_dir, "iota")
+  
+  # Test locking path without --bypass-hooks
+  expected_output = "'iota' locked by user 'jrandom'."
+  svntest.actions.run_and_verify_svnadmin(None, expected_output,
+                                          None, "lock", 
+                                          sbox.repo_dir,
+                                          "iota", "jrandom",
+                                          comment_path)
+
+  # Test locking already locked path.
+  expected_error = ".*svnadmin: E160035:.*"
+  svntest.actions.run_and_verify_svnadmin(None, None,
+                                          expected_error, "lock", 
+                                          sbox.repo_dir,
+                                          "iota", "jrandom",
+                                          comment_path)
+
+  # Test locking non-existent path.
+  expected_error = ".*svnadmin: E160013:.*"
+  svntest.actions.run_and_verify_svnadmin(None, None,
+                                          expected_error, "lock", 
+                                          sbox.repo_dir,
+                                          "non-existent", "jrandom",
+                                          comment_path)
+
+  # Test locking a path while specifying a lock token.
+  expected_output = "'A/D/G/rho' locked by user 'jrandom'."
+  lock_token = "opaquelocktoken:01234567-89ab-cdef-89ab-cdef01234567"
+  svntest.actions.run_and_verify_svnadmin(None, expected_output,
+                                          None, "lock", 
+                                          sbox.repo_dir,
+                                          "A/D/G/rho", "jrandom",
+                                          comment_path, lock_token)
+
+  # Test unlocking a path, but provide the wrong lock token.
+  expected_error = ".*svnadmin: E160040:.*"
+  wrong_lock_token = "opaquelocktoken:12345670-9ab8-defc-9ab8-def01234567c"
+  svntest.actions.run_and_verify_svnadmin(None, None,
+                                          expected_error, "unlock", 
+                                          sbox.repo_dir,
+                                          "A/D/G/rho", "jrandom",
+                                          wrong_lock_token)
+  
+  # Test unlocking the path again, but this time provide the correct
+  # lock token.
+  expected_output = "'A/D/G/rho' unlocked."
+  svntest.actions.run_and_verify_svnadmin(None, expected_output,
+                                          None, "unlock",
+                                          sbox.repo_dir,
+                                          "A/D/G/rho", "jrandom",
+                                          lock_token)
+
+  # Install lock/unlock prevention hooks.
+  hook_path = svntest.main.get_pre_lock_hook_path(sbox.repo_dir)
+  svntest.main.create_python_hook_script(hook_path, 'import sys; sys.exit(1)')
+  hook_path = svntest.main.get_pre_unlock_hook_path(sbox.repo_dir)
+  svntest.main.create_python_hook_script(hook_path, 'import sys; sys.exit(1)')
+  
+  # Test locking a path.  Don't use --bypass-hooks, though, as we wish
+  # to verify that hook script is really getting executed.
+  expected_error = ".*svnadmin: E165001:.*"
+  svntest.actions.run_and_verify_svnadmin(None, None,
+                                          expected_error, "lock", 
+                                          sbox.repo_dir,
+                                          "iota", "jrandom",
+                                          comment_path)
+
+  # Fetch the lock token for our remaining locked path.  (We didn't
+  # explicitly set it, so it will vary from test run to test run.)
+  exit_code, output, errput = svntest.main.run_svnadmin("lslocks",
+                                                        sbox.repo_dir,
+                                                        "iota")
+  iota_token = None
+  for line in output:
+    if line.startswith("UUID Token: opaquelocktoken:"):
+      iota_token = line[12:].rstrip()
+      break
+  if iota_token is None:
+    raise svntest.Failure("Unable to lookup lock token for 'iota'")
+
+  # Try to unlock a path while providing the correct lock token but
+  # with a preventative hook in place.
+  expected_error = ".*svnadmin: E165001:.*"
+  svntest.actions.run_and_verify_svnadmin(None, None,
+                                          expected_error, "unlock", 
+                                          sbox.repo_dir,
+                                          "iota", "jrandom",
+                                          iota_token)
+
+  # Finally, use --bypass-hooks to unlock the path (again using the
+  # correct lock token).
+  expected_output = "'iota' unlocked."
+  svntest.actions.run_and_verify_svnadmin(None, expected_output,
+                                          None, "unlock",
+                                          "--bypass-hooks",
+                                          sbox.repo_dir,
+                                          "iota", "jrandom",
+                                          iota_token)
+
+
 ########################################################################
 # Run the tests
 
@@ -1679,6 +1810,7 @@ test_list = [ None,
               load_ranges,
               hotcopy_incremental,
               hotcopy_incremental_packed,
+              locking,
              ]
 
 if __name__ == '__main__':

Modified: 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnrdump_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/tests/cmdline/svnrdump_tests.py?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnrdump_tests.py 
(original)
+++ 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnrdump_tests.py 
Mon Jan 16 15:24:08 2012
@@ -70,6 +70,28 @@ def build_repos(sbox):
   # Create an empty repository.
   svntest.main.create_repos(sbox.repo_dir)
 
+def compare_repos_dumps(svnrdump_sbox, svnadmin_dumpfile):
+  """Compare two dumpfiles, one created from SVNRDUMP_SBOX, and other given
+  by SVNADMIN_DUMPFILE.  The dumpfiles do not need to match linewise, as the
+  SVNADMIN_DUMPFILE contents will first be loaded into a repository and then
+  re-dumped to do the match, which should generate the same dumpfile as
+  dumping SVNRDUMP_SBOX."""
+
+  svnrdump_contents = svntest.actions.run_and_verify_dump(
+                                                    svnrdump_sbox.repo_dir)
+
+  svnadmin_sbox = svnrdump_sbox.clone_dependent()
+  svntest.main.safe_rmtree(svnadmin_sbox.repo_dir)
+  svntest.main.create_repos(svnadmin_sbox.repo_dir)
+
+  svntest.actions.run_and_verify_load(svnadmin_sbox.repo_dir, 
svnadmin_dumpfile)
+
+  svnadmin_contents = svntest.actions.run_and_verify_dump(
+                                                    svnadmin_sbox.repo_dir)
+
+  svntest.verify.compare_and_display_lines(
+    "Dump files", "DUMP", svnadmin_contents, svnrdump_contents)
+
 def run_dump_test(sbox, dumpfile_name, expected_dumpfile_name = None,
                   subdir = None, bypass_prop_validation = False):
   """Load a dumpfile using 'svnadmin load', dump it with 'svnrdump
@@ -108,11 +130,13 @@ def run_dump_test(sbox, dumpfile_name, e
                                           expected_dumpfile_name),
                              'rb').readlines()
     svnadmin_dumpfile = svntest.verify.UnorderedOutput(svnadmin_dumpfile)
-
-  # Compare the output from stdout
-  svntest.verify.compare_and_display_lines(
-    "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile,
-    None, mismatched_headers_re)
+    # Compare the output from stdout
+    svntest.verify.compare_and_display_lines(
+      "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile,
+      None, mismatched_headers_re)
+    
+  else:
+    compare_repos_dumps(sbox, svnadmin_dumpfile)
 
 def run_load_test(sbox, dumpfile_name, expected_dumpfile_name = None,
                   expect_deltas = True):
@@ -155,9 +179,12 @@ def run_load_test(sbox, dumpfile_name, e
                                           expected_dumpfile_name),
                              'rb').readlines()
 
-  # Compare the output from stdout
-  svntest.verify.compare_and_display_lines(
-    "Dump files", "DUMP", svnrdump_dumpfile, svnadmin_dumpfile)
+    # Compare the output from stdout
+    svntest.verify.compare_and_display_lines(
+      "Dump files", "DUMP", svnrdump_dumpfile, svnadmin_dumpfile)
+
+  else:
+    compare_repos_dumps(sbox, svnrdump_dumpfile)
 
 ######################################################################
 # Tests
@@ -225,32 +252,26 @@ def no_author_load(sbox):
   "load: copy revs with no svn:author revprops"
   run_load_test(sbox, "no-author.dump")
 
-@XFail()
 def copy_from_previous_version_and_modify_dump(sbox):
   "dump: copy from previous version and modify"
   run_dump_test(sbox, "copy-from-previous-version-and-modify.dump")
 
-@XFail()
 def copy_from_previous_version_and_modify_load(sbox):
   "load: copy from previous version and modify"
   run_load_test(sbox, "copy-from-previous-version-and-modify.dump")
 
-@XFail()
 def modified_in_place_dump(sbox):
   "dump: modified in place"
   run_dump_test(sbox, "modified-in-place.dump")
 
-@XFail()
 def modified_in_place_load(sbox):
   "load: modified in place"
   run_load_test(sbox, "modified-in-place.dump")
 
-@XFail()
 def move_and_modify_in_the_same_revision_dump(sbox):
   "dump: move parent & modify child file in same rev"
   run_dump_test(sbox, "move-and-modify.dump")
 
-@XFail()
 def move_and_modify_in_the_same_revision_load(sbox):
   "load: move parent & modify child file in same rev"
   run_load_test(sbox, "move-and-modify.dump")
@@ -295,12 +316,10 @@ def copy_parent_modify_prop_load(sbox):
   "load: copy parent and modify prop"
   run_load_test(sbox, "copy-parent-modify-prop.dump")
 
-@XFail()
 def copy_revprops_dump(sbox):
   "dump: copy revprops other than svn:*"
   run_dump_test(sbox, "revprops.dump")
 
-@XFail()
 def copy_revprops_load(sbox):
   "load: copy revprops other than svn:*"
   run_load_test(sbox, "revprops.dump")

Modified: 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnsync_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/tests/cmdline/svnsync_tests.py?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnsync_tests.py 
(original)
+++ 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svnsync_tests.py 
Mon Jan 16 15:24:08 2012
@@ -208,7 +208,7 @@ def setup_and_sync(sbox, dump_file_conte
 
   return dest_sbox
 
-def verify_mirror(dest_sbox, exp_dump_file_contents):
+def verify_mirror(dest_sbox, src_sbox):
   """Compare the contents of the DEST_SBOX repository with 
EXP_DUMP_FILE_CONTENTS."""
 
   # Remove some SVNSync-specific housekeeping properties from the
@@ -221,9 +221,10 @@ def verify_mirror(dest_sbox, exp_dump_fi
 
   # Create a dump file from the mirror repository.
   dest_dump = svntest.actions.run_and_verify_dump(dest_sbox.repo_dir)
+  src_dump = svntest.actions.run_and_verify_dump(src_sbox.repo_dir)
 
   svntest.verify.compare_and_display_lines(
-    "Dump files", "DUMP", exp_dump_file_contents, dest_dump)
+    "Dump files", "DUMP", src_dump, dest_dump)
 
 def run_test(sbox, dump_file_name, subdir=None, exp_dump_file_name=None,
              bypass_prop_validation=False, source_prop_encoding=None,
@@ -249,12 +250,16 @@ or another dump file."""
   # dump file (used to create the master repository) or another specified dump
   # file.
   if exp_dump_file_name:
-    exp_master_dumpfile_contents = open(os.path.join(svnsync_tests_dir,
-                                        exp_dump_file_name)).readlines()
+    build_repos(sbox)
+    svntest.actions.run_and_verify_load(sbox.repo_dir, 
+                                        open(os.path.join(svnsync_tests_dir,
+                                                          exp_dump_file_name),
+                                             'rb').readlines())
+    src_sbox = sbox
   else:
-    exp_master_dumpfile_contents = master_dumpfile_contents
+    src_sbox = sbox
 
-  verify_mirror(dest_sbox, exp_master_dumpfile_contents)
+  verify_mirror(dest_sbox, sbox)
 
 
 
@@ -1012,7 +1017,9 @@ def delete_revprops(sbox):
   run_copy_revprops(dest_sbox.repo_url, sbox.repo_url)
 
   # Does the result look as we expected?
-  verify_mirror(dest_sbox, expected_contents)
+  build_repos(sbox)
+  svntest.actions.run_and_verify_load(sbox.repo_dir, expected_contents)
+  verify_mirror(dest_sbox, sbox)
 
 @Issue(3870)
 @SkipUnless(svntest.main.is_posix_os)

Modified: 
subversion/branches/moves-scan-log/subversion/tests/cmdline/svntest/main.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/tests/cmdline/svntest/main.py?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/subversion/tests/cmdline/svntest/main.py 
(original)
+++ subversion/branches/moves-scan-log/subversion/tests/cmdline/svntest/main.py 
Mon Jan 16 15:24:08 2012
@@ -319,6 +319,16 @@ def get_pre_revprop_change_hook_path(rep
 
   return os.path.join(repo_dir, "hooks", "pre-revprop-change")
 
+def get_pre_lock_hook_path(repo_dir):
+  "Return the path of the pre-lock hook script in REPO_DIR."
+
+  return os.path.join(repo_dir, "hooks", "pre-lock")
+
+def get_pre_unlock_hook_path(repo_dir):
+  "Return the path of the pre-unlock hook script in REPO_DIR."
+
+  return os.path.join(repo_dir, "hooks", "pre-unlock")
+
 def get_svnserve_conf_file_path(repo_dir):
   "Return the path of the svnserve.conf file in REPO_DIR."
 

Modified: 
subversion/branches/moves-scan-log/subversion/tests/cmdline/tree_conflict_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/tests/cmdline/tree_conflict_tests.py?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- 
subversion/branches/moves-scan-log/subversion/tests/cmdline/tree_conflict_tests.py
 (original)
+++ 
subversion/branches/moves-scan-log/subversion/tests/cmdline/tree_conflict_tests.py
 Mon Jan 16 15:24:08 2012
@@ -1258,7 +1258,7 @@ def actual_only_node_behaviour(sbox):
   # merge
   # note: this is intentionally a no-op merge that does not record mergeinfo
   expected_stdout = None
-  expected_stderr = ".*foo.*does not exist.*"
+  expected_stderr = ".*foo.*was not found.*"
   run_and_verify_svn(None, expected_stdout, expected_stderr,
                      "merge", '--ignore-ancestry', '-c', '4',
                      A_copy_url + '/mu', foo_path)

Modified: 
subversion/branches/moves-scan-log/subversion/tests/libsvn_ra_local/ra-local-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/tests/libsvn_ra_local/ra-local-test.c?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- 
subversion/branches/moves-scan-log/subversion/tests/libsvn_ra_local/ra-local-test.c
 (original)
+++ 
subversion/branches/moves-scan-log/subversion/tests/libsvn_ra_local/ra-local-test.c
 Mon Jan 16 15:24:08 2012
@@ -125,7 +125,7 @@ try_split_url(const char *url, apr_pool_
   err = svn_ra_local__split_URL(&repos, &repos_path, &fs_path, url, pool);
 
   if (! err)
-    return SVN_NO_ERROR;
+    return APR_SUCCESS;
 
   apr_err = err->apr_err;
   svn_error_clear(err);

Modified: 
subversion/branches/moves-scan-log/tools/client-side/svn-ssl-fingerprints.sh
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/tools/client-side/svn-ssl-fingerprints.sh?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- 
subversion/branches/moves-scan-log/tools/client-side/svn-ssl-fingerprints.sh 
(original)
+++ 
subversion/branches/moves-scan-log/tools/client-side/svn-ssl-fingerprints.sh 
Mon Jan 16 15:24:08 2012
@@ -28,6 +28,6 @@
 CONFIG_DIR=${1-$HOME/.subversion}
 for i in $CONFIG_DIR/auth/svn.ssl.server/????????????????????????????????; do
   grep :// $i
-  grep '.\{80\}' $i | sed 's/\(.\{64\}\)/\1\n/g' | openssl base64 -d | openssl 
x509 -inform der -noout -fingerprint | sed 's/=/\n/'
+  grep '.\{80\}' $i | sed 's/\(.\{64\}\)/\1 /g' | xargs -n1 | openssl base64 
-d | openssl x509 -inform der -noout -fingerprint | sed 's/=/ /' | xargs -n1
   echo
 done

Modified: subversion/branches/moves-scan-log/tools/examples/SvnCLBrowse
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/tools/examples/SvnCLBrowse?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/tools/examples/SvnCLBrowse (original)
+++ subversion/branches/moves-scan-log/tools/examples/SvnCLBrowse Mon Jan 16 
15:24:08 2012
@@ -161,7 +161,7 @@ class _item:
 class SvnCLBrowse(wx.App):
   def __init__(self, wc_dir):
     svn.core.svn_config_ensure(None)
-    self.svn_ctx = svn.client.ctx_t()
+    self.svn_ctx = svn.client.svn_client_create_context()
     self.svn_ctx.config = svn.core.svn_config_get_config(None)
     if wc_dir is not None:
       self.wc_dir = svn.core.svn_path_canonicalize(wc_dir)

Modified: 
subversion/branches/moves-scan-log/tools/examples/get-location-segments.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/tools/examples/get-location-segments.py?rev=1232025&r1=1232024&r2=1232025&view=diff
==============================================================================
--- subversion/branches/moves-scan-log/tools/examples/get-location-segments.py 
(original)
+++ subversion/branches/moves-scan-log/tools/examples/get-location-segments.py 
Mon Jan 16 15:24:08 2012
@@ -124,7 +124,7 @@ ERROR: %s
     sys.exit(1)
 
   core.svn_config_ensure(None)
-  ctx = client.ctx_t()
+  ctx = client.svn_client_create_context()
   providers = [
     client.get_simple_provider(),
     core.svn_auth_get_ssl_server_trust_file_provider(),


Reply via email to