Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to verify a directory is a SVN repository

Tags:

svn

In the process of setting up a backup 'script' for my SVN directories ( ON THE SERVER - not my local working directories) via svnadmin using a GUI or DND to add to the backup list I would like to check, as a safety feature, that each of the selected directories is in fact a proper SVN directory.

I have looked at my existing directory structure and find it has the following sub-directories: conf, db, hooks, locks as well as the files format & README.txt

All SVN repos & directories are presently created/handled by the current version 1.7.10 of TortoiseSVN.

Any ideas or comments on how checking for this specific structure is a good way to accept only SVN directories and reject all others?

TIA

like image 827
user999713 Avatar asked Nov 20 '25 13:11

user999713


1 Answers

Just came across this same problem. The commands svnlook info and svnlook youngest (and probably others as well) give an exit code of 0 or 1 depending on whether the supplied directory is a subversion repository or not. This applies to SVN repos and not 'working copy' of them as user999713 claims. So the following bash script shows 0 when directory is a SVN repo and 1 if not.

svnlook info directory > /dev/null 2>&1
echo $?
like image 71
user3493403 Avatar answered Nov 24 '25 23:11

user3493403



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!