Eclipse 将分支合并到主干
我正在尝试将我的开发分支合并回我的存储库的主干中。我采取的步骤:
- 切换到主干,
- 检查它是否是最新的,解决任何冲突
- 转到团队 -> 合并
- 选择 URL:开发分支
- 开始修订:创建分支时的修订
- 结束修订:HEAD
- OK
这应该会起作用 - 它打开同步视图,这很好,显示了所有冲突,但问题发生了:
在比较编辑器中,我看到两个文件: 本地文件|远程文件(306)
这真的很奇怪,远程文件的修订号实际上是工作副本(主干)中的文件之一,内容也是如此。本地文件有分支中文件的内容。
现在箭头正确显示我正在从左到右合并(分支到主干)。当我单击“确定”时也会发生这种情况。
但我只能从右向左移动更改!这不是我想要的 - 我不想用主干的旧内容覆盖分支中的更改。我想将内容从左(分支)移动到右(主干)。但我什至无法写入正确的文件。
我不知道为什么它在那里写入远程文件?它在远程文件窗口中清楚地显示工作副本文件,并且来自分支(用于合并)的文件显示在本地文件中。
Subversive 中有一些错误吗?
谢谢, 马丁
I am trying to merge my development branch back into the trunk of my repo. Steps I took:
- Switch to trunk
- check that it is up to date, resolve any conflicts
- Go to Team->Merge
- Select URL : development branch
- Start Revision: Revision when branch was created
- End Revision: HEAD
- OK
This should do the magic - it opens up the syncronize view which is fine, shows me all the conflicts, but there the problem happens:
In the compare editor I see two files:
Local File | Remote File (306)
This is really strange, the revision number of the remote file is actually the one of the file in the working copy (trunk) and so is the content. The local file has the content of the file in the branch.
Now the arrow shows correctly that I am merging from left to right (branch to trunk). This also happens when I click ok.
BUT I can only move changes from right to left!!! That's not what I want - I do not want to overwrite the changes in the branches with the old content of the trunk. I want to move the content from left (branch) to right (trunk). But I can't even write in the right file.
I do not know why it writes remote file there?? It's clearly showing the working copy file in the remote file window, and the file from the branch (for merging) is shown in local file.
Some bug in Subversive?
Thx,
Martin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 subversive 来说,合并从来都不是一件容易的事(正如这个旧的SO问题),因此在外部(或使用 subclipse)进行合并可能会在这里更容易。
如果您的客户端和存储库至少都在 SVN1.5 中,Subversive 新的合并功能会更好,但仍然很危险,如 此线程。
Merges are never been easy with subversive (as mentioned in this old SO question), so may be doing the merge externally (or with subclipse) would be easier here.
If your client and repository are both at least in SVN1.5, Subversive new merge capabilities are better, but still dangerous as illustrated by this thread.
好吧,一开始这看起来很神秘,现在我将提供一个不错的尝试来为每个人更新这个答案。这涉及使用 Eclipse 的 SVN Subversive 客户端进行合并:
您正在正确地进行合并,从 Trunk 开始,然后指向本地分支下的文件。您的文件将在“团队同步”选项卡下的“文本比较”窗口中打开。如果您在左侧导航栏中没有看到冲突,则说明您的合并刚刚发生。是的,这令人困惑且不直观。
文本比较窗口为您提供了在提交之前撤消更改(或可能无意中进入合并文件的任何其他更改)的能力。请记住,您是从 Branch 中提取文件,因此想法是 Branch 文件位于 Trunk 中,但在最终提交之前处于一种虚拟状态,并且此处更改或撤消不需要的更改会引用 Branch 中的文件(显然)。这就是为什么您只有一个单向管道(主干到分支)来覆盖那些通过工作副本合并到主干中的更改。您的合并已经发生,但尚未完全正式。
如果一切正常,请右键单击导航器窗口(我的 Eclipse Helios 安装中的左侧窗格)中的文件,然后从下拉列表中选择“接受”。然后单击返回到主代码查看选项卡(在我的安装中它是 PHP,但它可以是您正在使用的任何内容),然后将文件提交到 Trunk。
如果您想测试这一点,请在提交之前在主干中“按原样”查看文件,如果您正确完成了合并,您应该会看到您的更改反映在那里。这似乎就是我在 OSX Snow Leopard Macbook Pro 上的工作方式。不确定对于 Windows 或 Linux 用户来说是否相同。我认为这本质上是相同/相似的过程。
Well this seemed mysterious at first, now I shall provide a decent stab at updating this answer for everyone. This regards merging using the SVN Subversive client for Eclipse:
You are doing your merge correctly, starting in Trunk and then pointing to your file under your local Branch. Your files open up in the "Text Compare" window under the Team Synchronizing tab. If you do not see conflicts over in the left hand navigation column, then your merge has just happened. Yes, this is confusing and non-intuitive.
What the Text Compare window offers you is the ability to undo your change (or any others that may have gotten into your merged file unawares) before you commit it. Remember that you are pulling in the file from Branch, so the idea is that the Branch file is in Trunk but in a kind of virtual limbo until finally committed, and changing or undoing unwanted changes here references the file in Branch (obviously). That is why you only have a one-way pipe (Trunk to Branch) to overwrite those changed merged into Trunk via your working copy. Your merge has taken place, but it's not quite official yet.
If all looks as it should, right click the file in the navigator window (left pane in my Eclipse Helios install) and choose Accept from the drop-down. Then click back over to your main code-viewing tab (in my installation it's PHP but it could be whatever you are using) and then commit the file to Trunk.
If you want to test this, do a view of the file "as is" in Trunk before committing and you should see your changes reflected there if you have done your merge correctly. This appears to be the way it is working for me on an OSX Snow Leopard Macbook Pro. Not sure if it's the same for Windows or Linux folks. I assume it's essentially the same/similar process.
很容易
通过 check out as... 给出不同的项目名称,
签出 trunk。现在,您在本地拥有了工作副本、您想要提交的主干以及您正在处理的分支以及您已将其更改提交到存储库的情况。
现在右键单击主干项目(我的意思是项目,而不是单个文件) - 合并 - 选择分支项目(再次,项目)
接受对本地副本的所有更改
像以前一样提交您需要的内容
一切都很好,再次删除主干并继续在分支上工作,
特别是对于分支,这看起来非常简单,对我来说就像一个魅力
it's easy
check out trunk with check out as... give a different project name.
Now you have both locally as working copy, trunk you wanna commit to and the branch you are working on and whose changes you have comitted to the repository.
Now rightclick the trunk project (and I mean the project, not single files) - merge - select the branch project (again, PROJECT)
accept all changes to local copy
commit what you need to trunk as used to
all fine, delete trunk again and keep working on the branch
especially with branches this seems super easy and worked like a charm for me