Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting new files after a p4 revert

Tags:

perforce

My workflow for testing my changes to our source code on a remote machine is the following:

1) On local machine: Shelve changes that I'd like to test

2) On remote machine (ssh):

$ p4 revert //... 
$ p4 sync
$ p4 unshelve -s <changelist number>
$ ./run_test_scripts

This seems to work fine when I've only made changes to files that already exists. If I've added new files these will be created during p4 unshelve, but not deleted during p4 revert. The documentation says that this is what p4 revert does so it isn't unexpected, but causes some problems if I want to test the same files again:

$ p4 revert //... 
<some file>#none - was add, abandoned
$ p4 sync
File(s) up-to-date.
$ p4 unshelve -s <changelist number>
Can't clobber writable file <some file>

Is there way I can delete the files abandoned Perforce?

like image 634
Paul Avatar asked Nov 13 '13 08:11

Paul


People also ask

How do you delete files after p4 add?

To delete a set of files without transferring them to your workstation when another version of these files already exists in your workspace, use p4 sync -k file , followed by p4 delete -k file . This allows you to delete a file that is in the depot without affecting the file (by the same name) in your workspace.

What does p4 revert do?

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 you undo p4 delete?

Instead, users must revert the files to remove the mark for deletion. To do this, simply right-click on the folder or files in P4V and select Revert. The files will be returned to normal and work can continue.

What is mark for delete in perforce?

P4VS marks the file for delete and it is placed in a changelist.


2 Answers

I think what you're looking for is p4 revert -w. From the help:

The -w flag causes files that are open for add to be deleted from the workspace when they are reverted.

Note: I'm using the 2013.2/719516 client against a 2013.2/708877 server, in case that switch was added recently...

like image 71
Mark Avatar answered Oct 06 '22 20:10

Mark


Edit: just reread your question - this is a workaround, perhaps not a full solution...


There is a setting in P4Win that allows you to overwrite files when unshelving:

  • Overwrite workspace files even if they are writeable

I normally use that in combination with another option (again in the gui):

  • Revert checked our files before unshelving

They solve my problem.

Looking in the console output while running this from the gui, it looks like it is the -f parameter in the unshelve command.

  • p4 unshelve -s <changelist> -f -c <changelist> <files>
like image 22
Richard Le Mesurier Avatar answered Oct 06 '22 21:10

Richard Le Mesurier