Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concise command line for subversion copy (branch)

All examples of svn branching I have seen so far look like this svn cp -m 'Making test branch' svn://svnrepo/hellosite svn://svnrepo/hellosite2

So in order to branch I need to specify full URL of remote repository every time. But:

  • Working copy is associated with one single remote repository. Even svn switch is considered to be advanced "surgical" operation.
  • Branching of remote urls in same repository as working copy is always the case (at least I have never needed to branch in repository that is completely unrelated to current one).
  • Copying between repositories is not supported (right?).
  • Information about remote repository is available: see svn info.

So why in the world should I type complete URLs every time?!! Or do I miss something? Is there some shortcut that allows referring current remote repository? Something like svn cp -m 'Making test branch' //hellosite //hellosite2

like image 563
Petr Gladkikh Avatar asked May 18 '11 10:05

Petr Gladkikh


People also ask

How do I copy a branch in svn?

All you need to do is make a copy of your project using "svn copy". This command will require the URL of your project's /trunk directory as well as the URL of the directory where you want to create your branch. This location will virtually always be inside of your /branches directory.

How do I tag a branch in svn?

Select the folder in your working copy which you want to copy to a branch or tag, then select the command TortoiseSVN → Branch/Tag.... If you can't remember the naming convention you used last time, click the button on the right to open the repository browser so you can view the existing repository structure.

Which is the svn command to see the list of changes made in a working copy before committing to the repository?

Use svn status command to get the status of the file in the working copy. It displays whether the working copy is modified, or its been added/deleted, or file is not under revision control, etc. 'M' represents that the item has been modified.


2 Answers

Using SVN 1.6 or later, if you're inside a working copy at the time then you can use the caret notation as a short-cut to the repository root, e.g.

svn cp -m 'Making test branch' ^/trunk ^/branches/hellosite 

Note that on Windows at least you'll need to surround the ^/trunk in double quotes to get it through the shell.

svn cp -m "Making test branch" "^/trunk" "^/branches/hellosite" 
like image 55
Rup Avatar answered Oct 02 '22 04:10

Rup


You can simply add an alias to your shell. See this this SO post for example.

like image 35
CharlesB Avatar answered Oct 02 '22 03:10

CharlesB