Author: danielsh
Date: Tue Sep 21 12:59:32 2010
New Revision: 999380
URL: http://svn.apache.org/viewvc?rev=999380&view=rev
Log:
On the atomic-revprop branch, merge r999375 from trunk.
Modified:
subversion/branches/atomic-revprop/ (props changed)
subversion/branches/atomic-revprop/subversion/svnsync/main.c
Propchange: subversion/branches/atomic-revprop/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 21 12:59:32 2010
@@ -37,4 +37,4 @@
/subversion/branches/tc_url_rev:874351-874483
/subversion/branches/tree-conflicts:868291-873154
/subversion/branches/tree-conflicts-notify:873926-874008
-/subversion/trunk:965046-997404,998880,999158
+/subversion/trunk:965046-997404,998880,999158,999375
Modified: subversion/branches/atomic-revprop/subversion/svnsync/main.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/svnsync/main.c?rev=999380&r1=999379&r2=999380&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/svnsync/main.c (original)
+++ subversion/branches/atomic-revprop/subversion/svnsync/main.c Tue Sep 21
12:59:32 2010
@@ -284,6 +284,23 @@ check_lib_versions(void)
}
+/* Remove the lock on SESSION iff the lock is owned by MYLOCKTOKEN. */
+static svn_error_t *
+maybe_unlock(svn_ra_session_t *session,
+ const svn_string_t *mylocktoken,
+ apr_pool_t *scratch_pool)
+{
+ const svn_string_t *reposlocktoken;
+
+ SVN_ERR(svn_ra_rev_prop(session, 0, SVNSYNC_PROP_LOCK, &reposlocktoken,
+ scratch_pool));
+ if (reposlocktoken && strcmp(reposlocktoken->data, mylocktoken->data) == 0)
+ SVN_ERR(svn_ra_change_rev_prop(session, 0, SVNSYNC_PROP_LOCK, NULL,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
/* Acquire a lock (of sorts) on the repository associated with the
* given RA SESSION.
*/
@@ -308,12 +325,21 @@ get_lock(svn_ra_session_t *session, apr_
#define SVNSYNC_LOCK_RETRIES 10
for (i = 0; i < SVNSYNC_LOCK_RETRIES; ++i)
{
+ svn_error_t *err;
+
svn_pool_clear(subpool);
- SVN_ERR(check_cancel(NULL));
+
+ /* If we're cancelled, don't leave a stray lock behind. */
+ err = check_cancel(NULL);
+ if (err && err->apr_err == SVN_ERR_CANCELLED)
+ return svn_error_compose_create(
+ maybe_unlock(session, mylocktoken, subpool),
+ err);
+ else
+ SVN_ERR(err);
SVN_ERR(svn_ra_rev_prop(session, 0, SVNSYNC_PROP_LOCK, &reposlocktoken,
subpool));
-
if (reposlocktoken)
{
/* Did we get it? If so, we're done, otherwise we sleep. */