首页 > 解决方案 > perforce:有没有办法强制从所有站点恢复所有打开的文件?

问题描述

抱歉,我刚刚更新了我的问题。

实际上我正在使用 2 个站点。

我拥有 perforce 服务器的管理员权限。我们正在尝试设计一些可以强制集成到分支中的东西。所以我们想确保目标分支没有任何人、任何人、任何工作区、任何站点打开的文件。

有没有办法让我做到这一点?

像这样的东西?

p4 revert <some option> //depot/destination/branch/...

提前致谢。

标签: perforcerevert

解决方案


-C作为管理员,可以使用标志从服务器端强制恢复文件(即让服务器将它们视为不再打开) (您可能还需要--remote在 DVCS 配置中):

%p4 help revert

    revert -- Discard changes from an opened file

        ...

        The -C flag allows a user to specify the workspace that has the file
        opened rather than defaulting to the current client workspace. When
        this option is used, the '-k' flag is also enabled and the check for
        matching user is disabled. The -C flag requires 'admin' access, which
        is granted by 'p4 protect'.

        The --remote flag is useful for DVCS configurations in which files
        of type +l are in use. 'p4 revert --remote=origin filename' reverts
        the named file in your DVCS server, and additionally, if the file is
        of type +l, releases the global exclusive lock on the file in the
        origin server.

这实际上并没有修改受影响工作区中的文件;因此,这些工作区将处于不一致的状态,并且如果用户不小心,可能会面临丢失更改的风险(即,他们正在进行的工作可能被同步操作覆盖和/或被提交遗漏)。

我建议在文件被锁定时才进行强制还原;打开但解锁的文件不会干扰集成,而恢复它们只会使这些用户在事后协调他们的工作区变得更加困难。


推荐阅读