在退出之前混乱的集成后,无法从主分支完全集成到功能分支 [英] Unable to integrate fully from main branch to feature branch, after backing out a previous messed-up integration

查看:36
本文介绍了在退出之前混乱的集成后,无法从主分支完全集成到功能分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Perforce P4V 客户端(版本 2013.1/611291,日期为 2013 年 3 月 20 日).

我尝试从主分支合并/集成到我的功能分支.我已经很久没有这样做了,所以大量的文件被添加到更改列表中.然后我解决了无法自动合并的冲突文件.然后我提交了更改列表.这样做之后,我发现一些文件一直处于混乱的冲突状态.究竟为什么对我来说是个谜,但与其尝试修复它们,我认为完全撤消合并/集成并重新开始会更容易.

要撤消合并/集成,我使用了退出"选项.所有受影响的文件都被添加到退出"更改列表中,我提交了它.我的功能分支现在又回到了它开始的地方,除了显然现在所有受影响的文件的修订号都增加了两次,受影响文件的历史记录显示了集成,然后是随后的退出".

问题是,如果我再次尝试合并/集成选项,这一次 Perforce 想要放入集成更改列表的文件数量现在只是它最初尝试集成的文件数量的一小部分.换句话说,它并没有添加很多我知道在主分支开发方面肯定会更进一步的文件.

我似乎能够解决这个问题的唯一方法是使用高级选项强制集成所有修订,忽略修订历史 (-f).设置此选项后,它将从分支添加合并所有 文件.

我怀疑问题与文件现在在其历史记录中标记了集成有关,因此 Perforce 使用该点作为基础.混乱的集成被取消"这一事实对此没有任何影响.

我也尝试过回滚,但同样的问题仍然存在.

我该如何解决这个问题?

编辑后来我意识到有以下类似的问题:如何才能我在 Perforce 中撤消了集成,但仍然可以重做?

解决方案

  • 您尝试从主分支集成到功能分支的文件在首次集成签入后具有集成历史记录.
  • 当您撤消更改时,您将功能分支的文件恢复到集成前的状态,但会为之前更改列表中的每个文件创建新版本的文件.
  • 因此,下一次集成将尝试引入自上次以来集成路径中的差异.

正如您已经提到的,摆脱这种情况的唯一方法是使用 -i 运行强制集成.您仍然可以像上次一样使用 p4 resolve -as ...p4 resolve -am ... 解决更改,然后手动解决剩余的冲突以执行合并.除了历史记录会显示在先前的合并提交中更改的文件的 2 个额外版本以及用于将其撤回的提交.

  • 如果您可以在不同位置创建功能分支并丢弃当前位置的功能分支,则可以在执行有问题的集成之前将新功能分支的起点设置为提交/更改列表.
  • 从您的主分支集成到新的功能分支,这次您应该有一个更清晰的历史记录,并且应该拥有您在原始功能分支中所做的所有文件更改(包括历史记录).

与其他版本控制系统(例如 git)不同,遗憾的是无法在 perforce 中重写历史记录以使其忘记集成历史并重新开始.

这是我公司的原因之一,所有架构师和 SCM 都非常挑剔,并重申他们的工作流程建议,即在使用 perforce 执行集成时严格遵循分支机构之间的集成路径.>

I am using the Perforce P4V client (version 2013.1/611291, dated 2013 March 20).

I attempted to Merge/Integrate from the main branch to my feature branch. It had been a long time since I had done this, so a significant number of files were added to the changelist. I then resolved conflicting files that could not be merged automatically. I then submitted the changelist. After doing that, I discovered that some of the files had remained in a messy conflicting state. Exactly why is a mystery to me, but instead of trying to fix them, I thought it would be easier to just undo the Merge/Integrate entirely and start over again.

To undo the Merge/Integrate, I used the 'back out' option. All affected files were added to the 'back out' changelist and I submitted it. My feature branch is now back where it was to start with, except obviously by now all affected files have had their revision number bumped up twice, and the history for affected files shows the integration and then the subsequent 'back out'.

The problem is that if I try the Merge/Integrate option again, this time round the number of files that Perforce wants to put into the integration changelist is now a fraction of those it originally tried to integrate. Put another way, it's not adding lots of files that I know are most definitely further forward in terms of development in the main branch.

The only way I seem to be able to get around this is to use the advanced option Force integration on all revisions, disregarding revision history (-f). With this option set, it will then add for merge all files from the branch.

I suspect the problem is something to do with the fact that the files now have an integration marked in their history, and therefore Perforce is using that point as the base. The fact that the messed-up integration was 'backed out' doesn't make any difference to that.

I tried to do a rollback as well, but the same problem remains.

How can I solve this?

Edit I have later realised that there is the following similar question: How can I undo an Integration in Perforce, and still be able to redo it?

解决方案

  • The files which you're trying to integrate from the main branch to your feature branch have an integration history after your first integration check-in.
  • When you backed out the changes, you got your feature branch's files to the state where it was before the integration, but new versions of the files were created for each of the file in that previous changelist.
  • The next integrate hence tries to bring in ONLY the difference in the integration path since last time.

As you've mentioned already, the only way out of this situation is to run a force integrate using the -i. You can still resolve the changes using p4 resolve -as ... and p4 resolve -am ... just like last time, and then hand resolve the remaining conflicts to perform the merge. Except that the history would show 2 extra versions of the files changed in the prior merge commit and the commit for backing it out.

  • If you're okay with creating a feature branch at a different location and discarding the one at your current location, you could set the starting point for the new feature branch to be the commit/changelist just before you performed the problematic integrate.
  • Integrate from your main branch into the new feature branch and you should have a much cleaner history this time and should have all the file changes (with history) you've made in your original feature branch as well.

Unlike other version control systems (like git for example), it is unfortunately not possible to rewrite history in perforce to make it forget about the integration history and start fresh again.

This is one of the reasons in my company, all the architects and SCMs are very much picky and reiterating their workflow advice, about strictly following integration paths between branches when performing integrations using perforce.

这篇关于在退出之前混乱的集成后,无法从主分支完全集成到功能分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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