Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can I do with a file open for 'add', if it's submitted via another client

Tags:

perforce

With Perforce, I have the following situation:

  • Created a new file foo.txt in client client_a, opened it for add
  • Shelved foo.txt in client_a, unshelved it in client_b
  • Now foo.txt is open for add in client_b
  • Submit foo.txt in client_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?

like image 764
Tim Avatar asked Mar 05 '13 05:03

Tim


People also ask

What does p4 submit do?

When used with the default changelist, p4 submit brings up a form for editing in the editor defined by the EDITOR (or P4EDITOR ) environment variable. Files can be deleted from the changelist by deleting them from the form, but these files will remain open in the next default changelist.

How to add new file in p4?

To add files to the depot, create the files in your workspace, then issue the p4 add command. The p4 add command opens the files for add in the default pending changelist. The files are added when you successfully submit the default pending changelist.

What is p4 add?

Description. p4 add opens files within the client workspace for addition to the depot. The specified files are linked to a changelist. The command can add files to a new, empty depot or to a depot that already contains files. The files are added to the depot when the changelist is committed with p4 submit .


1 Answers

Only slightly more elegant than the comment in your last paragraph, but you should be able to:

  1. Revert foo.txt in client_b. Since it was marked for add the file will remain on the disk with no changes
  2. Sync foo.txt with -k. This makes the server think you have the latest revision without modifying your local file.
  3. Check out foo.txt for edit. Diff'ing against the have revision should show the changes.
  4. Submit your changes.
like image 73
dwikle Avatar answered Oct 06 '22 05:10

dwikle