Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion switch: How can I see which branch is current?

We're experimenting with Subversion as a possible replacement of our current Starteam 2005 SCM, (so our SVN knowledge is limited at the moment :-)).

I've been experimenting with the switch command (using the TortoiseSVN client) and was surprised that, after I switched my local trunk folder to a certain branch there is no way to see which branch I switched to last. Or at least I can't find a way to ascertain that.

Am I doing something wrong here by switching a local trunk folder to a branch? How can I see which branch the current local trunk-folder is referring to?

like image 308
Bascy Avatar asked May 20 '11 11:05

Bascy


People also ask

How can I see svn branches?

and tags, and then just "ls". You can run "svn list -h" for more info on list.

How do I switch to a different branch in svn?

When you svn switch your working copy to the branch, the local changes will remain. You can then test and commit them to the branch. You can , however, use svn switch with the --relocate switch if the URL of your server changes and you don't want to abandon an existing working copy.


2 Answers

Though a couple of correct answers have already been provided, I want to point out that there are several more techniques one may use to see where you are in Subversion. Here is the complete list:

  1. Windows Explorer -- Windows Explorer has the flexibility to add columns from a large set of choices beyond the standard name, size, type, and modified date. Right click on the column headers bar, select More from the context menu, then scroll down to the SVN choice. SVN short URL is the best choice for this question since it begins the path with either trunk or branches. Requires TortoiseSVN installed. Caveat: Available in Windows XP but not later ones (Windows Vista, Windows 7, etc.). Sigh...

SVN location from Windows Explorer

  1. TortoiseSVN Revision Graph -- The revision graph is apparently not well known but is a great visual tool for answering many questions, including this one. You have to enable the display of the current revision with the indicated button in the tool bar. Once you do that, TortoiseSVN adds a bold line around the current version of the object you are examining, whether on the trunk or a branch. Caveat: TortoiseSVN does not always find the current version. As I was preparing this illustration, it did not highlight anything in the graph when I was on the branch.

SVN location from Revision Graph

  1. TortoiseSVN Repo-Browser -- Open the repo browser on a file or folder and examine either the URL at the top or the path in the left hand navigation pane. (Any other TortoiseSVN dialogs displaying a URL will show the information similarly as pointed out by @fsonmezay.) SVN location from Repo Browser

  2. File properties -- From Windows Explorer or equivalent, open the standard file properties dialog--not the TortoiseSVN properties! Then select the Subversion tab to see all the information available from the command line, including the URL that indicates trunk or branch in the path. It requires TortoiseSVN to be installed (previously mentioned by @Cedric).

SVN location from file properties

  1. Command-line -- svn info or svn info filename provides details of your current directory or specified file, respectively, including the URL that indicates trunk or branch in the path (previously mentioned by @Cedric).

SVN location from command line

like image 188
Michael Sorens Avatar answered Sep 23 '22 07:09

Michael Sorens


You should retrieve this information in the output of svn info, which is available as a command-line feature or available in the TortoiseSVN sub menu when right clicking on an SVN item. Here is the TortoiseSVN explorer integration help, you should obtain all the information about this integration and the available commands. The output of svn info is almost displayed in the Properties item.

like image 39
Cédric Julien Avatar answered Sep 21 '22 07:09

Cédric Julien