SVN:在 Eclipse 中同步分支与主干?

发布于 2024-12-05 17:47:39 字数 337 浏览 0 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

滿滿的愛 2024-12-12 17:47:39

正确的方法是使用 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.

娇俏 2024-12-12 17:47:39

我会将分支和主干作为单独的 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 ;))

心碎无痕… 2024-12-12 17:47:39

我同意它的设计并不是很直观,但马克是对的,您在将更改提交回主干时“同步”更改:

  • 首先确保您的本地分支与存储库分支完全同步(没有更改)
  • 团队 -> 合并...您的分支的本地副本与存储库主干
  • 您现在拥有该合并的本地版本
  • 您可以在本地编辑此版本,确保测试正常工作并且没有编译器错误
  • 最后您将本地合并分支版本与存储库分支同步,并提交除此之外所做的所有更改

,与将分支合并回存储库主干的方式相同

  • ,确保分支的所有更改都提交到存储库分支
  • 切换到主干团队 -> 切换...
  • 将您的主干与您的分支合并团队 -> 合并...(选项卡“重新集成”)
  • 您现在拥有合并的本地版本,您可以编辑更改并查看它们,确保您有一个工作版本现在
  • 同步您的本地主干(合并版本)与存储库主干
  • 提交您希望出现在主干中的所有更改

我建议将您在本地所做的所有更改提交到合并,因为您已经在本地测试了它们。如果您只提交了一些更改,请确保存储库版本在缺少更改的情况下仍然可以工作

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:

  • first make sure your local branch is completely synchronized with your repository branch (no changes)
  • Team -> Merge... your local copy of the branch with the repository trunk
  • you now have a local version of that merge
  • you can locally edit this version, make sure tests are working and there are no compiler errors
  • finally you synchronize your local merged branch version with the repository branch and commit all changes that have been made

besides, the same way you'll merge your branch back into the repository trunk

  • make sure all changes of your branch are committed to the repository branch
  • switch to the trunk Team -> Switch...
  • merge your trunk with your branch Team -> Merge... (Tab 'Reintegrate')
  • you now have a local version of the merge, you may edit the changes and review them, make sure that you have a working version now
  • synchronize your local trunk (merged version) with the repository trunk
  • commit all changes that you want to appear in the 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文