在 Perforce 中搁置时自动删除新添加的文件

发布于 2025-01-01 07:34:19 字数 95 浏览 0 评论 0原文

当我搁置待处理的更改列表时,对现有文件的更改将被恢复,但新添加的文件不会从文件系统中删除。每次执行搁置操作时,我都需要手动删除这些文件。有没有办法在搁置时自动删除新添加的文件?

When I shelve a pending changelist, changes to existing files are reverted, but newly added files are not deleted from the filesystem. I need to manually delete these files every time I perform a shelve operation. Is there anyway to automatically delete newly added files when shelving?

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

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

发布评论

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

评论(6

彼岸花似海 2025-01-08 07:34:19

在 p4 中,如果您愿意将其分为两个操作,则可以对更改列表执行正常的搁置,然后对同一更改列表执行 p4 revert -w ,这会删除添加的文件。我不知道如何在 p4v 中做到这一点。

in p4, if you're willing to make it two operations, you can do a normal shelve on the changelist, and then do p4 revert -w on the same changelist, which deletes added files. i'm not sure how to do this in p4v.

合约呢 2025-01-08 07:34:19

看起来 P4V 在最近的版本中添加了这个!

https://www.perforce.com/perforce/doc.current/用户/p4vnotes.txt

#40757(更改#1619278、#1618572)
搁置对话框有一个选项可以从磁盘中删除标记为
“添加”。

It looks like P4V added this in a recent release!

https://www.perforce.com/perforce/doc.current/user/p4vnotes.txt

#40757 (Changes #1619278, #1618572)
The Shelve Dialog has an option to remove the files from disk that are marked for
'Add'.

挽清梦 2025-01-08 07:34:19

要在 p4v 中执行此操作,您可以创建一个自定义工具,例如“revert-added-file-and-delete”,将其添加到适用的上下文菜单中,并使用应用程序 p4 和参数 revert -w %F。

除非有人知道将自定义工具链接在一起的方法(并且我找不到方法来做到这一点),否则要进行搁置/恢复将需要单独的搁置,然后使用自定义命令 revert-added-file -并删除。

To do this in p4v, you can create a custom tool, say "revert-added-file-and-delete", adding it to applicable context menus, with application p4 and arguments revert -w %F.

Unless someone knows of a way to chain custom tools together (and I couldn't find a way to do it), to do a shelve/revert will require a separate shelve followed by a use of the custom command, revert-added-file-and-delete.

情栀口红 2025-01-08 07:34:19

当然可以,只不过搁架工作是一种完全不同的野兽。如果我创建一个使用现有类中的新函数的新类,然后搁置这两个文件,则新类将保留,并且现在引用现有类中不存在的函数。现在我遇到了构建错误,必须手动删除新文件才能恢复正常,这正是搁置工作应该为我做的事情。

Sure, except that shelving work is a fundamentally different beast. If I create a new class that uses a new function in an existing class, and then shelve both files, the new class remains, and is now referencing a non-existent function in the existing class. Now I've got build errors and have to manually delete the new file in order to get back to a clean slate, which is exactly what shelving work should do for me.

庆幸我还是我 2025-01-08 07:34:19
  1. p4 搁置 -c 变更列表编号
  2. p4 恢复 -w -c 变更列表编号 //...
  1. p4 shelve -c changelist_number
  2. p4 revert -w -c changelist_number //...
渔村楼浪 2025-01-08 07:34:19

我认为没有办法做到这一点。此行为与恢复已添加的文件一致。如果您“p4 添加”文件然后将其恢复,则恢复时不会删除该文件。如果这样做的话,似乎这是一种不好的行为!丢失文件以及恢复时已进入文件的工作将是非常糟糕的。考虑一下:您在编辑器中编写了一个文件,认真保存,最后准备好“p4 add”它以强制执行。然后你决定不想这样做,所以你恢复,然后你丢失了你的文件???

因此恢复添加不会删除该文件。

I don't think that there is a way to do this. This behavior is consistent with reverting files that have been added. If you 'p4 add' a file and then revert it, it will not be deleted on revert. Seems like it would be bad behavior if it did! Losing a file and the work that has gone into the file on a revert would be very bad. Consider this: you code up a file in your editor, you save diligently, and finally you are ready to 'p4 add' it to perforce. Then you decide you don't want to do this so you revert and then you lose your file???

So reverting adds won't delete the file.

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