Author: rhuijben Date: Mon Aug 8 22:09:46 2011 New Revision: 1155124 URL: http://svn.apache.org/viewvc?rev=1155124&view=rev Log: Following up on r1154982, handle the 405 error for locking in a different way than for other ra commands to allow proper warning handling via callback.
* subversion/libsvn_ra_serf/locks.c (handle_lock): Move now unreachable 405 handling from here... * subversion/libsvn_ra_serf/util.c (handle_response): ... to here. * subversion/tests/cmdline/lock_tests.py (lock_path_not_in_head): Check for a specific error code and allow the new more detailed error message from serf. Modified: subversion/trunk/subversion/libsvn_ra_serf/locks.c subversion/trunk/subversion/libsvn_ra_serf/util.c subversion/trunk/subversion/tests/cmdline/lock_tests.py Modified: subversion/trunk/subversion/libsvn_ra_serf/locks.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/locks.c?rev=1155124&r1=1155123&r2=1155124&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/locks.c (original) +++ subversion/trunk/subversion/libsvn_ra_serf/locks.c Mon Aug 8 22:09:46 2011 @@ -385,14 +385,6 @@ handle_lock(serf_request_t *request, return err; } - /* 405 == Method Not Allowed (Occurs when trying to lock a working - copy path which no longer exists at HEAD in the repository. */ - if (sl.code == 405) - return svn_error_createf(SVN_ERR_FS_OUT_OF_DATE, - NULL, - _("Lock request failed: %d %s"), - ctx->status_code, ctx->reason); - headers = serf_bucket_response_get_headers(response); val = serf_bucket_headers_get(headers, SVN_DAV_LOCK_OWNER_HEADER); Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1155124&r1=1155123&r2=1155124&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/util.c (original) +++ subversion/trunk/subversion/libsvn_ra_serf/util.c Mon Aug 8 22:09:46 2011 @@ -2022,9 +2022,17 @@ handle_response(serf_request_t *request, if (!ctx->session->pending_error) { + apr_status_t apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED; + + /* 405 == Method Not Allowed (Occurs when trying to lock a working + copy path which no longer exists at HEAD in the repository. */ + + if (sl.code == 405 && !strcmp(ctx->method, "LOCK")) + apr_err = SVN_ERR_FS_OUT_OF_DATE; + return - svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL, - _("The %s request on '%s' failed: %d %s"), + svn_error_createf(apr_err, NULL, + _("%s request on '%s' failed: %d %s"), ctx->method, ctx->path, sl.code, sl.reason); } Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1155124&r1=1155123&r2=1155124&view=diff ============================================================================== --- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original) +++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Mon Aug 8 22:09:46 2011 @@ -1499,9 +1499,9 @@ def lock_path_not_in_head(sbox): svntest.actions.run_and_verify_svn(None, None, [], 'commit', '-m', 'Some deletions', wc_dir) svntest.actions.run_and_verify_svn(None, None, [], 'up', '-r1', wc_dir) - expected_lock_fail_err_re = "svn:.*" \ + expected_lock_fail_err_re = "svn: warning: W160042: " \ "((Path .* doesn't exist in HEAD revision)" \ - "|(Lock request failed: 405 Method Not Allowed))" + "|(L(ock|OCK) request (on '.*' )?failed: 405 Method Not Allowed))" # Issue #3524 These lock attemtps were triggering an assert over ra_serf: # # working_copies\lock_tests-37>svn lock A\D