Open topic with navigation
Update a client workspace’s have list without actually copying any files.
p4 [g-opts] flush [-f -L -n -q] [file[revRange] ...]
p4 flush incorrectly can be
If you use
p4 flush incorrectly, the versioning
service’s metadata will not reflect the actual state of your client
workspace, and subsequent
commands will not operate on the files you expect! Do not use
p4 flush until you fully understand its
It is rarely necessary to use
p4 flush command performs half the work of a
p4 sync. Running
filespec has two effects:
filespecare copied from the depot to the client workspace;
p4 flush performs only the second of these
steps. Under most circumstances, this is not desirable, because a client
workspace’s have list should always reflect the workspace’s true
contents. However, if the workspace’s contents are already out of sync
with the have list,
p4 flush can sometimes be used to
bring the have list in sync with the actual contents. Because
flush performs no actual file transfers, this command is
much faster then the corresponding
p4 flush only when you need to update the have
list to match the actual state of the client workspace. The
subsection describes two such situations.
Force the flush. Perforce performs the flush even if the client workspace already has the file at the specified revision.
For scripting purposes, perform the flush on a list of valid file arguments in full depot syntax with a valid revision number.
Display the results of the flush without actually performing the flush. This lets you make sure that the flush does what you think it will do before you do it.
Quiet operation: suppress normal output messages. Messages regarding errors or exceptional conditions are not suppressed.
See Global Options.
|Can File Arguments Use Revision Specifier?||Can File Arguments Use Revision Range?||Minimal Access Level Required|
p4 flush updates the have list without
copying files, and
-f updates the client workspace to match the have list,
p4 flush files followed by
files is almost equivalent to
files. This means that a bad flush can be
almost entirely fixed by following it with a
p4 sync -f of the same
file revisions that were originally flushed.
Unfortunately, this is not a complete remedy, because any file
revisions that were deleted from the have list by
flush will remain in the client workspace even after
p4 sync -f. In
this case, you will need to manually remove deleted file revisions
from the client workspace.
p4 flushis an alias for
p4 sync -k.
Ten users at the same site need to set up new, identical client
workspaces from the same depot at a remote location over a slow link.
The standard method calls for each user to run identical
p4 sync commands, but if
bandwidth is limited, there’s a faster way:
filesfrom his client workspace
The other users run
p4 flush files
@firstworkspace, which brings their client
workspaces' have lists into sync with the files copied into the
client workspaces in the last step.
p4 flush moves no files across the
slow link, the process can be much faster then running the same
p4 sync command
ten separate times.
Joe has a client workspace called
joe that has a
He decides that all the files under
need to be included in the workspace, and accomplishes this by using
p4 client to change
This keeps his current client workspace files in the same place,
while extending the scope of the workspace to include other files.
But when Joe runs his next
sync, he’s surprised to see that
deletes every non-open file in the client workspace and replaces it
with an identical copy of the same file!
behaves this way because the have list describes each file’s location
relative to the client root, and the physical location of each file
is only computed when each
command is run. Thus,
thinks that each file has been relocated, and the
p4 sync deletes the file
from its old location and copies it into its new location.
To make better use of
Joe might have performed a
p4 flush #have
instead. This would have updated his client workspace’s have list to
reflect the files' "new" locations without actually copying any
To copy files from the depot to the client workspace
To bring the client workspace in sync with the have list after a