Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverting unshelved files in perforce

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)

like image 506
Twisted Avatar asked Apr 23 '13 16:04

Twisted


People also ask

What does revert files do in perforce?

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.

How do I undo a p4 revert?

The p4 undo command opens files to undo a set of previously submitted changes. The undone changes remain a part of the file history, but the new revisions submitted after p4 undo reverse their effect. If a single revision is specified, the specified revision is undone.

How do you Unshelve a changelist?

Shelve changesIn the Commit tool window Alt+0 , right-click the files or the changelist you want to put to a shelf and select Shelve changes from the context menu. In the Shelve Changes dialog, review the list of modified files.


2 Answers

Running the revert command with -w flag will delete any files marked for add during the revert (see p4_revert docs)

p4 revert -w [file specification]

e.g., p4 revert -w -c default //MY_WORKSPACE/... (foo.txt is deleted from disk, then reverted)

like image 64
undeniablyrob Avatar answered Oct 10 '22 11:10

undeniablyrob


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.

like image 44
Oleksandr Kucher Avatar answered Oct 10 '22 09:10

Oleksandr Kucher