views:

353

answers:

7

Are there any good techniques to help us know which branch (or trunk) our working copy is from? We recently converted to Subversion and we're using release branches. I had two developers commit changes to the release branch that should have been committed to the trunk. We're using CI (TeamCity), so I recognized the problem right away and was able to revert the changes but I'd like to prevent it from happening again. From within Visual Studio, especially, it's easy to make a mistake and commit to the wrong branch.

We're using TortoiseSVN and AnkhSVN.

Edited to add: Just to clarify, I'm looking for a method to prevent careless mistakes, I already know how to find this information. There are two careless mistakes I'm trying to prevent:

  1. Doing work on the wrong branch. If this is caught before commit, the developer has to merge the changes back into the correct branch.
  2. Committing to the wrong branch. This combines the pain of point 1 with having to revert the changes in Subversion.

Edited to add: We just made the switch to the VisualSVN VS plugin and it has a toolbar that displays the path of the current working copy. I really like the reassurance that I'm working on the right branch.

+1  A: 

Right click the folder, move to the subversion tab, there it says the project it's linked to.

Also, in the commit dialog, it says so at the top of the dialog.

Dave Van den Eynde
True enough, but this hasn't prevented mistakes. We normally do commits from VS and AnkhSVN does not display the URL. Maybe it's time to look at VisualSVN.
Jamie Ide
So now you're asking a different question alltogether.
Dave Van den Eynde
A: 

From the working directory:

svn info

URL will contain the branch your working directory points to.

<EDIT> Seeing how many people dislike the command line, the closes thing I found from TortoiseSVN is the "repo browser" which seems to use the selected branch as your starting path in the repo. </EDIT>

Jukka Dahlbom
+4  A: 

Perhaps you should consider using a pre-commit hook: http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html

Then you could do something like only approve checkins that have 'for release' in the comments for that particular branch or something like that and return an error message otherwise.

dar
A: 

Tortoise SVN adds columns to the Windows Explorer view. In "Details" mode, right-click on column headers to get a list of available columns, at the bottom, select "More" to get a dialog of all available column types.

SVN short URL should quickly show you what the location is in the repository.

But this doesn't appear to work under vista ...

Jim T
+1  A: 

Avoid re-using working copies. If you're working on 2 places in the repository, have 2 working copies, named appropriately, like: Project-trunk, Project-release.

Jim T
+1  A: 

In AnkhSVN (in Visual Studio) the project url of your working copy is from is displayed in the 'Working on' field of the Pending Changes Window (View->Pending Changes).

The url of a file/folder is also displayed in the Visual Studio project window when you select a file in the Pending Changes Window or Working Copy Explorer (and in many cases even when you select a file in the Solution explorer; but this depends on the project type).

[Update: I just added AnkhSVN issue #581 for extension of the commit dialog.]

Bert Huijben
A: 

Here is a simple idea which might help:
Create an empty text file named "branch_XX" (or any name) and add it to your branch.
commit this and then when you switch to the trunk, the file will not appear in the solution explorer.

It sounds stupid... but it does the trick.

I really hope they will add something that might mark what branch we are using without going to other windows.

Ran