With Perforce, I have the following situation:
- Created a new file
foo.txt
in clientclient_a
, opened it for add - Shelved
foo.txt
inclient_a
, unshelved it inclient_b
- Now
foo.txt
is open for add inclient_b
- Submit
foo.txt
inclient_a
Now my question concerns how I can cleanup foo.txt
in client_b. Maybe it has a one line change from the depot version that I'd like to keep. Ideally I'd like to do a resolve operation against the newly checked in file, but I'm not allowed to do this because it's open for add.
Now I have this file foo.txt#1 - add change default
in my client.
I can't reopen the file ('nothing changed'), I can't diff it vs the depot ('file not open for edit'), I can't resolve it against the depot ('no files to resolve'), I can't open it for edit ('can't edit, already opened for add').
Is there any way to make perforce reopen this as edit instead of add? I know I can copy it to a temp file, revert, reopen for add, and then recopy the temp file back over, but this seems rather unelegant. Is there any command that can do what I want, or is there a good reason I'm not seeing why it's disallowed?
Best Answer
Only slightly more elegant than the comment in your last paragraph, but you should be able to:
foo.txt
inclient_b
. Since it was marked for add the file will remain on the disk with no changesfoo.txt
with-k
. This makes the server think you have the latest revision without modifying your local file.foo.txt
for edit. Diff'ing against the have revision should show the changes.