简体   繁体   English

svn mergeinfo属性,如何查找,删除或忽略

[英]svn mergeinfo property, how to find, remove, or ignore

I have a repository with the standard branches/tags/trunk directory structure. 我有一个带有标准branchs / tags / trunk目录结构的存储库。 The trunk contains some svnexternals stuff (not sure if that matters for this question, just pointing it out in case). 行李箱包含一些svnexternals的东西(不确定是否对这个问题重要,以防万一。

This is a brand new project where we haven't done a release to production yet, so this issue isn't as big of a deal as it will be in a few months. 这是一个全新的项目,我们还没有正式发布产品,因此这个问题的重要性不如几个月之内大。

I'm trying to merge [set of revisions] from our trunk (development) into our test branch. 我正在尝试将主干(开发)中的[修订集]合并到我们的测试分支中。 Right now, I'm getting the infamous merge info error. 现在,我收到了臭名昭著的合并信息错误。 See here for more info. 有关更多信息,请参见此处 In order to get past this error for now, I'm DELETING the test branch, then re-creating it. 为了暂时解决此错误,我将删除测试分支,然后重新创建它。 But, this obviously is not a good way to go, especially after we start doing more and more builds and code moves to our test branch. 但是,这显然不是一个好方法,特别是在我们开始进行越来越多的构建并将代码移到我们的测试分支之后。

So...I've gone through all of the folders at the test branch level, as well as everything higher up and there aren't ANY mergeinfo properties set. 所以...我已经遍历了测试分支级别的所有文件夹,以及更高级别的所有内容,并且没有设置任何mergeinfo属性。 In fact, the ONLY property I found that was set was my svnexternals, on one folder. 实际上,我发现设置的唯一属性是我的svnexternals,位于一个文件夹中。 From the link I put in above, one of the other options says to set the ignoreancestry option. 在上面我输入的链接中,另一个选项之一是设置ignoregencestry选项。 My version of Tortoise defaults that already and it doesn't work. 我的Tortoise版本已经默认,并且不起作用。

Is there another approach to finding the mergeinfo property so I can remove it? 还有另一种方法来查找mergeinfo属性,以便可以将其删除吗? Or, is there another way to ignore the mergeinfo property so I can get these merge's done instead of blowing away my branch? 或者,还有另一种忽略mergeinfo属性的方法,这样我就可以完成这些合并,而不必浪费我的分支了?

Edit: By the way, I'm using Tortoise version 1.8.4.24972 (64-bit) 编辑:顺便说一下,我正在使用Tortoise版本1.8.4.24972(64位)

Edit2: I'm doing EVERYTHING from the TortoiseSVN Gui Client (aka I haven't done anything from command-line) Edit2:我正在使用TortoiseSVN Gui Client进行所有操作(也就是我没有从命令行执行任何操作)

Edit3: Hi David, I don't do ANYTHING via command-line. Edit3:嗨,大卫,我不通过命令行执行任何操作。 Here's the steps that I've tried, and the error: Right-click "test" branch, TortoiseSVN -> Merge...Select "Merge a range of revisions". 这是我尝试过的步骤以及错误:右键单击“测试”分支,TortoiseSVN->合并...选择“合并一系列修订”。 URL to merge from: ...../trunk, "Revision range to merge" = "all revisions". 要合并的URL:..... / trunk,“要合并的修订范围” =“所有修订”。 Ignore Ancestry is true. 忽略祖先是真的。 When I click ok, the error says: "Error, cannot merge automatically while ignoring mergeinfo" 当我单击“确定”时,错误提示:“错误,忽略mergeinfo时无法自动合并”

Also, "how do I create the test branch?". 另外,“如何创建测试分支?”。 If it already exists, I open the TortoiseSVN -> Repo browser. 如果已经存在,请打开TortoiseSVN-> Repo浏览器。 Navigate to the "branches" directory. 导航到“分支”目录。 In the right-side pane, right-click on the "test" branch, select "Delete" and give my comment "merge is hard for newbies". 在右侧窗格中,右键单击“测试”分支,选择“删除”,并给我评论“新手很难合并”。 Next, go back to Windows Explorer where my source code is location. 接下来,返回到我的源代码所在的Windows资源管理器。 Right-click on "trunk", select "Branches/Tags...". 右键单击“ trunk”,选择“分支/标签...”。 Select the location to create the branch/tag, which is ../branches/test. 选择要创建分支/标记的位置,即../branches/test。 Done. 完成。

How are you creating that test branch? 您如何创建该测试分支?

The right way 正确的方式

$ svn cp $REPO/trunk/proj $REPO/branches/branch_name/proj

The wrong way 错误的方法

$ svn mkdir $REPO/branches/branch_name/proj
$ svn co $REPO/branches/branch_name/proj      # This will be empty
$ svn export $REPO/trunk/proj                 # Copy in the files from prom
$ svn add -R .                                # Add the files back in
$ svn commit

In order to do a merge, you need three things: 为了进行合并,您需要三件事:

  • Where you're merging to. 您要合并的地方。
  • Where you're merging from. 您要合并的地方。
  • The last common ancestor between the two. 两者之间的最后一个共同祖先。

