Deleting new files after a p4 revert

2019-04-06 09:51发布

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?

标签: perforce
2条回答
你好瞎i
2楼-- · 2019-04-06 10:04

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...

查看更多
萌系小妹纸
3楼-- · 2019-04-06 10:24

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>
查看更多
登录 后发表回答