Adding a URL parameter to the pre-connect hook script

Daniel Sahlberg via TortoiseSVN-dev <[email protected]> Thu, 2 Jul 2026 12:21:28 -0700 (PDT)
Newsgroups gmane.comp.version-control.subversion.tortoisesvn.devel
Message-ID <[email protected]>
------=_Part_848398_826886361.1783020088343
Content-Type: multipart/alternative; 
	boundary="----=_Part_848399_1672656240.1783020088343"

------=_Part_848399_1672656240.1783020088343
Content-Type: text/plain; charset="UTF-8"

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

-- 
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 visit https://groups.google.com/d/msgid/tortoisesvn-dev/62c68949-dd5b-4f04-933f-de7c28d7a975n%40googlegroups.com.

------=_Part_848399_1672656240.1783020088343
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,<div><br /></div><div>I've been toying with adding a parameter to the pr=
e-connect hook script to be able to see the URL of the repository.</div><di=
v><br /></div><div>The following seems to work:</div><div>[[[</div><div>---=
 C:/Users/daniel/AppData/Local/Temp/Hooks.cpp-revBASE.svn003.tmp.cpp<span s=
tyle=3D"white-space: pre;">	</span>fre jul 28 18:31:23 2023<br />+++ C:/Dev=
el/tsvn_trunk/src/Utils/Hooks.cpp<span style=3D"white-space: pre;">	</span>=
ons jul =C2=A01 12:12:53 2026<br />@@ -508,6 +508,16 @@ bool CHooks::PreCon=
nect(const CTSVNPathList&amp; pathL<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0return false;<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0}<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CString sCmd =3D it-&gt;seco=
nd.commandline;<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pathList[0].IsUrl())<=
br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0{<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0AddParam(sCmd, pathList[0].GetSVNPathString());<br />+ =C2=A0 =C2=
=A0 =C2=A0 =C2=A0}<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0else<br />+ =C2=A0 =C2=
=A0 =C2=A0 =C2=A0{<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0SVN =C2=
=A0 =C2=A0 svn;<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CString sUr=
l =3D svn.GetURLFromPath(pathList[0]);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0AddParam(sCmd, sUrl);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br /=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CString error;<br />=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0RunScript(sCmd, pathList, error, it-&gt;second.bWait, it-&gt;=
second.bShow);<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m_lastPreConnectTicks=
 =3D GetTickCount64();<br /></div><div>]]]</div><div><br /></div><div>SVN::=
GetUrlFromPath (svn_client_url_from_path2) seems to be a local operation on=
ly (otherwise we might get infinite recursion).</div><div><br /></div><div>=
Does this look OK or do I miss something?</div><div><br /></div><div>Cheers=
,</div><div>Daniel</div><div><br /></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;TortoiseSVN-dev&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">tor=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
tortoisesvn-dev/62c68949-dd5b-4f04-933f-de7c28d7a975n%40googlegroups.com?ut=
m_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/tor=
toisesvn-dev/62c68949-dd5b-4f04-933f-de7c28d7a975n%40googlegroups.com</a>.<=
br />

------=_Part_848399_1672656240.1783020088343--

------=_Part_848398_826886361.1783020088343--