gpt4 book ai didi

具有本地合并信息时,SVN 1.8 合并(分支重用)似乎已损坏

转载 作者:行者123 更新时间:2023-12-03 18:14:36 24 4
gpt4 key购买 nike

我们对新的 1.8 Subversion 客户端有问题(我们使用 TortoiseSVN 1.8.5 和 SlikSVN 1.8.5)。在某些情况下,重新集成后能够继续使用您的功能分支的新 SVN 1.8 功能似乎不起作用。

当主干包含本地合并信息(文件或子树上的合并信息)时,它不起作用。这可能会导致重新集成后分支复用的问题。如果使用“保持事件舞蹈”(使用仅记录选项)完成分支重用,这对于 1.7 客户端来说不是问题。

我已经制作了一个脚本来从头开始说明这个问题。它可以使用 1.8 客户端针对空存储库运行。

下面的脚本有 10 个步骤。步骤1-5用于创建trunk中具有本地mergeinfo的启动情况。步骤 6-9 模拟在功能分支 2 的生命周期内对主干所做的更改。步骤 10 是失败的步骤,它模拟重新集成后重用特征分支的第一步。

这是步骤 10 中的错误:

svn: E195016: Reintegrate can only be used if revisions 8 through 11 were pre
viously merged from svn://svn2010/practice/branches/featurebranch2 to the reinte
grate source, but this is not the case:
trunk/file1.txt
Missing ranges: /trunk/file1.txt:9

这是(Windows)脚本。
@ECHO OFF
ECHO ------------------------------------------------------------------
ECHO STEP 0: Create a repository
ECHO ------------------------------------------------------------------
if exist repo rmdir repo /S/Q
if exist trunk rmdir trunk /S/Q
if exist featurebranch1 rmdir featurebranch1 /S/Q
if exist featurebranch2 rmdir featurebranch2 /S/Q
svnadmin create repo --compatible-version 1.8
REM Make url based on current directory and replace backslashes by forward slashes
set url="file:///%cd:\=/%/repo"
ECHO url=%url%

ECHO ------------------------------------------------------------------
ECHO STEP 1: Create a trunk with 2 files
ECHO ------------------------------------------------------------------
svn mkdir -m "Create trunk" %url%/trunk
svn checkout %url%/trunk
echo Original file contents created in the trunk. > trunk\file1.txt
echo Original file contents created in the trunk. > trunk\file2.txt
svn add trunk\file1.txt
svn add trunk\file2.txt
svn -m "Added 2 files" commit trunk

ECHO ------------------------------------------------------------------
ECHO STEP 2: Create a copy (feature branch) from the trunk
ECHO ------------------------------------------------------------------
svn mkdir -m "Create branches dir" %url%/branches
svn copy -m "Create featurebranch1" %url%/trunk %url%/branches/featurebranch1

ECHO ------------------------------------------------------------------
ECHO STEP 3: Modify both files in the feature branch
ECHO ------------------------------------------------------------------
svn checkout %url%/branches/featurebranch1
echo Additional file contents created in featurebranch1. >> featurebranch1\file1.txt
echo Additional file contents created in featurebranch1. >> featurebranch1\file2.txt
svn -m "Modified 2 files in featurebranch1" commit featurebranch1

ECHO ------------------------------------------------------------------
ECHO STEP 4: Merge both files from featurebranch1 to the trunk to
ECHO create local mergeinfo on both files
ECHO ------------------------------------------------------------------
svn update trunk
svn merge %url%/branches/featurebranch1/file1.txt trunk/file1.txt
svn merge %url%/branches/featurebranch1/file2.txt trunk/file2.txt
svn -m "Merged 2 files from featurebranch1 to trunk" commit trunk

ECHO ------------------------------------------------------------------
ECHO STEP 5: Delete featurebranch2, we only needed it for the
ECHO initial setup
ECHO ------------------------------------------------------------------
svn delete -m "Delete featurebranch1" %url%/branches/featurebranch1

ECHO ------------------------------------------------------------------
ECHO STEP 6: This is the start of the problematic scenario
ECHO Create a new featurebranch2 from the trunk and a wc for it
ECHO ------------------------------------------------------------------
svn copy -m "Create featurebranch2" %url%/trunk %url%/branches/featurebranch2
svn checkout %url%/branches/featurebranch2

ECHO ------------------------------------------------------------------
ECHO STEP 7: Modify the contents of file1.txt in the trunk and leave
ECHO the contents of file2.txt unchanged (this is important)
ECHO ------------------------------------------------------------------
echo Additional file contents created in the trunk. >> trunk\file1.txt
svn -m "Modified file1.txt in the trunk" commit trunk

