Just want to share a small thing I made for people using Tortoise SVN
(and similar tools) over VPNs (virtual private networks). (It'll also
help with RAS dial-ups, I think.)
It's just a command-line exe that checks if a VPN is connected and, if
not, tells Windows to connect to it and waits for that to finish.
If you access SVN over a VPN it can be a pain to manually connect
first (especially if the VPN disconnects due to inactivity and you're
never sure if it's still connected).
I couldn't find a good one existing solution so I wrote my own. (I
found was RasDial.exe but that prompts via the command-line and asks
for the VPN password even if you're already connected.)
After testing (on Windows 7 x64, FWIW) for a few weeks it seems to
work well. The binary and C++ source are here:
http://www.pretentiousname.com/miscsoft/index.html#ConnectVPN
To use it with Tortoise SVN, first create a .bat file that runs the
tool with the name of your VPN (the connection name in the network
control panel). Then tell Tortoise to run the .bat file as part of its
pre_commit_hook and pre_update_hook. (Set both to wait=true and
show/hide=hide.)
(A .bat file is used because AFAIK you can't specify arbitrary
command-line arguments for hooks in the Tortoise SVN.)
When you commit or update:
- If you're not on the VPN, you'll see the standard Windows VPN/RAS
connection user interface (password prompt, progress windows, etc.).
Once connected the commit/update will continue as normal.
- If you're already connected then nothing extra will happen and
you'll commit/update as normal.
Limitation:
- AFAIK, Tortoise SVN only has hooks for commit and update so there's
no way to run the tool before other events (e.g. log or blame). I've
not found that to be a big deal but it'll depend how you typically use
SVN.
It's a very simple tool but I hope other people find it useful.
Leo
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2630515
To unsubscribe from this discussion, e-mail: [users-un...@tortoisesvn.tigris.org].
Silly question, but why would you need a VPN to get TortoiseSVN to
work? You're not using file:// access are you?
Simon
--
: ___
: oo // \\ "De Chelonian Mobile"
: (_,\/ \_/ \ TortoiseSVN
: \ \_/_\_/> The coolest Interface to (Sub)Version Control
: /_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2630529
I can only access my repositories when I'm outside the office if I
connect via VPN - our server isn't publicly accessible.
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2630537
I've created an issue for a hook script that runs before a remote
connection:
http://code.google.com/p/tortoisesvn/issues/detail?id=38
would you mind if I include your tool in TSVN?
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2631023
> I've created an issue for a hook script that runs before a remote
> connection:
> http://code.google.com/p/tortoisesvn/issues/detail?id=38
Cool! Thank you.
> would you mind if I include your tool in TSVN?
No problem! Feel free to use/include the tool and/or the source any
way you wish.
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2631145
>> would you mind if I include your tool in TSVN?
>
> No problem! Feel free to use/include the tool and/or the source any
> way you wish.
Oops, that compelled me to take another look at the source code and I
spotted a minor typo/bug. I've put a new version up fixing this:
* Now waits for VPN connection to complete if it was in the middle of
connecting.when run. (Was meant to originally but there was a typo in
the source.)
Sorry about that!
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2631156
LD> I couldn't find a good one existing solution so I wrote my own. (I
LD> found was RasDial.exe but that prompts via the command-line and asks
LD> for the VPN password even if you're already connected.)
nircmd rasdial "VPN Connection Name Here"
nircmd rashangup "VPN Connection Name Here"
... and other nice functions.
http://www.nirsoft.net/utils/nircmd.html
Freeware.
Exe file is only 29 Kb.
---=====---
Alexander
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2631200
nircmd is a great toolbox but in this case didn't do what I want. Its
rasdial features seem to be a subset of the rasdial.exe that comes
with Windows (probably written at a time when rasdial.exe didn't
exist).
nircmd will not show any user interface when establishing the
connection and, in particular, won't prompt for the VPN username or
password if they are not saved with the connection settings.
(You can specify the password to nircmd via the command line but I
don't want the password stored in a batch file. I also like to see the
connection progress dialogs as it sometimes takes a long time, gets
stuck or fails, so it's useful to see which stage the connection is
at.)
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2631326
I've committed your tool in r19873 with some small modifications:
* compiled as win, not console app
* use of our own auto-pointer class
* replaced console output with message boxes
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2631969
> I've committed your tool in r19873 with some small modifications:
> * compiled as win, not console app
> * use of our own auto-pointer class
> * replaced console output with message boxes
>
> http://code.google.com/p/tortoisesvn/source/browse/#svn/trunk/contrib/hook-scripts/client-side/ConnectVPN
Excellent.
The changes make sense. Not sure why I didn't use win/message boxes
originally. :)
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2632002
btw: you don't have to use a bat file to start the tool. Just pass the
parameter as part of the "path to script".
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2632004
> btw: you don't have to use a bat file to start the tool. Just pass the
> parameter as part of the "path to script".
I couldn't get that to work. I haven't had a chance to investigate
properly but a couple of ideas:
There's a space in the path to the command (I've got it stored below
Program Files) which might complicate things. I tried with and without
quotes around the command path, with the VPN name argument always
unquoted.
Also, if TSVN always sends the normal arguments (PATH DEPTH
MESSAGEFILE CWD) to the command, appended to the string in the config
dialog, I think that will cause my code to reject the command-line for
having too many arguments. (I wrote it like that so people who don't
know to quote arguments get a syntax error if their VPN name contains
a space.)
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2632031
This works (at least with the new pre-connect hook on trunk) just fine:
put the path to the exe in quotes, add a space and then the parameter.
> Also, if TSVN always sends the normal arguments (PATH DEPTH
> MESSAGEFILE CWD) to the command, appended to the string in the config
> dialog, I think that will cause my code to reject the command-line for
> having too many arguments. (I wrote it like that so people who don't
> know to quote arguments get a syntax error if their VPN name contains
> a space.)
Ok, in that case you're out of luck. The other hooks all pass the
parameters unconditionally so the hook script has to deal with those.
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2632834
To unsubscribe from this discussion, e-mail: [users-unsubscribe@tortoisesvn.tigris.org].