【问题标题】:How to get the branch/merge source & target from changelist in perforce?如何从 perforce 的更改列表中获取分支/合并源和目标?
【发布时间】:2015-08-24 07:42:35
【问题描述】:

使用 perforce 的 API,我将查看所有更改列表的历史记录,我需要输出一个日志,其中包含在 perforce 中执行的所有操作。

对于分支和合并,我想记录操作的源和目标,但我似乎找不到它。不在 changelist 类中,也不在 FileMetaData 类中。

Perforce 将受更改影响的每个文件的数据保留在历史记录中,但我想获取已执行的一般操作。例如从 //Main/Sample 分支到 //Main/Sample-Branch 或从 //Main/X 合并到 //Main/Releases/A。

我在哪里可以找到这些数据?

【问题讨论】:

  • 您使用的是哪个 API?
  • 什么意思?这就是我的代码的外观: foreach (Changelist changelist in repository.GetChangelist(nextIndex)) { foreach (FileMetaData fileMD in changelist.Files) { LogActions(fileMD, changelist, folderPathes); } }
  • 您使用哪种编程语言?我知道如何从核心服务器 API 中获取您要查找的信息(这是一条集成记录,您可以从“p4 文件日志”或“p4 集成”中获得),我只需要知道哪些派生 API你用来查找它的文档并弄清楚它是如何用你选择的语言包装的。 :)
  • 我使用 c# 作为我的语言。提前非常感谢:)如果您需要任何东西,我将在接下来的几个小时内高度可用:)

标签: perforce perforce-integrate perforce-branch-spec


【解决方案1】:

您要查找的是Repository.GetSubmittedIntegrations 返回的更改列表中文件修订的FileIntegrationRecord(s),或者可能是Repository.GetFileHistory 返回的RevisionIntegrationSummary

【讨论】:

  • 点击链接进入文档...?
【解决方案2】:

我不确定您使用的是哪个 API,但您会希望使用与“p4 filelog”命令等效的 API。

示例输出:

//depot/release/prototype1/docs/Test Plan Template_Baseline.doc
... #1 change 471 branch on 2011/11/15 by jenbottom@resource_portle_dev (binary) 'Integrating to the prototype1 b'
... ... branch from //depot/dev/docs/Test Plan Template_Baseline.doc#1
//depot/release/prototype1/docs/associations
... #1 change 471 branch on 2011/11/15 by jenbottom@resource_portle_dev (text) 'Integrating to the prototype1 b'
... ... branch from //depot/dev/docs/associations#1

查看更改列表 471,我们可以看到文件上的操作是什么,但看不到它们从哪里分支或到哪里:

Change 471 by jenbottom@resource_portle_dev on 2011/11/15 22:04:33

        Integrating to the prototype1 branch in rel dir.

Affected files ...

... //depot/release/prototype1/docs/Test Plan Template_Baseline.doc#1 branch
... //depot/release/prototype1/docs/associations#1 branch
... //depot/release/prototype1/docs/changelog#1 branch

希望这会有所帮助, 仁。

【讨论】:

  • 感谢您的尝试,但正如我在此处的原始问题中所写的那样,我能够获取文件列表和每个文件的操作。你写的你不知道的正是我不知道的,你写的你知道的,我现在也是:)
猜你喜欢
  • 2020-05-01
  • 2020-06-15
  • 1970-01-01
  • 2016-12-19
  • 2020-08-19
  • 2013-12-21
  • 1970-01-01
  • 1970-01-01
  • 2015-03-15
相关资源
最近更新 更多