Danra
Danra

Reputation: 9946

Create svn branch from url of working copy

Using SVN command-line, how can I create a branch from the URL of my current working copy? (NOT from my local working copy, which may have local changes)

Looking for a direct way, without going through "svn info" to get the URL.

Upvotes: 3

Views: 2362

Answers (3)

Matt Beckman
Matt Beckman

Reputation: 5012

How about this?

svn copy ^/@HEAD <Branch URL>

EDIT

As branches, tags, and the trunk are just paths and completely arbitrary in SVN, I don't think you'll be able to accomplish what you're trying to do without getting a little creative (e.g. outside of a built-in SVN command). To accomplish what I think you want to do, you can use a bash script (assuming Mac/Linux):

#!/bin/bash

CURRENT_URL=$(svn info | grep ^URL | cut -d" " -f2)

svn copy $CURRENT_URL "^/branches/$1"

Usage: svnbranch.sh newbranch

Upvotes: 2

Dmitry Egorenkov
Dmitry Egorenkov

Reputation: 1055

Run `svn help copy' and carefully read its output. I think --revision option might help.

Upvotes: 1

Skippy Fastol
Skippy Fastol

Reputation: 1785

You can just perform

svn copy <URL of existing URI> <New URL>

You can obtain the URL of the existing working copy thanks to "svn info".

The should not exist in the SVN server tree, or you'll in fact create a subdirectory in that URL.

The copy will occur directly on the server. You will in fact directly "Commit" your change, without needing any working copy.

Upvotes: 1

Related Questions