使用 TortoiseSVN 如何合并从主干到分支的更改,反之亦然? [英] Using TortoiseSVN how do I merge changes from the trunk to a branch and vice versa?

查看:20
本文介绍了使用 TortoiseSVN 如何合并从主干到分支的更改,反之亦然?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读有关使用优秀且免费的 Subversion 版本控制与 Subversion 1.5 进行分支/合并的内容 书.我想我了解如何使用 Subversion 命令行客户端来执行我最需要的操作,它们是:

I've been reading up on branching/merging with Subversion 1.5 using the excellent and free Version Control with Subversion book. I think that I understand how to use the Subversion command line client to perform the actions that I need most often, which are:

使用主干中的更改更新分支

从分支的工作目录运行:

From the branch's working directory run:

svn 合并 http://svn.myurl.com/proj/trunk

合并分支到主干

从主干的工作目录运行:

From the trunk's working directory run:

svn merge --reintegrate http://svn.myurl.com/proj/branches/mybranch

svn merge --reintegrate http://svn.myurl.com/proj/branches/mybranch

然而,我们使用 TortoiseSVN 1.5 作为我们的 Subversion 接口.我想知道如何最好地使用 TortoiseSVN 执行这些操作.新对话框在主菜单上提供了三个不同的选项.

However, we are using TortoiseSVN 1.5 as our interface to Subversion. I would like to know how best to perform these operations with TortoiseSVN. The new dialog provides three different options on the main menu.

  1. 合并一系列修订
  2. 重新整合一个分支
  3. 合并两棵树

据我所知,TortoiseSVN 总是使用以下语法执行 svn.

From what I can gather, TortoiseSVN always executes svn with the following syntax.

svn merge [--dry-run] --force From_URL@revN To_URL@revM PATH

svn merge [--dry-run] --force From_URL@revN To_URL@revM PATH

此外,重新集成分支经常失败,并显示一条消息,指出某些目标尚未合并,因此无法继续,因此我不得不使用选项 #3.

Additionally, reintegrate a branch often fails with a message stating that some targets have not been merged and so it cannot continue, and so I had to use option #3.

我的问题是:

  1. 如何使用 TortoiseSVN 1.5 将更改从主干合并到分支?
  2. 我如何使用 TortoiseSVN 1.5 将分支合并到主干,使用和不使用重新集成方法?
  3. 我应该为每个选项使用上述哪个选项,为什么?

<小时>

编辑

通过dry run"测试我发现命令行Subversion操作

Through "dry run" testing I have found that the command line Subversion operation

svn 合并 http://svn.myurl.com/proj/trunk

类似于 TortoiseSVN 中的选项 #1(合并修订范围),只要我将修订范围留空即可.

is analogous to option #1 (Merge a Range of Revisions) in TortoiseSVN, as long as I leave the revision range blank.

推荐答案

行为取决于您的存储库的版本.Subversion 1.5 允许 4 种类型的合并:

The behavior depends on which version your repository has. Subversion 1.5 allows 4 types of merge:

  1. 合并 sourceURL1[@N] sourceURL2[@M] [WCPATH]
  2. 合并 sourceWCPATH1@N sourceWCPATH2@M [WCPATH]
  3. 合并 [-c M[,N...] |-r N:M ...] 源[@REV] [WCPATH]
  4. merge --reintegrate SOURCE[@REV] [WCPATH]

Subversion 1.5 之前只允许前两种格式.

Subversion before 1.5 only allowed the first 2 formats.

从技术上讲,您可以使用前两种方法执行所有合并,但后两种方法启用 Subversion 1.5 的合并跟踪.

Technically you can perform all merges with the first two methods, but the last two enable subversion 1.5's merge tracking.

当您的存储库为 1.5+ 时,TortoiseSVN 的选项将范围或修订映射合并到方法 3,或者当您的存储库较旧时合并到方法一.

TortoiseSVN's options merge a range or revisions maps to method 3 when your repository is 1.5+ or to method one when your repository is older.

将功能合并到发布/维护分支时,您应该使用合并一系列修订版"命令.

When merging features over to a release/maintenance branch you should use the 'Merge a range of revisions' command.

只有当您想将分支的所有功能合并回父分支(通常是主干)时,您才应该考虑使用重新集成分支".

Only when you want to merge all features of a branch back to a parent branch (commonly trunk) you should look into using 'Reintegrate a branch'.

最后一个命令 - 合并两个不同的树 - 仅在您想要超出正常分支行为时才有用.(例如,比较不同的版本,然后将不同的版本合并到另一个分支)

And the last command -Merge two different trees- is only usefull when you want to step outside the normal branching behavior. (E.g. Comparing different releases and then merging the differenct to yet another branch)

这篇关于使用 TortoiseSVN 如何合并从主干到分支的更改,反之亦然?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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