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

一世执手 提交于 2019-12-22 04:24:10

问题


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:


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




回答2:


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:


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




回答4:


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.




回答5:


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>




回答6:


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.




回答7:


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.




回答8:


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.



来源:https://stackoverflow.com/questions/747597/how-do-we-keep-track-of-our-working-copys-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!