Search code examples
perforcep4vperforce-client-spec

How to switch to a change-list when using perforce command line (p4)


I opened a bunch of files using p4 edit in my workspace and after making some changes on each of them, I decided to put them up for review so I staged them using p4 change and I got a number to mark the changelist. Once I did that I am not able to see the actual changes made in the workspace. The files have gone to a version prior to my p4 edit.

How do I revert my workspace to a changes pointing to a change-list?

p4 undo -c 403767
p4 undo @403767
p4 switch @403767
p4 revert -c 403767

None of the above seems to work. Also when I do a p4 opened -u <author-name> I have a string that says integrate change 403767 (text) for all the files listed.


Solution

  • The integrate change 403767 indicates that these files are open for integrate, so these can't be the files that you opened with p4 edit.

    Files can be opened for integrate by the p4 integrate, p4 copy, p4 merge, or p4 undo command.

    Further, if a file is listed by p4 opened, its current working state is already in your workspace. If you had opened the file for edit and neither reverted nor submitted it, p4 opened would say edit change 403767 and your edits would be in your workspace.

    I will hazard a guess that what you are actually trying to do is integrate changes from another branch, and you're confused because those changes do not yet appear in your workspace. Run:

    p4 resolve -am
    p4 resolve
    

    That might get things into the state you're expecting.