【问题标题】:perforce: is there a way to force revert all opened files from ALL sites?perforce:有没有办法强制从所有站点恢复所有打开的文件?
【发布时间】:2021-11-06 15:34:02
【问题描述】:

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

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

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

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

这样的?

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

提前致谢。

【问题讨论】:

  • 通过确保没有人打开文件,您试图避免什么情况?
  • 还原每个人的文件真的能解决您的问题吗?那不是很骚吗?锁定文件不是更合适吗?
  • @Samwise 当我尝试集成到一个分支,并且该分支恰好有一个已打开的独占(文本+l)文件时,p4 integrate 命令失败。我的最终目标是确保集成命令有效。
  • 这是有道理的——但请确保将其限制为仅 +l 被集成随后触及的文件。 (另外,如果+l 文件的语义比它们所阻止的更令人头疼,请考虑限制它们的使用。)您也不应该使用integrate -f,因为这将迫使所有文件都被触摸;如果您的意图是使目标分支相同(它将跳过已经相同的文件),请使用 p4 copy。

标签: perforce revert


【解决方案1】:

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

%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.

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

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

【讨论】:

  • 谢谢@Samwise
猜你喜欢
  • 2014-06-26
  • 1970-01-01
  • 2010-09-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多