p4 revert
Discard changes made to open files or revert an open stream spec.
Syntax
p4 [g-opts] revert [-a -n -k -K -w] [-c change] [-C client] [--remote=remote] file ...
p4 [g-opts] revert [-a -n -k -K -w] [-Si] [-c change] [-C client] [--remote=remote] file ...
p4 [g-opts] revert -So [-c change]
Description
Use p4 revert
to discard changes made to open files,
reverting them to the revisions last synced from the depot (with p4 sync
). This command also
removes the reverted files from the pending changelists with which
they’re associated. An administrator can use the -C
option
to revert another user’s open files.
- When you revert files you opened with
p4 delete
, the files are reinstated in the client workspace. - When you revert files that have been opened by
p4 add
, Helix Core Server leaves the client workspace files intact. - When you revert files you’ve opened with
p4 integrate
, Helix Core Server removes the files from the client workspace. - When you revert files you’ve opened with
p4 move
, only the file open formove/add
can be reverted.
The host name is implied and the username is not needed.
streams and p4 revert
The -Si and -So options revert an open stream spec. By default, an open stream spec is not reverted.
Options for files
|
Revert only those files that haven’t changed (in terms of content or filetype) since they were opened. The only files reverted are those whose client revisions are the following:
|
|
Reverts only those files in the specified changelist. Revert all files in a specific change in a client workspace p4 revert -c 345627 "//..."
|
|
Revert another user’s open files. This option:
Revert a single file in a client workspace: p4 revert -C bruno_ws //depot/www/dev/Jam.html
Revert all files in a client workspace: p4 revert -C bruno_ws //...
This option is useful in freeing up exclusive locks held on an edge server. In such a case, the command needs to be directed to the edge server where the client resides. For example: p4 revert -C SusanClient //depot/src/x.cc
The option is also useful in cleaning up after old users' workspaces. You need to revert any open files in a workspace before you delete it. |
|
Keep workspace files; the file(s) are removed from any changelists and Helix Core Server records that the files as being no longer open, but the file(s) are unchanged in the client workspace. |
-K
|
Suppress keyword expansion when updating +k type files on the client. See File type modifiers. |
|
List the files that would be reverted without actually performing the revert. This lets you make sure the revert does what you think it does before actually reverting the files. |
|
Reverts the file in your personal server, and additionally — if
the file is of type For more information, see the section Support for exclusive locking in the Fetching and Pushing chapter of Using Helix Core Server for Distributed Versioning. For more information, see the section "Support for exclusive locking in personal servers" in the "Fetching and Pushing" chapter of Using Helix Core Server for Distributed Versioning. |
|
Files that are open for |
-Si
|
See Options for streams. |
-So
|
|
|
See Global options. |
Options for streams
|
Include the open stream spec when reverting the specified list of files |
|
Only the open stream spec is reverted. No list of files allowed. The behavior is like |
Usage notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
No |
No |
admin for the -C option |
-
p4 revert differs from most Helix Core Server commands in that it usually requires a file argument. The files that are reverted are those that lie in the intersection of the command line file arguments and the client view.
You don’t need to specify a file argument when using the
-a
option. - Reverting a file that has been opened for
edit
overwrites any changes you have made to the file since the file was opened. Consider usingp4 revert -n
to preview the results before runningp4 revert
.
Examples for reverting streams
p4 revert -Si ... | Revert everything in the default changelist, including the current open stream spec. |
p4 revert -So | Revert only the current open stream spec in the default changelist |
p4 revert -Si -c 987654321 ... | Revert everything in the numbered changelist. |
p4 revert -So -c 987654321 | Revert only the open stream spec in the numbered changelist. |
p4 revert -Si foo | Revert the current open stream spec and the file in the default changelist |
p4 revert -Si -c 987654321 foo | Revert the current open stream spec and the file in the numbered changelist. |
p4 revert foo |
Revert only the file, not the stream, from a default change list. |
p4 revert -c 987654321 foo |
Revert only file, not the stream, from a numbered change list. |
Related commands
To open a file for add |
|
To open a file for deletion |
|
To copy all open files to the depot |
|
To read files from the depot into the client workspace |
|
To list all opened files |
|
To forcibly bring the client workspace in sync with the files that Helix Core Server thinks you have, overwriting any unopened, writable files in the process. |
|