perforce: is there a way to force revert all opened files from ALL sites?

Viewed 283

Sorry i just updated my question.

Actually I'm working with 2 sites.

I have admin rights to the perforce server. We are trying to design something that can integrate into a branch forcefully. so we would like to make sure the destination branch does not have any opened files, by anyone, from any workspace, from any sites.

Is there a way for me to achieve that?

something like this?

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

Thanks in advance.

1 Answers

As an admin it's possibly to forcefully revert files from the server side (i.e. make the server treat them as no longer open) with the -C flag (you may also need --remote in a DVCS configuration):

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

This does not actually modify the files in the affected workspaces; those workspaces will therefore be in an inconsistent state, and may be at risk of losing changes if the user is not careful (i.e. their work in progress may be overwritten by a sync operation and/or missed by a submit).

I would recommend only doing the force revert if the files are locked; files that are opened but unlocked will not interfere with the integration, and reverting them will only make it more difficult for those users to reconcile their workspaces after the fact.

Related