Reverting unshelved files in perforce

Twisted picture Twisted · Apr 23, 2013 · Viewed 8k times · Source

I have unshelved a cl that contained an 'add' file called foo.txt. When i revert that changelist the foo.txt disappears from my workspace but stays on my hdd.

p4 unshelve -f -s $A -c default :: unshelving add foo.txt
p4 revert -c default //MY_WORKSPACE/... :: foo.txt is reverted
p4 opened -C MY_WORKSPACE :: shows none

When i open the workspace i still can see the foo.txt.

is there a way to delete the added file ? (Except the obvious of deleting it manually)

Answer

Oleksandr Kucher picture Oleksandr Kucher · Apr 29, 2013

Such behaviour is by design.

http://www.perforce.com/perforce/doc.current/manuals/p4guide/04_files.html

Discarding changes (reverting)

To remove an open file from a changelist and discard any changes you made, issue the p4 revert command. When you revert a file, Perforce restores the last version you synced to your workspace. If you revert a file that is open for add, the file is removed from the changelist but is not deleted from your workspace.