Author: svn-role
Date: Wed Jun 5 04:00:55 2013
New Revision: 1489701
URL: http://svn.apache.org/r1489701
Log:
Merge r1488425 from trunk:
* r1488425
Fix issue 4369, poor serf error message for commit with stolen locks.
Justification:
Confusing to user and a regression from 1.7/neon.
Votes:
+1: philip, rhuijben, ivan
+0: danielsh
Modified:
subversion/branches/1.8.x/ (props changed)
subversion/branches/1.8.x/STATUS
subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c
subversion/branches/1.8.x/subversion/tests/cmdline/lock_tests.py
subversion/branches/1.8.x/subversion/tests/cmdline/svntest/sandbox.py
Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1488425
Modified: subversion/branches/1.8.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1489701&r1=1489700&r2=1489701&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Wed Jun 5 04:00:55 2013
@@ -63,14 +63,6 @@ Approved changes:
# blocking issues. If in doubt see this link for details:
#
http://subversion.apache.org/docs/community-guide/releasing.html#release-stabilization
- * r1488425
- Fix issue 4369, poor serf error message for commit with stolen locks.
- Justification:
- Confusing to user and a regression from 1.7/neon.
- Votes:
- +1: philip, rhuijben, ivan
- +0: danielsh
-
* r1488183
Check target WC for mixed revisions, local modifications and switched
subtrees before contacting server for merge calculations.
Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c
URL:
http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c?rev=1489701&r1=1489700&r2=1489701&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/commit.c Wed Jun 5
04:00:55 2013
@@ -804,8 +804,18 @@ maybe_set_lock_token_header(serf_bucket_
if (token)
{
const char *token_header;
+ const char *token_uri;
+ apr_uri_t uri = commit_ctx->session->session_url;
- token_header = apr_pstrcat(pool, "(<", token, ">)", (char *)NULL);
+ /* Supplying the optional URI affects apache response when
+ the lock is broken, see issue 4369. When present any URI
+ must be absolute (RFC 2518 9.4). */
+ uri.path = (char *)svn_path_url_add_component2(uri.path, relpath,
+ pool);
+ token_uri = apr_uri_unparse(pool, &uri, 0);
+
+ token_header = apr_pstrcat(pool, "<", token_uri, "> (<", token, ">)",
+ (char *)NULL);
serf_bucket_headers_set(headers, "If", token_header);
}
}
Modified: subversion/branches/1.8.x/subversion/tests/cmdline/lock_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/cmdline/lock_tests.py?rev=1489701&r1=1489700&r2=1489701&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/branches/1.8.x/subversion/tests/cmdline/lock_tests.py Wed Jun 5
04:00:55 2013
@@ -1815,6 +1815,31 @@ def lock_unlock_deleted(sbox):
expected_status.tweak('A/mu', writelocked=None)
svntest.actions.run_and_verify_status(wc_dir, expected_status)
+@Issue(4369)
+def commit_stolen_lock(sbox):
+ "commit with a stolen lock"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ sbox.simple_append('A/mu', 'zig-zag')
+ sbox.simple_lock('A/mu')
+
+ expected_output = '\'mu\' locked by user \'jrandom\'.'
+ svntest.actions.run_and_verify_svn(None, expected_output, [],
+ 'lock', '--force',
+ sbox.repo_url + '/A/mu')
+
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.tweak('A/mu', status='M ', writelocked='T')
+ err_re = "(.*E160037: Cannot verify lock on path '/A/mu')|" + \
+ "(.*E160038: '/.*/A/mu': no lock token available)"
+ svntest.actions.run_and_verify_commit(wc_dir,
+ [],
+ expected_status,
+ err_re,
+ wc_dir)
+
########################################################################
# Run the tests
@@ -1866,6 +1891,7 @@ test_list = [ None,
lock_multi_wc,
locks_stick_over_switch,
lock_unlock_deleted,
+ commit_stolen_lock,
]
if __name__ == '__main__':
Modified: subversion/branches/1.8.x/subversion/tests/cmdline/svntest/sandbox.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/cmdline/svntest/sandbox.py?rev=1489701&r1=1489700&r2=1489701&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/cmdline/svntest/sandbox.py
(original)
+++ subversion/branches/1.8.x/subversion/tests/cmdline/svntest/sandbox.py Wed
Jun 5 04:00:55 2013
@@ -362,6 +362,13 @@ class Sandbox:
DEST is a relpath relative to the WC."""
open(self.ospath(dest), truncate and 'w' or 'a').write(contents)
+ def simple_lock(self, *targets):
+ """Lock TARGETS in the WC.
+ TARGETS are relpaths relative to the WC."""
+ assert len(targets) > 0
+ targets = self.ospaths(targets)
+ svntest.main.run_svn(False, 'lock', *targets)
+
def is_url(target):
return (target.startswith('^/')