Perforce 2002.2 Command Reference
<< Previous Chapter
p4 resolved
Table of Contents
Index
Perforce on the Web
Next Chapter >>
p4 review

p4 revert


Synopsis

Discard changes made to open files.

Syntax

p4 [g-opts] revert [ -n ] [ -a -c changelist# ] file...

Description

Use p4 revert to discard changes made to open files, reverting them to the revisions last p4 synced from the depot. This command also removes the reverted files from the pending changelists with which they're associated.

When files you've opened with p4 delete are reverted, the files are reinstated in the client workspace. When you revert files that have been opened by p4 add, Perforce leaves the client workspace files intact. When you revert files you've opened with p4 integrate, Perforce removes the files from the client workspace.

Options

-a

Revert only those files that haven't changed since they were opened.

Specifically, the only files reverted are those whose client revisions are:

  • open for edit but have unchanged content; or
  • open for integrate via p4 integrate and have not yet been resolved with p4 resolve.

-n

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.

-c changelist#

Reverts only those files in the specified changelist.

g-opts

See the Global Options section.

Usage Notes

Can File Arguments Use
Revision Specifier?

Can File Arguments Use
Revision Range?

Minimal Access Level Required

No

No

open

You don't need to specify a file argument when using the -a flag.

Examples

p4 revert //depot/...

Revert all open files to their pre-opened state.

p4 revert -c default //...

Revert all open files in the default changelist to their pre-opened state.

p4 revert -n *.txt

Preview a reversion of all open files with the suffix .txt in the current directory, but don't actually perform the revert.

p4 revert -c 31 *.txt

Revert all files in changelist 31 with the suffix .txt in the current directory to their pre-opened state.

Related Commands

To open a file for add

p4 add

To open a file for deletion

p4 delete

To copy all open files to the depot

p4 submit

To read files from the depot into the client workspace

p4 sync

To list all opened files

p4 opened

To forcibly bring the client workspace in sync with the files that Perforce thinks you have, overwriting any unopened, writable files in the process.

p4 sync -f


Perforce 2002.2 Command Reference
<< Previous Chapter
p4 resolved
Table of Contents
Index
Perforce on the Web
Next Chapter >>
p4 review
Please send comments and questions about this manual to [email protected].
Copyright 1999-2003 Perforce Software. All rights reserved.
Last updated: 02/25/03