将移动的文件集成到perforce中

发布于 2024-08-15 08:17:08 字数 536 浏览 4 评论 0原文

假设我根据我们的代码库创建了一个分支。这是分支规范:

//depot/code/main/... //depot/code/branch/...

然后,在分支中,假设我移动分支文件 a.txt -> b.txt 使用

p4 integrate //depot/code/branch/a.txt //depot/code/branch/b.txt
p4 delete //depot/code/branch/a.txt

现在,假设对 main 中的 a.txt 进行了一些更改,我希望将其集成到分支中的 b.txt

当我尝试使用原始分支规范进行集成时,它没有反映更改对 main 中的 a.txt 进行到 b.txt - 有什么方法可以使 main 中所做的更改显示在重命名的文件中?

分支规范相当大(数百个更改),并且分支中的相当多的文件被重命名,所以我希望有一种自动化的方法来执行此操作。如果我能在这里澄清任何事情,请告诉我——拥有白板会有所帮助;)

谢谢! 山姆

Say I created a branch in perforce of our codebase. Here is the branch spec:

//depot/code/main/... //depot/code/branch/...

Then, in the branch, say I move the branched file a.txt -> b.txt using

p4 integrate //depot/code/branch/a.txt //depot/code/branch/b.txt
p4 delete //depot/code/branch/a.txt

Now, let's say some changes are made to a.txt in main which I would like to have integrated into b.txt in the branch

When I try to integrate using the original branch spec, it doesn't reflect the changes made to a.txt in main onto b.txt - is there any way to have the changes made in main show up in the renamed file?

The branch spec is rather large (hundreds of changes) and quite a few files were renamed in the branch, so I'd like to have an automated way to do this. Let me know if I can clarify anything here -- it would help to have a whiteboard ;)

Thanks!
Sam

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

瞎闹 2024-08-22 08:17:08

您可以添加“-3”开关以使用新的集成引擎,该引擎将检测之前使用“p4 move”移动的目标文件,并自动“重新定位”自身以遵循
那些移动操作。

p4 integrate -3 //depot/code/main/... //depot/code/branch/...

会将 //depot/code/main/a.txt 中的更改集成到 //depot/code/branch/b.txt。

这是当前 2010.2 版本中的“undoc”功能,但将成为即将发布的 2011.1 中的默认行为。

You can add '-3' switch to use a new engine for integration, which will detect target files that have been previously moved with 'p4 move', and automatically 'retarget' itself to follow
those move operations.

p4 integrate -3 //depot/code/main/... //depot/code/branch/...

will integrate your changes in //depot/code/main/a.txt to //depot/code/branch/b.txt.

This is the 'undoc' feature in current 2010.2 release, but will be the default behavior in the upcoming 2011.1.

标点 2024-08-22 08:17:08

Perforce 2009.1 有适当的重命名,这可能会对此有所帮助 - 可能,并且无论如何仅适用于将来的重命名。请参阅 Perforce 2009.1 发行说明,特别是:

#177023 * **
    The new 'p4 move' command allows for better support for
    renaming files.  A file must be already opened for 'edit'
    or 'add' in order to be moved.  Moved files can be synced,
    resolved and diffed against the repository just like files
    opened for 'edit'.  See 'p4 help move' for more info.

您可以添加重命名为分支规范。那么至少集成将是自动的——即使分支规范会更长、更复杂。

Perforce 2009.1 has proper renames, which might help with this - probably, and in any case only for future renames. See Perforce 2009.1 release notes, in particular:

#177023 * **
    The new 'p4 move' command allows for better support for
    renaming files.  A file must be already opened for 'edit'
    or 'add' in order to be moved.  Moved files can be synced,
    resolved and diffed against the repository just like files
    opened for 'edit'.  See 'p4 help move' for more info.

You can add the rename into the branch spec. Then at least the integrations will be automatic - even if the branch spec will be even longer and more complicated.

等待圉鍢 2024-08-22 08:17:08

据我所知,让 Perforce 为您处理此问题的唯一方法是使用分支规范将原始文件中的旧文件映射到分支中的新文件。也许最近 Perforce 版本中的新移动命令已经改变了这种情况,但我没有经历过。

The only way I know of to have Perforce handle this for you is to use the branch spec to map the old file in the original to the new file in the branch. Perhaps that has changed with the new move command in the recent Perforce versions, but not that I've experienced.

终止放荡 2024-08-22 08:17:08

您可以使用 p4 fstat 的输出来编写分支规范的创建脚本,以处理移动的文件。

使用以下内容作为起点:

ROOT_PATH="//depot/books/..."
FIRST_CHANGE=91212

p4 fstat -Os -T headChange -F "headAction=move/* headChange>$FIRST_CHANGE" $ROOT_PATH|grep headChange | sort -u|while read DUMMY1 DUMMY2 change; do p4 describe $change; done|grep "moved from"|sed 's/\.\.\./\t/g; s/\#[0-9]*//g; s/ moved from//g;'

这将找到 //depot/books/... 中在更改 91212 或更高版本中移动的所有文件

对于我们来说,其输出类似于

//depot/books/bar.txt / /depot/books/foo.txt

用它来制作分支规范。

You could script the creation of a branch spec for handling moved files using the output of p4 fstat.

Use the following as a starting point:

ROOT_PATH="//depot/books/..."
FIRST_CHANGE=91212

p4 fstat -Os -T headChange -F "headAction=move/* headChange>$FIRST_CHANGE" $ROOT_PATH|grep headChange | sort -u|while read DUMMY1 DUMMY2 change; do p4 describe $change; done|grep "moved from"|sed 's/\.\.\./\t/g; s/\#[0-9]*//g; s/ moved from//g;'

This will find all files in //depot/books/... that were moved in change 91212 or later

For us, the output of this looks like

//depot/books/bar.txt //depot/books/foo.txt

Use it for crafting a branch spec.

滥情哥ㄟ 2024-08-22 08:17:08

我不相信是这样。由于没有直接的 p4 重命名,您必须集成并删除 - 一旦完成,从另一个分支的集成将不再转到正确的文件。至少这是我的经验。

I don't believe so. Since there is no direct p4 rename, you have to integrate and delete - once you've done that, integrates from another branch no longer go to the right file. At least that's been my experience.

甜`诱少女 2024-08-22 08:17:08

首先,我使用 p4 move 命令将文件移动到目标分支中。然后,我整合了它。

p4 move //depot/code/**main**/a.txt //depot/code/**main**/b.txt

p4 integrate  //depot/code/**branch**/b.txt //depot/code/**main**/b.txt

First, I moved the file in target branch using p4 move command. And then, I integrated it.

p4 move //depot/code/**main**/a.txt //depot/code/**main**/b.txt

p4 integrate  //depot/code/**branch**/b.txt //depot/code/**main**/b.txt
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文