How to delete a workspace in Perforce (using p4v)?

129,331

Solution 1

From the "View" menu, select "Workspaces". You'll see all of the workspaces you've created. Select the workspaces you want to delete and click "Edit" -> "Delete Workspace", or right-click and select "Delete Workspace". If the workspace is "locked" to prevent changes, you'll get an error message.

To unlock the workspace, click "Edit" (or right-click and click "Edit Workspace") to pull up the workspace editor, uncheck the "locked" checkbox, and save your changes. You can delete the workspace once it's unlocked.

In my experience, the workspace will continue to be shown in the drop-down list until you click on it, at which point p4v will figure out you've deleted it and remove it from the list.

Solution 2

It could also be done without a visual client with the following small script.

$ cat ~/bin/pdel

#!/bin/sh

#Todo: add error handling

( p4 -c $1 client -o | perl -pne 's/\blocked\s//' | p4 -c $1  client -i ) && p4 client -d $1

Solution 3

In P4V click View > Workspaces

If the workspace to be deleted is not visible in the list you may have to uncheck the box Show only workspaces available for use on this computer

Right-click the workspace to be deleted and choose Edit Workspace 'My_workspace'

On the Advanced tab uncheck the box Locked: only the owner can edit workspace settings > then click OK

Now back on the Workspaces tab of Perforce right-click the workspace to be deleted and choose Delete Workspace 'My_workspace'

P4V should remove the item from the drop-down list when clicking on it.

There is a case where a previously deleted workspace remains in the drop-down list, and P4V displays the following error:

P4V Workspace Switch Error. This workspace cannot be used on this computer either because the host field does not match your computer name or the workspace root cannot be used on this computer.

If this error occurs, the workspace(possibly on another host) may have only been unloaded. Click the P4V Workspaces Recycle bin

P4V Recycle

In the resulting Unloaded Workspaces window right-click the offending workspace and choose Delete Workspace 'My_workspace'. P4V should now remove the workspace item from the drop-down list.

Solution 4

If you have successfully deleted from workspace tab but still it is showing in drop down menu. Then also you can successfully remove that by following these steps:

  1. Go to C:/Users/user_name/.p4qt

user_name will be your username of your computer

  1. Inside 001Clients folder WorkspaceSettings.xml file will be there.

There will be two tag

  1. varName = "RecentlyUsedWorkspaces" remove the deleted workspace tag

  2. A propertyList tag will be there with varName=deleted_workspace_name delete that tag.

from drop down menu workspace name will be deleted

Solution 5

  1. Ctrl + 5

view workspace in p4v

  1. Delete the relevant workspace

enter image description here

Share:
129,331

Related videos on Youtube

Logic
Author by

Logic

Updated on March 10, 2020

Comments

  • Logic
    Logic about 4 years

    I'm new to Perforce and have created a few workspaces as exercises for getting familiar with it. Now I would like to delete some of the workspaces. I just want to get rid of the workspaces so that they do not appear on the drop-down in the workspaces view (do not want to do anything with actual depot files).

    Googling up an answer yields the suggestion to "make the workspace active" (I guess that means select it in the workspace dropdown?) and then delete it from the "edit" menu. Unfortunately, the delete option is grayed-out when I try this.

    Anyone know how to do this, or do I just have to live with junk workspaces? I've physically deleted one of them from the disk, and it still appears in the workspace drop down, and I can't even synchronise it with the depot now, so I guess that's not how to do it.

  • Logic
    Logic over 14 years
    Thanks! When I try to right-click the workspace I want to delete and select "unlock", it sends the p4 command: "p4 unlock //my_workspace", the response is: "//secondary.... -files(s) not opened on this client." Doesn't seem to do anything. I've tried switching workspaces and exiting p4v but the junk workspaces always remain in the dropdown.
  • Dan Mooray
    Dan Mooray over 14 years
    You're trying to lock/unlock files (in the left pane of p4v), not workspaces. I've revised my answer to help you bring up the workspaces view.
  • Logic
    Logic over 14 years
    Ha! That did it. I had thought the "workspace view" was the left pane. Thank you very much!
  • Siken
    Siken almost 12 years
    Also, if you're an admin and trying to delete someone else's workspace, make sure to click the "Clear filter" button -- otherwise you will only see your personal workspaces.
  • Colonel Panic
    Colonel Panic over 11 years
    I found that the menu item 'View / Workspaces' was disabled (greyed out). Fixed by changing tab to 'pending changelists'.
  • zwcloud
    zwcloud over 4 years
    You can just delete WorkspaceSettings.xml, it will be created later by p4v.