取消搁置文件时,如何指示 Perforce 进行合并而不是覆盖或恢复?

发布于 2024-09-29 14:55:25 字数 181 浏览 5 评论 0原文

当取消搁置搁置在软件仓库中的文件时,如何指示 Perforce 将更改合并到工作区中现有的、打开的和已修改的文件中? Perforce 似乎为用户提供的唯一选项是覆盖或恢复工作区中的现有文件,但这不允许取消搁置并集成多个更改列表中对同一文件的更改。有办法绕过这个限制吗?

How can I instruct Perforce to merge changes into an existing, open, and modified file in the workspace when unshelving a file shelved in the depot? The only options that Perforce appears to offer the user is to overwrite or revert the existing file in the workspace, but this does not allow, for example, to unshelve and integrate changes to the same file from multiple change lists. Is there a way around this limitation?

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

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

发布评论

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

评论(2

霊感 2024-10-06 14:55:25

我通常做的是右键单击搁置的文件并选择“与工作空间文件进行比较”。当您打开 Diff 工具时,您可以选择工具栏中的按钮“在右侧窗格中编辑文件”。这本质上开始了双向合并。对于每个差异,您可以从搁置的文件中选择所需的更改(默认情况下从工作区文件中选择差异)。

然而,如果 Perforce 添加一种合并功能来更自动地执行此操作,那就太好了。

编辑添加:
Perforce 现在具有在取消搁置时合并文件的内置功能。如果用户取消搁置一个也已签出的文件,并且未选中“在取消搁置之前恢复签出的文件”,Perforce 将标记该文件以进行解析。我查看了发行说明,但无法找到在哪个版本中添加了此功能,但基于此 链接(请参阅 p4 unshelve 说明底部附近),它是在 2012.1 之前添加的。

再次编辑添加:
该功能是在服务器版本 2011.1 中添加的。这是发行说明:

#299614 (Bug #38221, #39099) **
    Unshelving a file opened for edit over a file already opened
    for edit in the workspace is now allowed. A resolve record is
    created when unshelving, and the user must then run 'p4 resolve'
    to resolve the workspace files with the shelved files.

What I typically do is right-click on the shelved file and select "Diff Against Workspace File". When you open up the Diff tool, you can select a button in the toolbar to "Edit file in right pane". This essentially starts a two-way merge. With each difference you can select the changes you want from the shelved file (differences are selected from the workspace file by default).

However, it would be nice if Perforce added a type of merge feature to do this more automatically.

Edit to add:
Perforce now has a built-in capability to merge files when unshelving. If the user unshelves a file that is also checked out, and "Revert checked out files before unshelving" is unchecked, Perforce will mark that file for resolve. I looked through the release notes and was not able to find in which version this capability was added, but based on this link (see near bottom of p4 unshelve description), it was added no later than 2012.1.

Edited again to add:
That feature was added in release 2011.1 of the server. Here's the release note:

#299614 (Bug #38221, #39099) **
    Unshelving a file opened for edit over a file already opened
    for edit in the workspace is now allowed. A resolve record is
    created when unshelving, and the user must then run 'p4 resolve'
    to resolve the workspace files with the shelved files.
月依秋水 2024-10-06 14:55:25

如果您签出文件,然后尝试提交它,您可以选择获取最新版本而不替换副本。然后,您将能够运行合并工具,您必须在提交之前解决所有冲突。

If you checkout your file, and then try to submit it, it will give you the option of getting the latest revision without replacing your copy. Then it will subsequently will give you the ability to run a merge tool, where you must resolve any conflicts before submitting.

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