Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do we keep track of our working copy's branch?

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.

like image 549
Jamie Ide Avatar asked Feb 03 '23 11:02

Jamie Ide


2 Answers

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.

like image 58
dar Avatar answered Feb 06 '23 00:02

dar


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.]

like image 44
Bert Huijben Avatar answered Feb 06 '23 01:02

Bert Huijben