24

How can I check my svn connection?

I just want to try to connect to server and check the status of my connection.. After that I will do something like check out and etc. well may be another way to get it?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Vepr
  • 241
  • 1
  • 2
  • 3
  • Why do you need to check the connection? If you commit and it's not working the commit will fail...where is the problem? – khmarbaise May 11 '10 at 08:55
  • @khmarbaise For example if the svn command is deep inside a complex bash script and you want to check all external connections before engaging. – mcabreb Dec 03 '21 at 10:37
  • That will not really help because if check before hand it could even fail at the real execution...so the script etc. should do correct error handling/checking... – khmarbaise Dec 03 '21 at 12:39

4 Answers4

17

If you do not have any checked-out working copy, you can use

svn ls svn://server/repo

which lists contents of the repository if connection is successfull.

Other parameters like --username ABC --password XYZ and --non-interactive can be useful too if you are e.g. testing your credentials validity. Also, adding --depth empty should produce empty output if it succeeds (could be useful for scripting purposes).

cin
  • 351
  • 3
  • 14
10

Simply issue svn log and see if it fails.

Johannes Rudolph
  • 35,298
  • 14
  • 114
  • 172
  • 3
    Sorry, but this is not an answer OP asked what to do before check out... – Betlista Aug 18 '17 at 14:13
  • 2
    None of these answers work. The OP wants to *quickly* check connectivity for scripting purposes. I want to *quickly* check to see if an svn connection will hang, without having to wait 60+ seconds for a connection to timeout. 'svn log' in particular takes forever, because it retrieves the log of the entire repository which can take minutes for a large repository. – Keith Knauber Jun 28 '18 at 15:14
  • Does not work from a client that has not checked out any files yet. – Jay Elston Jul 11 '18 at 00:06
-1

Like Johannes already told you can use svn log to check the connection. If you want to see which settings apply to your current working copy use svn info.

stigi
  • 6,661
  • 3
  • 40
  • 50
-1

Just call http get on any SVN url like:

https://username:password@server/repo
Jiří Herník
  • 2,412
  • 1
  • 25
  • 26