On Aug 29, 2007, at 10:46, Patwardhan, Rajesh wrote:
> Ryan Schmidt wrote:
>> On Aug 26, 2007, at 23:56, Patwardhan, Rajesh wrote:
>>> Wondering how users are handling the creation of tags and
>>> branches if
>>> a branch or tag already exists ...
>>> For e.g
>>> 1/ Url: http://svn.mycompany.com/svn/
>>> 2/ I have the typical project -- trunk
>>> branches --|
>>> --> mybranch
>>> Now if a branch for e.g. mybranch exists and I try to create it
>>> 3/ svn copy $URL/trunk $URL/branches/mybranch now if the mybranch
>>> exists then I would expect the svn operation to fail ..
>>> But I get
>>> Any hints or scripts.
>> The behavior of the svn cp command is consistent with the behavior
>> of the Unix cp command.
> Agreed: This is as per unix but in unix I can do test to see if the
> directory \ file I am copying exists in the destination.
> How can I simulate that with Subversion.
> Is svn ls the only method or could someone suggest other alternatives.
> Is there a hook someone else already has ...
"svn ls" seems completely sufficient for this task. Here's a little
shell script you can save as "svnbranchexists":
if [ -z "$1" ]; then
echo "usage: $0 <branch>"
svn ls $BRANCH >/dev/null 2>&1
if [ 0 -eq $? ]; then
echo "branch $1 exists"
echo "branch $1 does not exist"
Here's examples of using it:
usage: ./svnbranchexists <branch>
$ ./svnbranchexists nonexistent
branch nonexistent does not exist
$ ./svnbranchexists 1.4.x
branch 1.4.x exists
To use it on your repo, put your repository URL into the REPO
This assumes you're on a Unix-like operating system. If you're on
Windows, you'll need to convert the script to a scripting language
that exists on Windows, or use Bash in Cygwin.
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
Received on Thu Aug 30 02:23:16 2007