Re: Adding a URL parameter to the pre-connect hook script
Daniel Sahlberg via TortoiseSVN-dev <[email protected]> Sun, 5 Jul 2026 02:00:21 -0700 (PDT)
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_134636_395376403.1783242021368 Content-Type: multipart/alternative; boundary="----=_Part_134637_2123064420.1783242021368" ------=_Part_134637_2123064420.1783242021368 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable s=C3=B6ndag 5 juli 2026 kl. 10:35:18 UTC+2 skrev Stefan: 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 Thanks. I've added this in r29802. /Daniel =20 --=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/74307b4f-765d-4855-940f-c89175bd5a59n%40googlegroups.com. ------=_Part_134637_2123064420.1783242021368 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div><div dir=3D"auto">s=C3=B6ndag 5 juli 2026 kl. 10:35:18 UTC+2 skrev Ste= fan:<br /></div><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left= : 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div dir=3D"auto">= On Thursday, July 2, 2026 at 9:21:28=E2=80=AFPM UTC+2 <a href=3D"" rel=3D"n= ofollow">[email protected]</a> wrote:<br /></div><blockquote style=3D"m= argin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); paddin= g-left: 1ex;">Hi,<div><br /></div><div>I've been toying with adding a param= eter to the pre-connect hook script to be able to see the URL of the reposi= tory.</div><div><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 style=3D"white-space: pre;"> </span>fre jul 28 18:31:23 2023<b= r />+++ 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 @@ bool = CHooks::PreConnect(const CTSVNPathList& 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->second.commandline;<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pathLi= st[0].IsUrl())<br /></div></blockquote><div><br /></div></div><div><div>you= have to check first whether pathList is not empty.</div></div><div><div><b= r /></div><div>=C2=A0</div><blockquote style=3D"margin: 0px 0px 0px 0.8ex; = border-left: 1px solid 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=A0A= ddParam(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 s= vn;<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CString sUrl =3D svn.Ge= tURLFromPath(pathList[0]);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= AddParam(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->second.bWait, it->second.bSho= w);<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m_lastPreConnectTicks =3D GetTic= kCount64();<br /></div><div>]]]</div><div><br /></div><div>SVN::GetUrlFromP= ath (svn_client_url_from_path2) seems to be a local operation only (otherwi= se we might get infinite recursion).</div><div><br /></div><div>Does this l= ook OK or do I miss something?</div></blockquote><div><br /></div></div><di= v><div>The rest looks ok to me.</div><div>=C2=A0</div><div>Stefan</div></di= v></blockquote><div><br /></div><div>Thanks. I've added this in r29802.</di= v><div><br /></div><div>/Daniel</div><div>=C2=A0</div></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;TortoiseSVN-dev" 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/74307b4f-765d-4855-940f-c89175bd5a59n%40googlegroups.com?ut= m_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/tor= toisesvn-dev/74307b4f-765d-4855-940f-c89175bd5a59n%40googlegroups.com</a>.<= br /> ------=_Part_134637_2123064420.1783242021368-- ------=_Part_134636_395376403.1783242021368--