When you use svn cp , Subversion can track the history of the file from the originating branch (or trunk). 使用svn cp ,Subversion可以跟踪原始分支(或主干)中文件的历史记录。 When you copy the files in and use svn add -R . 当您复制文件并使用svn add -R . , Subversion believes these files are completely different files from the ones you copy them from. ,Subversion认为这些文件与您从中复制文件的文件完全不同。

When you do a merge, and the branch was made incorrectly, Subversion is going to hit a lot of conflicts with a lot of local file/remote add errors because Subversion will attempt to add a file to the branch, but already see a file with the same name already there. 当您进行合并时,分支创建不正确时,Subversion将与大量本地文件/远程添加错误发生大量冲突,因为Subversion会尝试将文件添加到分支中,但已经看到了带有相同的名字已经在那里。

Is this a possible that you did an add to create a branch instead of a svn cp ? 这是否可能是您执行添加操作来创建分支而不是svn cp What is the exact error messages you're getting? 您收到的确切错误消息是什么? What version of the Subversion client are you using? 您正在使用哪个版本的Subversion客户端? Are you merging both from test to trunk and trunk to test or only one way? 您是从测试到主干还是从主干到测试合并,还是仅以一种方式合并? Are you cherry picking revisions? 您正在挑选修订版吗?


ADDENDUM: Hi David, I don't do ANYTHING via command-line. 附录:大卫,您好,我没有通过命令行执行任何操作。

Then, see how that test branch was created. 然后,查看该测试分支是如何创建的。 That might help pin down the issue. 这可能有助于解决问题。 Select Log Messages for the test branch. test分支选择日志消息 On the bottom, deselect the Stop on Copy/Rename . 在底部,取消选择“ 复制/重命名时停止” Then look at the oldest revision in the list. 然后查看列表中最旧的修订。 Mine looks like this: 我的看起来像这样:

Path                 Action    Copy from Path    Revision
-------------------  --------  ----------------  ---------
/branches/5.1/proj   Added     /trunk/proj       12344

Note the Copy from Path column. 请注意从路径复制列。 This shows me that the branch was made by copying the trunk via the equivalent of the svn cp command. 这说明分支是通过等效于svn cp命令的主干复制而成的。 If I turn off that Stop on copy/rename , I'll see even more of the log as the history continues down the branch. 如果我关闭了“ 停止复制/重命名”功能 ,那么随着历史沿分支继续下去,我还会看到更多日志。

One of the big issues I've seen in TortoiseSVN is that it's easy to branch by creating the branch, then dragging the files in trunk's working directory into the new branch and select TortoiseSVN->Add from the menu. 我在TortoiseSVN中看到的主要问题之一是,创建分支很容易进行分支 ,然后将主干工作目录中的文件拖到新分支中,然后从菜单中选择TortoiseSVN-> Add

The correct way to create a branch is to right-click on the repository browser on the trunk project, and select copy to... from the context menu. 创建分支的正确方法是右键单击主干项目上的存储库浏览器,然后从上下文菜单中选择“ 复制到... ”。 This will present to you a copy to dialog box, and you type in the new URL for the branch. 这将向您显示一个“ 复制到”对话框,然后键入分支的新URL。

If you look at Show log , and you don't see that Copy from Path column, but instead see an add for each file, you know that the branch was created incorrectly. 如果查看Show log ,但看不到“ 从路径复制”列,而是看到每个文件都有一个添加项,则说明该分支创建不正确。 This will cause your merges to have problems. 这将导致您的合并出现问题。

What to do? 该怎么办? There's not much you can do. 您无能为力。 You can Ignore History on the merge which may help, but the svn:mergeinfo will be useless and you'll have to manually track what you've previously merged. 您可以忽略合并时的历史记录 ,这可能会有所帮助,但是svn:mergeinfo将无用,并且您必须手动跟踪以前合并的内容。 Plus, there's a good likelihood that you'll still end up with lots of conflicts. 另外,很有可能您仍然会遇到很多冲突。

To do that, select the normal Merge a range of revisions , and on the last screen, select Ignore Ancestry . 为此,选择普通的合并一系列修订 ,然后在最后一个屏幕上,选择忽略祖先

If you are making a branch using the TortoiseSVN copy and not via Windows copy and add, there maybe another issue. 如果您使用TortoiseSVN副本而不是Windows副本并添加来创建分支,则可能存在另一个问题。 I'll need to see the exact errors you're getting. 我需要查看您得到的确切错误。 There are several issues that will cause merge conflicts. 有几个问题将导致合并冲突。 For example, someone makes the same changes on a branch as they did to Trunk. 例如,某人在分支上所做的更改与对Trunk所做的相同。 Imagine someone found a problem on the branch, fixed it, and then thought I might as well fix it on trunk while I'm at it . 想象一下,有人在树枝上发现了一个问题,将其修复,然后以为我不妨在树干上修复它 In this case, you'll get a conflict because the same file was added or deleted, or the same lines were changed in the same file. 在这种情况下,由于添加或删除了相同的文件,或者在同一文件中更改了相同的行,您将发生冲突。 These types of changes can easily be resolved, but are a pain. 这些类型的更改可以轻松解决,但是很痛苦。

To not get those errors, instead of duplicating a change on both branch and trunk, the developer should have merged that one change from branch to trunk (or visa versa). 为了避免出现这些错误,开发人员应该将分支和主干之间的更改合并 (或者反之亦然),而不是在分支和主干上都进行更改。

Does this help? 这有帮助吗?

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

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