I bet you just need to provide a filespec, try p4 revert -c <changelist> //...
How can I revert all open files in perforce?
-
18-07-2023 - |
質問
I know how to revert a single opened file. However sometimes I hit some issues where I have to revert all files attached in a single changelist or revert all open pending files (default CL or assigned CL) in a client. Is there any way to do that? I tried p4 revert -c <changelist>
where has multiple pending files. It didn't work for me. It works if I mention ALL the file names.
解決 2
他のヒント
For me the following worked as well
p4 revert //... : Revert every file you have open, in every one of your pending changelists, to its pre-opened state.
or
p4 revert -c default //... : Revert every file open in the default changelist to its pre-opened state
Taken from : p4 revert documentation
On linux
p4 opened | sed 's/#.*//g' | xargs -n 1 p4 revert
Slight updated in the answer of @Talespin_Kit
Below one takes care of files that have spaces in their name
$p4 opened | sed 's/#.*//g' | xargs -n 1 p4 -d '\n' revert
When I try to run the command from the accepted answer
p4 revert -c <<changelist>>
I get the error:
Usage: revert [ -a -n -k -w -c changelist# -C client ] [--remote=rmt] files... Missing/wrong number of arguments.
What I had to do was add the file name at the end of the command like so
p4 revert -c <<changelist>> //depot/folder/folder/file.txt