user3689963
user3689963

Reputation: 115

p4 unshelve doesn't bring new added files

It seems that p4 unshelve -s changelist doesn't bring the new source files that are added in the shelved changelist. Two questions:

  1. Am I missing something?
  2. Any workaround?

Thanks.

Upvotes: 2

Views: 8804

Answers (3)

Samwise
Samwise

Reputation: 71542

p4 unshelve should faithfully open every file that was shelved, for its corresponding action — add, edit, integrate, or delete. The opened file will be opened at the same working revision, with the same resolves (either pending or completed), and the same content.

To answer your two questions:

  1. Yes, you missed something (but there's not enough information to know what).
  2. To work around the problem, figure out what you missed and fix it.

Do the added files show up in p4 files @=SHELF? If not, they were never shelved in the first place. Go back and fix that.

Do you get an error message from p4 unshelve telling you that these files can’t be unshelved? If so, fix that.

Are the files already opened according to p4 opened? If so, either they did get unshelved or that’s the reason they couldn’t be unshelved.

Upvotes: 3

haxpor
haxpor

Reputation: 2601

I faced the same issue but for my case it's because of I have file(s) opened for add locally. Target shelved CL that I want to unshelve also has that file(s) opened for added as well. So if I try to unshelve target shelved CL, it will shout out similar to the following error message.

//depot/dir/file.h - can't unshelve (already opened for add)

So I have to do the following

  • p4 revert <file(s)> - revert all files opened for add. This won't remove the file(s), it will still be there. It will show message like //depot/dir/file.h#none - was add, abandoned
  • p4 unshelve -s <target-CL> - to unshelve target CL again, this time, there should be no error message. If you already unshelved previously but has error for those file(s) opened for added only, then you can do just p4 unshelve -s <target-CL> <file1> <file2> to unshelve only those file(s) opened for add only.

Done, now you can continue working.

Upvotes: 1

Ayman Salah
Ayman Salah

Reputation: 1089

p4 unshleve will open files for add if they existed in the changelist passed to -s.


There exists a case where added files specifically wouldn't be unshelved and that is when the files already exist and are writable. For such files, you should be seeing an error saying:

Can't clobber writable file /file/path

I used to run into this case when I do the following:

  1. Shelve a changelist that has files opened for add on workspace1
  2. Unshelve the changelist on workspace2
  3. Revert all the unshelved files on workspace2, including the files opened for add
    • Now the files that were opened for add will exist in workspace2 and stay there in a writable state
  4. Unshelve the changelist again on workspace2
    • If you inspect the output of p4 unshelve here you should see the error mentioned above
  5. Run p4 opened on workspace2 and not find the files that were opened for add

Upvotes: 0

Related Questions