Subversion 合并来自不同存储库的更改 [英] Subversion merging changes from a different repository

查看:20
本文介绍了Subversion 合并来自不同存储库的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很困惑.我想做的事情 a) 看起来应该很简单,并且 b) 其他人必须一直做,但我无法在任何地方找到最好的方法.

I'm really confused. I want to do something that a) seems like it should be pretty simple, and b) other people must do all the time, but I cant find out the best way to do it anywhere.

有一个包含一些 3rd 方代码的外部存储库.我想复制第 1 版的代码并将其放入我自己的存储库中,然后根据自己的需要对其进行自定义.当该代码的第 2 版发布时,我希望能够使用第 2 版的所有更改升级我的自定义版本,同时保留我的自定义设置.

There's an external repository that contains some 3rd party code. I want to take a copy of version 1 of the code and put it in my own repository, and then customise it for my own needs. When version 2 of that code is released I want to be able to upgrade my customised version with all of the version 2 changes, retaining my customisations.

我已经阅读了有关供应商分支的信息(http:///svnbook.red-bean.com/en/1.5/svn.advanced.vendorbr.html) 但我不明白为什么需要合并供应商代码的先前副本和供应商代码的新副本如此复杂(即 svn_load_dirs.pl).当然,如果 3rd 方代码存储在 SVN 存储库中,那么关于哪些文件已移动/被删除的所有历史记录都是已知的,那么您为什么需要手动告诉它更改了什么?

I've read about vendor branches (http://svnbook.red-bean.com/en/1.5/svn.advanced.vendorbr.html) but I don't understand why merging the previous copy of the vendor code and the new copy of the vendor code needs to be so complicated (ie. svn_load_dirs.pl). Surely, if the 3rd party code is stored in an SVN repository, all of the history regarding which files have moved/been deleted is known, so why do you need to tell it what's changed manually?

引用:

例如,您将有机会告诉脚本您知道 libcomplex 1.0 版中的文件 math.c 在 libcomplex 1.1 中重命名为 Math.c.

For example, you will have the opportunity to tell the script that you know that the file math.c in version 1.0 of libcomplex was renamed to arithmetic.c in libcomplex 1.1.

我也读过(http://svn.haxx.se/users/archive-2006-04/0285.shtml) 可以简单地在不同的存储库之间运行合并,但我认为这是不可能的,每当我尝试它时失败(虽然我可能做错了什么).

I've also read (http://svn.haxx.se/users/archive-2006-04/0285.shtml) that it is possible to simply run a merge between different repositories, but I didn't think that was possible, and whenever I've tried it it's failed (though I could have been doing something wrong).

谁能为我澄清这一点,并提出最佳解决方案?

Can anyone clarify this for me, and suggest the best solution?

推荐答案

我刚刚用 TortoiseSVN 做了一个简短的实验:

I've just tried a brief experiment with TortoiseSVN:

创建测试存储库

  1. 在 rep1 和 rep2 中创建两个新存储库
  2. 将 rep1 签出到 co1
  3. 将文本文件添加到 co1 并签入
  4. 将 rep1 导出到 ex1
  5. 将 ex1 导入到 rep2

在此阶段,您将处于在新存储库中创建本地分支"的状态.现有项目只需要最后两个步骤即可.

At this stage you will be in the state of having created your local 'branch' in a new repository. The last two steps are all you need for an existing project.

要模拟对原始 repo 的一些更改,请修改 co1 中的文本文件并提交更改.

To simulate some changes to the original repo, modify the text file in co1 and commit the changes.

合并更改

现在,要创建您自己的工作副本,请将 rep2 签入 co2.

Now, to create your own working copy, check out rep2 into co2.

我们应该准备好尝试从 rep1 合并到 co2.

We should be ready to try merging from rep1 into co2.

打开 co2 的合并对话框并将其指向 rep1.

Open the merge dialog for co2 and point it at rep1.

对于来自"修订版,选择您导出副本的修订版(在本例中为修订版 1),或您上次将本地副本更新到的修订版.

For the 'from' revision select the revision at which you exported your copy (in this case revision 1), or the revision that you last updated your local copy to.

对于to"修订版,选择要应用的 HEAD 或最新更新.

For the 'to' revision select the HEAD or the latest update you want to apply.

结果

这似乎按预期工作,rep1 的修改应用于 co2 中 rep2 的工作副本.然后需要将这些提交回您的本地存储库.

This seems to work as expected, with the modifications from rep1 being applied to the working copy of rep2 in co2. These then need to be committed back to your local repository.

这篇关于Subversion 合并来自不同存储库的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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