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

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.

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.

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

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
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.

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:
Go to C:/Users/user_name/.p4qt
user_name will be your username of your computer
Inside 001Clients folder WorkspaceSettings.xml file will be there.
There will be two tag
varName = "RecentlyUsedWorkspaces" remove the deleted workspace tag
A propertyList tag will be there with varName=deleted_workspace_name
delete that tag.
from drop down menu workspace name will be deleted

Ctrl + 5
Delete the relevant workspace

Related

P4V Clear the drop-down menu in the tree view for workspaces

In P4V (Perforce visual client) there is a tree view, where you can browse your files. In the top of that view, there is a dropdown menu, where you can select the workspace you want to browse through.
I have just deleted a whole bunch of old workspaces, but they still show up in the drop-down menu. I cannot find any place to get rid of them.
I will be happy to know how to either:
remove specific workspaces from the drop-down, or
remove all workspaces from the drop-down
I used P4V Rev. Perforce Visual Client/MACOSX106X86_64/2014.1/827578 and had 10 workspaces listed in the drop down. As I deleted them they were removed from the drop-down. What version of P4V are you using?
I am using P4V (on Windows 7), dated 2013 March 20 and versioned:
Rev. Perforce Visual Client/NTX64/2013.1/611291
My problem was somewhat different than that described in the question. A number of my old workspaces were showing up in the P4V workspace drop-down menu, even though these old workspaces no longer existed on the server. (I did not delete those workspaces; I'm guessing they were deleted by an admin.)
In my case, I found a way to remove these orphaned names from the workspace drop-down menu. Here's what I did: For each workspace name in the drop-down menu I wanted to remove, I:
Recreated a workspace with the identical name. (I found that the root folder that I assigned to the workspace did not matter.)
Immediately deleted the workspace.
This resulted in the workspace name being automatically removed from the workspace drop-down menu.

What happened to "Exclude from Source Control" in VS2012

I want to exclude some of the files in code folders from TFS 2012 source control.
Before VS2012 this was done by the "Exclude from source control" command available in "Source Control Explorer"s right-click menu. But in VS2012 I can not find it.
Does anybody know where it is ?
(I am using a "Local" workspace by the way.)
When you click on "Detected Changes" in the Team Explorer pane, "Promote Candidate Changes" window opens. This window allows you to select among detected changes and promote them to a source controlled item.
In this "Promote Candidate Changes" window, you select a file (or multi select files with Shift), right-click on it and a context menu pops up which contains an "ignore this local item" option. If you you click on it, selected files are excluded from source control.
Visual Studio adds a file named ".tfignore" to the source control mapping root, which contains names of all files to be ignored by source control. (Previous TFS versions did not produce this file but they were all server workspaces. Since this is a "Local" workspace, filenames to be ignores need to be kept in the workspace)
I have the real solution.
In the "team explorer" pane, in the "pending changes" tab, right click a new file you don't want in source control, and click "undo".
It will leave the file in the project, and exclude it from TFS. In the project window, the file will never have a "lock" icon on the left of its name.
This is the easiest solution:
1. Select the file(s) in Solution Explorer
2. Go to File -> Source Control -> Advanced
and here it is
Keep in mind:
If you right click a file in Solution Explorer you only find "the most important options" not all :)
In VS2013 this is back but has been moved to the file menu: -
Select the file in the Solution Explorer
File > Source Control > Advanced > Exclude xxx.xxx from Source Control
I know that this is slightly off topic but thought it may help someone.
I have Visual Studio 2017 Enterprise, and the option to exclude does not exist under File->Source Control. My solution to this problem was to open the Source Control Explorer, and remove the item I wanted to exclude.
It's in the Pending Changes pane separated to Excluded Changes and Included Changes sections. It allows filtering and excluding or promoting items between sections.
!

Add an already existing directory to a directory in Solution Explorer

