Hi,

When you try to commit to a server, but the commit itself is
getting rejected because of a hook, then TortoiseSVN will prompt
the user to unbreak the lock. Outputting this error message is
wrong, though, as rejection through a hook will not cause any
locks to be retained after the operation.

The issue stems from the macro `SVN_ERR_IS_UNLOCK_ERROR`, which
TortoiseSVN uses to determine whether unlock instructions shall
be appended to the error messages. Because Subversion allows
pre-lock hooks, an `SVN_ERR_REPOS_HOOK_FAILURE` message is also
considered an unlock error, even though in most cases it is not.
And even if it was an error regarding the pre-lock hook, the user
would not be able to fix that by unlocking something in his
working copy, as the hook is server-side and only used to check
whether a lock shall be granted at all.

Fix the erroneous message by only emitting it if the error is
_not_ an `SVN_ERR_REPOS_HOOK_FAILURE`.

The attached patch does that. The bug was fixed on the 1.9.x
branch, but the patch applies to both 1.10.x and trunk.

Regards
Patrick

-- 
You received this message because you are subscribed to the Google Groups 
"TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tortoisesvn-dev/20180525110704.GA13778%40ncase.pks.im.
For more options, visit https://groups.google.com/d/optout.
Index: src/SVN/SVNBase.cpp
===================================================================
--- src/SVN/SVNBase.cpp (revision 28126)
+++ src/SVN/SVNBase.cpp (working copy)
@@ -188,7 +188,8 @@
             // the lock has already been broken from another working copy
             temp.LoadString(IDS_SVNERR_UNLOCKFAILEDNOLOCK);
         }
-        else if (SVN_ERR_IS_UNLOCK_ERROR(Err))
+        else if ((Err->apr_err != SVN_ERR_REPOS_HOOK_FAILURE) &&
+                 SVN_ERR_IS_UNLOCK_ERROR(Err))
         {
             // if you want to break the lock, use the "check for 
modifications" dialog
             temp.LoadString(IDS_SVNERR_UNLOCKFAILED);

Attachment: signature.asc
Description: PGP signature

Reply via email to