0

Trusty computer crashed and died while files were checked out under a Perforce Workspace. The New computer was not recognized by the old Workspace so I couldn't check the files back in. Had to keep working so I created a new Workspace to edit the exact same files.

I couldn't remove the old Workspace without reverting the files. But I don't want to risk copying over the work I've done on the exact same files under the new Workspace.

Is "p4 revert -k" what I want to do?

Suggestions? Thanks.

  • Workspaces/clients are independent. Reverting the files in one workspace/client won't affect files open in a different workspace/client. – jamesdlin Jan 25 '20 at 03:30
  • Do you still have the changes that you made on the old computer? As in, you made a backup, and you restored that backup on the new computer, and you're trying to take those changed files and check them in? Or are the files from the old computer truly lost forever, and you're just trying to clean up that old workspace before creating a new workspace (as @jamesdlin noted, you don't need to do that necessarily, just create a new workspace on the new computer in that case). – Bryan Pendleton Jan 25 '20 at 18:26
  • Thank you both for getting back @jamesdlin and Brian Pendleton. Since the old Workspace wouldn't allow me to check-in with my new computer and I had to keep working, I made a new Workspace and opened the exact same files which I've substantially edited. Now with a slight breather I'm trying to go back and clean up. I want to remove the old Workspace which the system says I must revert the files before removing that Workspace. But I don't want to write over the work I've done. Would "p4 revert -k" do the job? – Mike Andrews Jan 27 '20 at 15:30
  • @MikeAndrews Since you've already recreated your changes in a new workspace, there's no need to keep the changes you've made in your old workspace. Just revert them normally with `p4 revert`. That will not affect open files in other workspaces. BTW, there also wasn't any real need to create a new workspace either; you could have just edited your workspace (or run `p4 client`) and removed the hostname so that it was no longer tie to a specific host. – jamesdlin Jan 27 '20 at 17:16
  • @jamesdlin My old computer is dead and gone. The old Workspace will not recognize my new laptop. So I'm not able to revert the files which is required by Perforce so I can delete the old Workspace. However I don't want to overwrite the old files because they are the very same files I'm editing with the new Workspace. I have copied the files to a completely separate directory just in case of a snafu. – Mike Andrews Jan 28 '20 at 15:24
  • Okay, now I understand what you're asking, which is "How do I revert files in a workspace that I can no longer access?" – jamesdlin Jan 28 '20 at 16:49

1 Answers1

1

What you're really asking is how you can revert files in an old workspace/client that you can no longer access (because it's tied to a host that no longer exists).

The simplest way would be to ask your Perforce administrator to delete your old workspace. Someone with administrative access to your Perforce server can do p4 revert -C OLD_CLIENT to revert files belonging to another user and client, or the administrator can do p4 client -df OLD_CLIENT to delete the client outright.

If you want to do it yourself instead (note: I don't have a Perforce installation handy right now, so this is untested), then you could try:

  1. Run p4 client OLD_CLIENT, clear the Host: field. Save and exit. This should allow further edits from a different host.

  2. Run p4 client OLD_CLIENT again. Change Root: to point to some empty directory. Save and exit.

  3. cd to the directory from step 2. Run p4 -c OLD_CLIENT revert ....

jamesdlin
  • 81,374
  • 13
  • 159
  • 204