SVN:在 Eclipse 中同步分支与主干?
我有一个 SVN 分支和一个主干。树干会定期变化,而树枝则不会。
我时不时地(假设每周一次)我想用主干的最新更改更新分支的本地工作副本。
理想情况下,我希望以与使用最新版本的分支相同的方式执行此操作:使用 Eclipse:Team->Synchronize,以便我可以在更新之前查看所有更改。
对于不同的存储库(例如:主干)也可以这样做吗? 如果没有,人们如何在更新之前查看更改?
我查看了“团队”->“合并”,但这似乎将更改直接更新到我的工作副本,而无法先查看更改(我认为预览功能令人困惑,并且没有提供好的方面- Synchronize 的更改/冲突的侧面视图)。
I have an SVN branch and a trunk. The trunk changes regularly and the branch doesn't.
Every now and then (let's say once per week) I want to update the local working copy of the branch with the latest changes of the trunk.
Ideally I would want to do this the same way as I do it with the latest version of the branch: with Eclipse : Team->Synchronize, so I can review all changes before updating.
Is this also possible with a different repository (for example : trunk) ?
If not, how do people review the changes before updating then??
I looked at Team->Merge, but this seems to update the changes directly to my working copy, without the possibility to review the changes first (the Preview-function is confusing, I think, and doesn't provide the nice side-by-side view of changes/conflicts that Synchronize has).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正确的方法是使用 Merge。 Subclipse 包含一个合并客户端,可以轻松完成此操作。你说得对,它没有给你一个真正的预览,但从 Subversion 的角度来看,它的工作方式更好。合并结果视图 UI 与同步视图基本相同。它可以让您轻松检查合并在工作副本中所做的每个更改,并且它打开的 Eclipse 比较编辑器可以让您在提交之前轻松删除代码中不需要的任何更改部分。
尝试从“同步”视图执行此操作的问题是,您随后将使用代码编辑器自行进行合并,而 Subversion 不知道合并的内容。如果您让 Subversion 首先进行合并,那么它可以正确更新其所有元数据,并且在提交合并结果之前将代码修复为您想要的方式是完全可以的。
The right way to do this is with Merge. Subclipse includes a merge client that makes this easy to do. You are right that it does not give you a true preview, but the way it works is better from a Subversion perspective. The Merge Results view UI is basically the same as the Synchronize view. It lets you easily examine every change that the merge made in your working copy and the Eclipse compare editor that it opens makes it very easy to take out any parts of the change that you do not want in your code before you commit.
The problem with trying to do this from the Synchronize view is that you are then doing the merge yourself using code editors and Subversion has no awareness of what is merged. If you let Subversion first do the merge, then it can update all of its metadata properly and it is perfectly fine for you to then fixup the code to be the way you want it before you commit the results of the merge.
我会将分支和主干作为单独的 Eclipse 项目检出到工作区中。然后使用一些合并工具,例如 meld 来合并它们之间的更改。合并后,您可以在 Eclipse 中刷新分支并将其与 svn 存储库同步 - 现在您可以查看所有更改。 (这就是我的做法,因为我不相信 svn eclipse 插件;))
I'd checkout both branch and trunk as a separate eclipse projects into workspace. Then use some merging tool, for example meld to merge changes between them. After merge you can refresh branch in Eclipse and synchronize it with svn repository - now you can review all changes. (it's how I do it, since I do not believe svn eclipse plugin ;))
我同意它的设计并不是很直观,但马克是对的,您在将更改提交回主干时“同步”更改:
,与将分支合并回存储库主干的方式相同
我建议将您在本地所做的所有更改提交到合并,因为您已经在本地测试了它们。如果您只提交了一些更改,请确保存储库版本在缺少更改的情况下仍然可以工作
I agree that it is not really intuitive by design, but Mark is right, you "synchronize" your changes when committing them back to the trunk:
besides, the same way you'll merge your branch back into the repository trunk
i recommend to commit all changes that you've made locally to your merge, since you've tested them locally. if you commit just a few changes, make sure the repository version is still working then with missing changes