如何在 Perforce 中查看分支是否包含错误修复? [英] How do I see if a branch contains a bug fix in Perforce?

查看:55
本文介绍了如何在 Perforce 中查看分支是否包含错误修复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我是 perforce 的新用户,但过去使用过许多其他源代码控制系统.)

我们使用更改列表来检查每个错误修复;更改列表注释包含错误 ID,因此很容易跟踪错误修复何时签入分支.

We use a change list to check-in each bug fix; the change list comment includes the bug ID therefore it is easy to track when a bug fix has been checked into a branch.

但是,我无法找到一种简单的方法来查找给定错误修复已合并到的所有分支,或查找已合并到给定分支中的所有错误修复.

However I can’t see an easy way to find all branches a given bug fix has been merged into, or to find all bug fixes that have been merged into a given branch.

据我所知,perforce 不会跟踪更改列表已合并到的所有分支.据我了解,当在 perforce 中完成合并时,历史记录不会复制到目标分支中,因此目标中唯一的历史记录在合并完成的更改列表的注释中.

As far as I can tell perforce does not track all the branches a change list have been merged into. As I understand it, when a merge is done in perforce the history is not copied into the target branch so the only history in the target in the comment on the change list the merge was done into.

我错过了什么?

推荐答案

Perforce 会跟踪文件修订的集成位置,但它不会自动传播带有错误跟踪元数据的签入注释.

Perforce tracks where revisions of a file have been integrated, but it doesn't automatically propagate check-in comments with your bug-tracking metadata.

给定特定分支上的变更列表,您可以通过要求 Perforce 集成变更列表来判断 Perforce 是否认为该变更列表已被集成.(我在更传统的源代码控制意义上使用分支"来表示源代码树的特定分支,而不是在特定的 Perforce 意义上使用这两个源代码树之间的集成路径.)让我们假设您一直在 //source/project/trunk/... 工作,并且您有一个更改列表 @1234,您想检查它是否已集成到您的发布分支 //source/project/rel/....创建一个映射 //source/project/rel/... 的客户端并执行:

Given a changelist on a particular branch, you can tell whether Perforce thinks the changelist has been integrated by asking Perforce to integrate the changelist. (I'm using "branch" in the more traditional source-control sense, to mean a particular branch of the source code tree, rather than in the specific Perforce sense to mean the path of integration between these two source code trees.) Let's say you've been working in //source/project/trunk/... and you have a changelist @1234 that you'd like to check whether it's been integrated into your release branch //source/project/rel/.... Create a client that maps //source/project/rel/... and execute:

$ p4 integrate -n //source/project/trunk/...@1234,1234 //source/project/rel/...

如果 Perforce 告诉您已集成所有修订版.",则更改列表 @1234 已集成,并且该错误修复应该在发布分支上可用.如果 Perforce 列出已更改的文件,则这些文件尚未集成.(更改列表中的某些文件也有可能被集成而不是其他文件,这可能会产生一些有趣的问题.)

If Perforce tells you "All revision(s) already integrated.", changelist @1234 has been integrated, and that bugfix ought to be available on the release branch. If Perforce lists files that have changed, those files have not been integrated. (It's also possible for some files in a changelist to be integrated and not others, which may make for some interesting problems.)

这不能很好地扩展——您需要检查您关心的每个分支上的每个错误修复,尽管它确实有助于自动化.

This doesn't scale especially well -- you need to check each bugfix on each branch you care about, though it does lend itself to automation.

您可以使用不受支持的"Perforce 命令interchanges 来快速了解哪些变更列表尚未从一个分支集成到另一个分支中.(在 Perforce 的说法中,不受支持"的意思是在下一个修订版中可能不会以相同的方式工作,但我们认为它可能有用,因此我们无论如何都会发布它".)查看哪些更改列表尚未从我们的发布分支的示例主干,执行:

You can use the "unsupported" Perforce command interchanges to get a quick idea of what changelists have not been integrated from one branch into another. (In Perforce parlance, "unsupported" means something like "might not work the same in the next revision, but we think it could be useful so we'll release it anyway".) To see what changelists haven't been integrated from our example trunk to release branches, execute:

$ p4 interchanges //source/project/trunk/... //source/project/rel/...
Change 1236 on 2010/10/10 by user@client 'Fixed some bug you don't care about'
Change 1235 on 2010/10/09 by user@other_client 'Fixed some other random bug'

在这个例子中,我没有列出变更列表@1234,因为它已经被集成到发布分支中.我在使用 interchanges 时遇到的一个问题是,它会在未集成的更改之后列出每个更新的修订,即使新的修订本身已被集成,因此如果您正在为某个版本挑选修订分支,您可能会看到再次列出更改列表.我首先使用 interchanges 来大致了解我需要集成的内容,然后查看 integrate 以更好地了解真正缺少的内容.

In this example, I haven't listed changelist @1234 because it's already been integrated into the release branch. One problem I've experienced using interchanges is it'll list every newer revision after an unintegrated change, even if the newer revisions themselves have been integrated, so if you're cherry-picking revisions for a release branch you may see changelists listed again. I use interchanges as a first pass to get a rough idea of what I need to integrate, then look at integrate to get a better idea of what's really missing.

(Perforce 还支持类似的作业"概念,允许将特定修复附加到特定更改列表,但我的组织不使用它们,所以我不知道它们的工作情况或它们是否自动传播整合.)

(Perforce also supports a similar concept of "jobs", that let one attach particular fixes to particular changelists, but my organization doesn't use them so I don't know how well they work or whether they are propagated automatically on integration.)

这篇关于如何在 Perforce 中查看分支是否包含错误修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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