Adding a URL parameter to the pre-connect hook script

0 views
Skip to first unread message

Daniel Sahlberg

unread,
Jul 2, 2026, 3:21:28 PM (yesterday) Jul 2
to TortoiseSVN-dev
Hi,

I've been toying with adding a parameter to the pre-connect hook script to be able to see the URL of the repository.

The following seems to work:
[[[
--- C:/Users/daniel/AppData/Local/Temp/Hooks.cpp-revBASE.svn003.tmp.cpp fre jul 28 18:31:23 2023
+++ C:/Devel/tsvn_trunk/src/Utils/Hooks.cpp ons jul  1 12:12:53 2026
@@ -508,6 +508,16 @@ bool CHooks::PreConnect(const CTSVNPathList& pathL
                 return false;
         }
         CString sCmd = it->second.commandline;
+        if (pathList[0].IsUrl())
+        {
+            AddParam(sCmd, pathList[0].GetSVNPathString());
+        }
+        else
+        {
+            SVN     svn;
+            CString sUrl = svn.GetURLFromPath(pathList[0]);
+            AddParam(sCmd, sUrl);
+        }
         CString error;
         RunScript(sCmd, pathList, error, it->second.bWait, it->second.bShow);
         m_lastPreConnectTicks = GetTickCount64();
]]]

SVN::GetUrlFromPath (svn_client_url_from_path2) seems to be a local operation only (otherwise we might get infinite recursion).

Does this look OK or do I miss something?

Cheers,
Daniel

Reply all
Reply to author
Forward
0 new messages