[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

ra-dav no longer propagates revprop errors

From: Eric Gillespie <epg_at_pretzelnet.org>
Date: 2007-08-02 00:47:39 CEST

Log message and patch for a unit test follow. Errors from the
pre-revprop-change hook no longer propagate over ra-dav. Still
works over ra-local and ra-svn; I haven't tested serf. I don't
really have the time to dig into this, so I'm hoping some ra-dav
expert will save me yet again from having to enter that part of
Subversion for the first time ;->.

I first noticed this problem with my r75148 build, so the bug is
at least that old.

[[[
* subversion/tests/cmdline/prop_tests.py
  (revprop_change): Test that we get an error upon trying to set a
    revprop when pre-revprop-change is *not* enabled, or enabled but
    returning an error.

* subversion/tests/cmdline/svntest/actions.py
  (disable_revprop_changes): New function, like enable_revprop_changes
    except creating a hook that prints a message to stderr and then
    exits non-zero.

* subversion/tests/cmdline/svntest/main.py
  (create_python_hook_script): Use file_write instead of file_append
    for the initial writes to the hook script, so callers can replace
    its contents without having to unlink it first.
]]]

Index: subversion/tests/cmdline/prop_tests.py
===================================================================
--- subversion/tests/cmdline/prop_tests.py (revision 25920)
+++ subversion/tests/cmdline/prop_tests.py (working copy)
@@ -741,6 +741,18 @@
 
   sbox.build()
 
+ # First test the error when no revprop-change hook exists.
+ svntest.actions.run_and_verify_svn(None, None, '.*pre-revprop-change',
+ 'propset', '--revprop', '-r', '0',
+ 'cash-sound', 'cha-ching!', sbox.wc_dir)
+
+ # Now test error output from revprop-change hook.
+ message = 'revprop_change test'
+ svntest.actions.disable_revprop_changes(sbox.repo_dir, message)
+ svntest.actions.run_and_verify_svn(None, None, '.*' + message,
+ 'propset', '--revprop', '-r', '0',
+ 'cash-sound', 'cha-ching!', sbox.wc_dir)
+
   # Create the revprop-change hook for this test
   svntest.actions.enable_revprop_changes(sbox.repo_dir)
 
Index: subversion/tests/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/cmdline/svntest/actions.py (revision 25920)
+++ subversion/tests/cmdline/svntest/actions.py (working copy)
@@ -1055,6 +1055,18 @@
   hook_path = main.get_pre_revprop_change_hook_path (repo_dir)
   main.create_python_hook_script (hook_path, 'import sys; sys.exit(0)')
 
+def disable_revprop_changes(repo_dir, message):
+ """Disable revprop changes in a repository REPO_DIR by creating a
+pre-revprop-change hook script like enable_revprop_changes, except that
+the hook prints MESSAGE to stderr and exits non-zero. MESSAGE is printed
+very simply, and should have no newlines or quotes."""
+
+ hook_path = main.get_pre_revprop_change_hook_path (repo_dir)
+ main.create_python_hook_script (hook_path,
+ 'import sys\n'
+ 'sys.stderr.write("%s")\n'
+ 'sys.exit(1)\n' % (message,))
+
 def create_failing_post_commit_hook(repo_dir):
   """Disable commits in a repository REPOS_DIR by creating a post-commit hook
 script which always reports errors."""
Index: subversion/tests/cmdline/svntest/main.py
===================================================================
--- subversion/tests/cmdline/svntest/main.py (revision 25920)
+++ subversion/tests/cmdline/svntest/main.py (working copy)
@@ -609,13 +609,13 @@
     # Use an absolute path since the working directory is not guaranteed
     hook_path = os.path.abspath(hook_path)
     # Fill the python file.
- file_append ("%s.py" % hook_path, hook_script_code)
+ file_write ("%s.py" % hook_path, hook_script_code)
     # Fill the batch wrapper file.
     file_append ("%s.bat" % hook_path,
                  "@\"%s\" %s.py %%*\n" % (sys.executable, hook_path))
   else:
     # For all other platforms
- file_append (hook_path, "#!%s\n%s" % (sys.executable, hook_script_code))
+ file_write (hook_path, "#!%s\n%s" % (sys.executable, hook_script_code))
     os.chmod (hook_path, 0755)
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 2 00:46:12 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.