ECHO ------------------------------------------------------------------
ECHO STEP 8: Sync merge the trunk to featurebranch2
ECHO ------------------------------------------------------------------
svn update featurebranch2
svn merge %url%/trunk featurebranch2
svn -m "Sync merged the trunk into featurebranch2" commit featurebranch2

ECHO ------------------------------------------------------------------
ECHO STEP 9: Reintegrate featurebranch2 back into the trunk
ECHO ------------------------------------------------------------------
svn update trunk
svn merge %url%/branches/featurebranch2 trunk
svn -m "Reintegrated featurebranch2 back into the trunk" commit trunk

ECHO ------------------------------------------------------------------
ECHO STEP 10: Try to reuse featurebranch2 after it was reintegrated
ECHO Sync merge it from the trunk. THIS FAILS with SVN 1.8
ECHO ------------------------------------------------------------------
svn update featurebranch2
REM on SVN 1.7 we would use --record-only
svn merge %url%/trunk featurebranch2

:EOF

我不明白为什么会发生这种情况。此外,该错误报告缺少 file1.txt 的范围,而它似乎是缺少 mergeinfo 的 file2.txt。虽然不是解决方案,但删除主干中 file2.txt 上的本地合并信息似乎也可以解决问题。这也暗示错误消息报告了错误文件的某些内容。

编辑 : 回复@gbjbaanb
即使错误消息相同,此问题也比您指向的问题更微妙。在我的情况下,失败的不是重新集成到主干,而是之后对分支的重用。

此外,如果我查看 file1.txt 和 file2.txt 的合并信息,似乎 file2.txt 缺少 featurebranch2 的合并信息记录,因此问题出在 file2.txt 而不是 file1.txt,如错误所示。因为 file1.txt 在 featurebranch2 的生命周期中在主干中被更改,而 file2.txt 不是在第 8 步合并期间在 file2.txt 上未设置有关主干的合并信息。我相信这是它开始的地方出轨。这不会影响重新集成到主干,但它确实会阻止功能分支之后的重用。

编辑 : 回复@David W
我试过 --record-only -c 11 这也适用于 Windows 端。我已经在没有 -c 的情况下尝试过(通常你不应该,我知道,但在这种情况下没有其他变化)然后它报告:
svn: E200004: The required merge is reintegrate-like, and the record-only option
cannot be used with this kind of merge

为了更好的衡量,我还尝试了 --record-only -c 1-11 我期望的结果与不使用 -c 相同(因为 11 是 HEAD)。我最初的期望是它会以与不使用 -c 相同的方式失败,但事实并非如此。它以与 -c 11 相同的方式成功。

但我的帖子的重点是,在 SVN 1.8 中,我们不需要做保持事件的诡计。 (草案)文件说:

If you choose not to delete your branch after reintegrating it to the trunk you may continue to perform sync merges from the trunk and then reintegrate the branch again[37]. If you do this, only the changes made on your branch after the first reintegrate are merged to the trunk. (http://svnbook.red-bean.com).



来自 Subversion 1.8 的发行说明:

Merging to-and-fro between two branches in any order is possible using the automatic reintegration merge (the "keep-alive dance" is no longer necessary). For best results, it is recommended to always merge all eligible revisions, i.e. not using the -r or -c options of svn merge. Merging just a subset of eligible revisions increases the likelihood of problems during future merges.(https://subversion.apache.org/docs/release-notes/1.8.html)



所以我的观点是,这个没有保持事件诡计的分支重用在本地合并信息面前显然不起作用,我的脚本似乎表明了这一点。

如果您仍然认为有关缺失范围的警告可能是正确的,除了可能报告的范围数字,请告诉我在我的脚本中我导致缺失范围的位置。我的脚本是在trunk和branch之间简单的来回 没有 两者的并行工作。

您还可以解释为什么还要通过添加以下内容来修改 file2.txt:
“回显在主干中创建的附加文件内容。>>主干\file2.txt”
到第 7 步,将导致在第 10 步中不会出现错误。修改主干上的附加文件无法解决丢失范围的问题。

最佳答案

在 Subversion 邮件列表中:users@subversion.tigris.org 决定这个问题值得为其创建问题报告。有关更多信息,请参阅:
Issue report
Subversion user mailing list .

编辑:

从 1.8.9 版开始,它已被修复(问题 #4481)。谢谢!

关于具有本地合并信息时,SVN 1.8 合并(分支重用)似乎已损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22227852/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com