Search code examples
perforceworkspace

P4V how to recover a deleted workspace


The title may be misleading but I need to know more terms and more about P4V to properly summarize the question. That's also why I cannot get the answer by google.
I delete a workspace by mistake. Choose view->workspaces, and then the right pane list the workspaces I have. I delete one. And that's the one I have on another machine.
Files stay on the disk of that machine. But P4V do not show this workspace anymore. I plan to open a new connection, create a new workspace and set the same location. But I'm afraid that the sync operation will override the folder. That's not what I want. Because except from the source codes I get from depot, I have built the code. If overriden, a lot of build work has to be redone.
So, how to recover my workspace in perforce?


Solution

  • The situation is very similar to the one described in this KB article: http://answers.perforce.com/articles/KB/2446

    After you have re-created the workspace, do not sync. As you say, it will overwrite your files (at least the read-only ones), and you don't want that.

    Instead, open a command prompt and run:

    p4 sync -k ...
    p4 clean ...
    

    The "p4 sync -k" tells the server to do a sync but keep what you have in your workspace instead of overwriting it. The "p4 clean" tells the server to verify what's in your workspace against what you just told it you have, and refresh any files that are different.