I am writing a script which will add a new project in the repository, based on the name supplied by the user. Part of this involves checking that an url with the same name does not already exist on the repository.
In the repository, all the projects of our team are stored in
https://developernetwork.repo.net/svn/Projects/
Let's say that the user wants to call the project "Calculator" and runs the script. In this case, we need to ensure that the following does not already exist in the repository
https://developernetwork.repo.net/svn/Projects/Calculator/
Is there an svn command which I can use to accomplish that? Unfortunately I cannot see an appropriate command I can use in the svn documentation (http://svnbook.red-bean.com/en/1.0/svn-book.html) at all.
- Download and install TortoiseSVN on your machine. - Click right on a2 and select SVN checkout. In the window that pops up, select the URL https://svn.cs.dal.ca/eem/csci3151/a2 and checkout directory C:\.... \a2 and OK.
Check out files from Subversion repositoryIn the Get from Version Control dialog, click Add Repository Location and specify the repository URL. Click Check Out. In the dialog that opens, specify the destination directory where the local copy of the repository files will be created, and click OK.
As illustrated throughout this book, Subversion uses URLs to identify versioned resources in Subversion repositories. For the most part, these URLs use the standard syntax, allowing for server names and port numbers to be specified as part of the URL: $ svn checkout http://svn.example.com:9834/repos …
Open the SVN server, right-click on the repository and select the copy URL to clipboard (for the VIsualSVN server) and paste it on the command line. User credentials will be the same as what we set at the time of user creation. After every successful checkout operation, the output will print a revision number.
Instead of checking for return strings I would just check for the return code:
both
svn ls REPOSITORY/PATH
and
svn info REPOSITORY/PATH
return 0 if all went fine, and 1 if things went wrong; you can quickly check it out:
echo $?
so in a bash script just do something like:
error=$? if [ $error -ne 0 ]; then YOUR ERROR HANDLING fi
works like a treat!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With