I want to add an already existing directory to a directory in Solution Explorer, but whenever I right-click on the directory and select Add => Existing Item, I can only add individual files, but not directories.
How do I add an already existing directory to a directory inside a Project inside Solution Explorer?
Click the 'Show all files' button at the top of the Solution Explorer and right click the folder desired and select 'include in project'.
Drag and drop the folder from Windows Explorer onto your Visual Studio solution window :)
Source here
or simply copy & paste into solution explorer.
VS 2012 seems to distinguish between 'Solution Folders', which are only folders containing either other solution folders, or containing project folders. The drag-and-drop works (with my settings) only for the project folders, and no for the solution folders.
If I add a new solution folder, nothing happens on the machine. If I drag-and-drop a machine folder to the main Solution, it refuses to accept it. If I drag-and-drop the folder to a Solution Folder, I get an error message saying this cannot be done.
Some other answers are missing an important point: if the folder is not in a project in the solution it is impossible to add the folder
This is the solution:
1) Add a new folder to the sln - it does not care that the folder already exists on the disk because this a virtual folder in the sln
2) Add the file to the folder using "add existing files"
When dealing with a solution level folder that has been removed for some reason, and now needs to be added back, open the .sln file in a text editor like notepad++.
Find your "FolderName" in the section that looks like this...
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NewFolder1", "NewFolder1", "{73ED84FC-F250-4CCC-B267-34CEB67F2883}"
EndProject
Delete from "Project" to "EndProject" ONLY for the specific Project/Folder you're having trouble with.
You may get a message in VS2012 that says your solution has been modified by an external source. Choose the option to "Discard" your changes for the external changes. Lastly, add your solution level folder, and add your project(s) to that folder as existing items, drag/drop them, or copy and paste them, according to your preference.
For those who had a hunch it could be done but weren't able to do it, NOTE: Drag Folder or Files ONTO the name of the Project Name in Solution Explorer in the least
Expand the "Project" item in the menu bar and select "Show All Files". Then locate the folder you wish to add in the Solution Explorer (folders that are not currently included will be light grey with a dotted outline instead of the usual solid icon) right click the desired folder and select "Include in project"
Once finished select "Show All Files" from the Project menu again to return to the regular view.
(This is very similar to Radenko Zec's answer, but does not require the "Show All Files" button to already be present in a toolbar. I would just leave this as a response to his answer, but I don't currently have the reputation to leave comments.)

p4v cannot see the default tree in pending tab

I am new to P4V (perforce) while working with this, i cannot see the default folder in pending tab as i cannt drag any files for editing.
Thanks
Have you created a workspace? Open workspaces tab > right click.
Also make sure your connection is set up properly.

Perforce: P4V option to 'add to client view'? (It exists in P4Win)

In the Perforce realm, the P4Win GUI is now "legacy" and the new P4V is supposed to fill in the void (and it does, most of the time).
There was one very useful (albeit rather hidden) option in P4Win that allowed adding a depot path to the client specification in a few clicks.
Is there a similar option available in P4V? ... because I can't find it.
(I know I can do it manually.)
Here is the P4Win feature, in all its glory:
This is typical for the P4 GUI (old and new) - it can do lots of things, if only you knew where to look (hint: usually not where you'd expect to find it).
There IS an option in P4V similar to the old 'Add Files to client view' from P4Win, only a lot more powerful! (it's a bit hidden and IMO not as streamlined as the original)
You can't find it in the depot view, where you probably ARE when you need it. Instead, go to Workspaces view, right-click the workspace definition and 'Edit' it (or dbl-click it then click 'Edit').
Notice the tabs on top of the 'Workspace editor' window that just opened. Select the 'View' tab. There is a lot going on here, including (apparently) information on the new 'Offline' mode.
To get to the point: in this window, find the piece of depot you need and right-click it.
Nirvana! There are no less than 6 menu options (!) that allow you to specify how and what to add OR remove to/from the workspace definition.
There's even an 'advanced' mode that looks a bit scary :-&
For P4V version : Rev. Perforce Visual Client/LINUX26X86_64/2012.1/490402
Released on 2012 July 02
Do as follows
Go to Connections -> Edit Current Workspace
In the Basic tab , Workspace Mappings , Right click on the tree and Include Tree.
I don't think that there is, you need to open the Workspace view and make your changes there.
Edit your workspace and change the view to include the relevant directory. Although I use P4V everyday and 'Add to client view' seems to ring a bell....
Of note, they added this feature into the P4V client at some point. You can now right click on a path in the depot tab and choose "Map to Workspace View...". It will bring up the workspace editor with the path added.

Resources