How do we keep track of our working copy's bra

2019-04-22 04:20发布

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.

8条回答
走好不送
2楼-- · 2019-04-22 05:12

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.

查看更多
地球回转人心会变
3楼-- · 2019-04-22 05:19

In AnkhSVN (in Visual Studio), right click on your project/solution, then Source Control -> Subversion -> Select in Repository Explorer. It will automatically select the branch you're currently working on (i.e. the branch you're switched to).

I don't think that the accepted answer for AnkhSVN works for Projects, since I always see the same URL in the "Pending Changes" even after I use the option "Switch Project" on a project.

查看更多
登录 后发表回答