Re: Adding a URL parameter to the pre-connect hook script

Stefan via TortoiseSVN-dev <[email protected]> Sun, 5 Jul 2026 01:35:18 -0700 (PDT)
Newsgroups gmane.comp.version-control.subversion.tortoisesvn.devel
Message-ID <[email protected]>
------=_Part_309342_1649702937.1783240518102
Content-Type: multipart/alternative; 
	boundary="----=_Part_309343_1463256898.1783240518102"

------=_Part_309343_1463256898.1783240518102
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On Thursday, July 2, 2026 at 9:21:28=E2=80=AFPM UTC+2 [email protected]=
 wrote:

Hi,

I've been toying with adding a parameter to the pre-connect hook script to=
=20
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=
=20
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 =3D it->second.commandline;
+        if (pathList[0].IsUrl())


you have to check first whether pathList is not empty.

=20

+        {
+            AddParam(sCmd, pathList[0].GetSVNPathString());
+        }
+        else
+        {
+            SVN     svn;
+            CString sUrl =3D svn.GetURLFromPath(pathList[0]);
+            AddParam(sCmd, sUrl);
+        }
         CString error;
         RunScript(sCmd, pathList, error, it->second.bWait,=20
it->second.bShow);
         m_lastPreConnectTicks =3D GetTickCount64();
]]]

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

Does this look OK or do I miss something?


The rest looks ok to me.
=20
Stefan

--=20
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 e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/tortoisesvn=
-dev/e3c4fa69-51bc-4255-baed-ba13fe65abebn%40googlegroups.com.

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

<br /><br /><div><div dir=3D"auto">On Thursday, July 2, 2026 at 9:21:28=E2=
=80=AFPM UTC+2 [email protected] wrote:<br /></div><blockquote style=3D=
"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padd=
ing-left: 1ex;">Hi,<div><br /></div><div>I've been toying with adding a par=
ameter to the pre-connect hook script to be able to see the URL of the repo=
sitory.</div><div><br /></div><div>The following seems to work:</div><div>[=
[[</div><div>--- C:/Users/daniel/AppData/Local/Temp/Hooks.cpp-revBASE.svn00=
3.tmp.cpp<span style=3D"white-space: pre;">	</span>fre jul 28 18:31:23 2023=
<br />+++ C:/Devel/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 @@ boo=
l CHooks::PreConnect(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 sC=
md =3D it-&gt;second.commandline;<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pat=
hList[0].IsUrl())<br /></div></blockquote><div><br /></div><div>you have to=
 check first whether pathList is not empty.</div><div><br /></div><div>=C2=
=A0</div><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px s=
olid rgb(204, 204, 204); padding-left: 1ex;"><div>+ =C2=A0 =C2=A0 =C2=A0 =
=C2=A0{<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AddParam(sCmd, path=
List[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 sUrl =3D svn.GetURLFromPath(pathL=
ist[0]);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AddParam(sCmd, sUr=
l);<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 only (otherwise we might get =
infinite recursion).</div><div><br /></div><div>Does this look OK or do I m=
iss something?</div></blockquote><div><br /></div><div>The rest looks ok to=
 me.</div><div>=C2=A0</div><div>Stefan</div></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/e3c4fa69-51bc-4255-baed-ba13fe65abebn%40googlegroups.com?ut=
m_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/tor=
toisesvn-dev/e3c4fa69-51bc-4255-baed-ba13fe65abebn%40googlegroups.com</a>.<=
br />

------=_Part_309343_1463256898.1783240518102--

------=_Part_309342_1649702937.1783240518102--