简体   繁体   English

Subversion是否合并差异或仅更新未修改文件的修订版

[英]Does Subversion merge diff or just update revision on unmodified files

We have some feature branches that can get put on ice for a few weeks at a time. 我们有一些功能分支,一次可以放几个星期。 After making many changes in the trunk, is it best to merge the changes from trunk into the branches or drop the branch and create a new branch directly from the trunk and copy the changes from the starting branch into it. 在主干中进行了许多更改之后,最好将主干中的更改合并到分支中,或者直接从主干中删除分支并创建一个新分支,并将更改从起始分支复制到其中。

The reason I ask is that for a merge SVN simply takes a diff of the trunk from last merge to head and applies that to the branch. 我问的原因是,对于合并,SVN只需从上一次合并到头部之间获取主干的差异,然后将其应用于分支。

In many cases the changes in the trunk far outweigh the changes in the branch, so from the size of the diff it would make sense to drop the feature branch and create a new one with the feature branches changes patched in. 在许多情况下,干线中的更改远大于分支中的更改,因此从diff的大小来看,删除特征分支并创建一个修补了特征分支更改的新分支是有意义的。

This is particularly an issue when a lot of PDF's are updated. 当更新许多PDF时,这尤其是一个问题。

It seems like another way would be for SVN to realize that a file in the branch was never touched and therefore update the revision number it points to rather than blindly applying the diff. 对于SVN来说,似乎另一种方式是意识到分支中的文件从未被触摸过,因此更新了它指向的修订号,而不是盲目地应用diff。

From the output of Subversion it seems as if it is applying the diffs though. 从Subversion的输出来看,似乎好像正在应用diff。

It seems like another way would be for SVN to realize that a file in the branch was not touched and therefore update the revision number it points to. 对于SVN来说,似乎另一种方式是意识到分支中的文件没有被触摸,因此更新了它指向的修订号。 This would avoid the extra space for the diff. 这样可以避免diff多余的空间。

AFAIK, applying diff don't take any significant extra space in subversion. AFAIK,应用diff不会在Subversion中占用任何可观的额外空间。 If the diff is small, it should take merely the similar amount of space as just updating revision. 如果差异较小,则仅应占用与更新修订版相似的空间量。

BTW, merging from trunk to branch ? 顺便说一句,从主干合并到分支? It'd only make sense only if you plan to merge branch back to the trunk later. 仅当您计划稍后将分支合并回主干时才有意义。

http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html

I think the way you're using Subversion is probably incorrect (I've done this before to). 我认为您使用Subversion的方式可能不正确(我之前已经这样做过)。 What you need to do is merge a range of revisions into your trunk. 您需要做的是将一系列修订合并到您的主干中。 Example: 例:

Rev: 100 
/trunk

(Make a branch) (开店)

Rev:101 
/trunk (r100) 
/branch (r101)

(Lots of changes) (很多变化)

Rev: 200 
/trunk (r100)
/branch (r200)

Now what you need to do is to generate all the diffs between r100 and r200 and apply them to the trunk. 现在,您需要做的是生成r100和r200之间的所有差异,并将它们应用于干线。 Merge is a little misleading ( like the documentation states ). 合并有点误导( 例如文档说明 )。 Your use case is a fairly common scenario which is covered in the documentation . 您的用例是一个相当常见的场景, 在文档中进行了介绍

I don't think there's any best practise on whether to merge trunk->branch or branch->trunk. 我认为关于合并trunk-> branch或branch-> trunk没有最佳实践。 It's very dependant on how you want to work and your scenario. 这很大程度上取决于您的工作方式和方案。 From the sounds of it, the feature branch would be more unstable the trunk. 从它的声音来看,特征分支将更加不稳定。 It would make sense to merge into trunk once you have the feature completed. 完成功能后,将其合并到中继中将很有意义。 In order to limit conflicts when you merge back into trunk, you can continuously merge from the trunk->branch. 为了限制合并回中继时的冲突,可以从“中继”->“分支”连续合并。

From the Subversion 1.6 CHANGES file: 从Subversion 1.6 CHANGES文件中:

identical files share storage space in repository (issue #2286) 相同的文件共享存储库中的存储空间(issue#2286)

So, it appears that even though the diff is applied, upon commit, the code should discover identical files and just use pointers to the first version of the files. 因此,似乎即使应用了diff,在提交时,代码也应该发现相同的文件,并且仅使用指向文件第一个版本的指针。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM