了解分支在 Visual Studio 2010、AnkhSVN 和 SVN 1.7.4 中的使用 [英] Understanding branch use with Visual Studio 2010, AnkhSVN, and SVN 1.7.4

查看:32
本文介绍了了解分支在 Visual Studio 2010、AnkhSVN 和 SVN 1.7.4 中的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全是 Subversion 的新手,但我正在努力摆脱 SourceSafe 可怕的阴影.所以我正在学习,试图自学什么是什么,但我遇到了一些我还不太明白的障碍.

SVN 1.7.3 已在本地 Linux 机器上启动并运行.AnkhSVN 安装在我的 VS 2010 设置中.VS/AnkhSVN 可以与我的存储库通信.所以我开始尝试一些非常简单的控制台项目来开始.我按照目前找到的指南中的建议创建了主干、分支和标签目录.

我创建了一个新的控制台解决方案,并允许 Ankh 在我的存储库中推荐的trunk"文件夹下创建该项目.在向 Program.cs 添加一行Hello, World"之后,我将更改提交到主干.这有效......到目前为止,很好......

我现在想假装我在私人分支上工作,所以我从trunk"和Head/Latest"版本中选择 Subversion->Branch Project...,选中创建后切换到分支"."这似乎进展顺利.

问题 1.

现在事情变得危险了.我决定将单个源文件添加到我的私有分支中的项目,添加文件,但我无法将该文件从我的私有分支移动到主干.合并/重新整合不起作用.更新不起作用.开关不起作用.现在,在尝试从分支切换到主干后,VS 告诉我我的项目文件已损坏且无法加载.

显然,我做错了什么,但我不知道是什么.看来我只需要获取一个主干工作副本,然后进行合并,但是如何在我的 VS 项目文件夹设置中执行此操作?

问题 2

我的下一个问题或问题,可能是问题 1 的一部分,是了解应如何在 Visual Studio 端构建 Subversion 管理的项目.在 Unix 方面对我来说更清楚,您可以将项目拉入本地文件夹,但完全不清楚 VS 项目的典型目录结构应该如何受到 Subversion 的影响.是否也应该在本地 Visual Studio 框中复制主干和分支文件夹?如果我从主干切换"到专用分支(或反之亦然),则意图是将相应的文件放入同一组 VS 文件夹中,还是应该为分支和主干设置相应的文件夹?

问题 3这更像是一个 SVN 新手问题,但是当 SVN 告诉我存在冲突时,我还不明白如何解决它们.ankhSVN插件有解决冲突的特殊工具,还是需要用完整的svn工具在主机服务器上修复?如果是这样,要解决的最典型"的冲突是什么?

解决方案

要做的第一件事:至少阅读 使用 Subversion 进行版本控制 并使用示例.要完成后者,最好使用命令行客户端,例如 Slik SVN.>

对于 SVN 客户端来说,AnkhSVN 本身是不够的 - 它只是将 SVN 集成到 VS 中的便利工具.因此,如果您想使用 GUI 客户端(除了命令行客户端,恕我直言在任何情况下都是必须的),那么最流行的 Windows 客户端是 乌龟 SVN.

(主动)阅读使用 Subversion 进行版本控制将帮助您解决所有当前问题,但这里有一些初步想法:

问题 1 你提交你的分支了吗?您可以通过运行 svn info [repo_url]/branches/[your_branch]

来确保

问题 2 您似乎有一些误解:SVN 还会在本地拉取"(术语是签出")您的文件.看书!!!

一般来说,您的 SVN 结构应该反映您的文件夹结构,反之亦然.通常,您一次只在一个分支上工作,并且只签出一个分支.当您需要在另一个分支上工作时,您可以使用 'svn switch'.它节省空间.现在,您当然可以从 repo 根目录开始检查所有存储库,但是为什么要这样做呢?(我可以想到这种情况,但他们更关心存储库维护,而不是常规工作流程).

问题 3 冲突 - 在您阅读本书之前甚至不值得谈论.

我希望这会为您指明正确的方向.阅读本书的前两章应该需要几个小时到几天的时间.

I am a complete newb to Subversion, but am trying to get past the frightening shadow of SourceSafe. So I'm learning, trying to teach myself what's what, and I've come across some roadblocks I don't quite understand yet.

SVN 1.7.3 is up and running on a local Linux box. AnkhSVN is installed within my VS 2010 setup. VS/AnkhSVN can talk to my repository. So I started experimenting with some very simple Console projects to get started. I created the trunk, branches, and tags directories as suggested in the guidance I've found so far.

I created a new Console solution, and allowed Ankh to create that project in my repository under the recommended "trunk" folder. After adding nothing more than a "Hello, World" line to Program.cs, I commit the changes to trunk. That works...so far, so good...

I'm now wanting to pretend I'm working on a private branch, so I select Subversion->Branch Project... from "trunk" and the "Head/Latest" version, checking "Switch to Branch after creation." That seems to go well.

Problem 1.

Now here's where things get dicey. I decide to add a single source file to the project in my private branch, adding the file, but I cannot get the file to move from my private branch to trunk. Merging/reintegrate doesn't work. Update doesn't work. Switch doesn't work. Now, after trying a switch from the branch to the trunk, VS tells me my project file is corrupt and can't be loaded.

Obviously, I've done something terribly wrong, but I don't know what. It appears I just need to get a trunk working copy, then do a merge, but how do I do that in my VS project folder setup?

Problem 2

My next problem, or question, which may be part of Problem 1, is understanding how Subversion-managed projects should be structured on the Visual Studio side. Its much clearer to me on the Unix side that you can pull a project into a local folder, but its not at all clear how the typical directory structure of a VS project is supposed to be affected by Subversion. Should the trunk and branches folders be duplicated on the local Visual Studio box as well? If I "switch" from trunk to a private branch (or vice-versa), is the intent that the corresponding files should be going into the same set of VS folders, or should there be a corresponding set for the branches and for the trunk?

Problem 3 This is more of a newbie SVN question, but when SVN tells me there are conflicts, I don't yet understand how to resolve them. Does the ankhSVN plug-in have special tools to resolve conflicts, or do I need to fix them on the host server with the full svn tool? If so, what's is the "most typical" kind of conflict to resolve?

解决方案

First thing to do: read at least the first two chapters of Version Control with Subversion and play with the examples. To do the latter it's better to use a command-line client, such as Slik SVN.

AnkhSVN on its own is not enough for an SVN client - it's just a convenience tool for integrating SVN into VS. So if you'd like to use a GUI client (in addition to a command-line client, that IMHO is a must in any case), then most popular one for Windows is Tortoise SVN.

(Actively) reading Version Control with Subversion will help you with all your current questions, but here are some initial thoughts:

Problem 1 Did you commit your branch? You can make sure by running svn info [repo_url]/branches/[your_branch]

Problem 2 It seems that there is some misunderstanding on you part: SVN also 'pulls' (the term is 'check out') your files locally. Read the book!!!

In general, your SVN structure should reflect your folder structure, not vice versa. Also generally you work on only one branch at a time, and have only one branch checked out. When you need to work on another branch you do 'svn switch'. It conserves space. Now, of course you can check out all of your repository starting at the repo root, but why would you do that? (I can think of such situations, but they are more concerned with repository maintenance, rather than with a regular workflow).

Problem 3 Conflicts - not even worth talking about until you read the book.

I hope this will point you in the right direction. Reading the first two chapters of the book should take you anywhere from couple of hours to couple of days.

这篇关于了解分支在 Visual Studio 2010、AnkhSVN 和 SVN 1.7.4 中的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