Deleting Workspaces

Perforce IPLM workspaces are tracked on the server, and so have a server representation as well as existing as a physical workspace. When it is not needed any more, the workspace should be deleted via the methods described in this section.

Workspace Delete Overview

Perforce IPLM maintains an up to date representation of each workspace and its contents on the server. This means that each Perforce IPLM workspace consists both of the IP tracked DM data on disk, and the server copy of the workspace. When deleting a workspace both the physical workspace and the server copy should be removed.

A workspace delete must be run from outside the workspace to be deleted, otherwise the workspace delete will fail.

If a Perforce client has been associated with the workspace (it contains P4 type IPs) it is removed as part of the workspace delete.

Workspace Delete and Permissions

Only the creator of a workspace or an administrator can delete a workspace.

Modified and Unmanaged Files

If there are any locally modified managed files in the workspace (modified but not checked back in to the DM system) the workspace delete will fail, checking in or reverting these files will allow the workspace delete to continue.

Unmanaged files inside workspace IP directories are copied to a temporary location on workspace delete. By default this directory is "/tmp" on linux systems. Use the $TMPDIR variable to set this directory to some other location, ie /home/$USER/tmp. The copy of unmanaged files can be skipped by using the --discard option.

In the case of Perforce type IPs,  p4 opened, but not modified files will be automatically reverted.

Command Line

The 'pi ws delete' command is used to delete Perforce IPLM workspaces.

pi ws delete Command
> pi ws delete -h
Usage: pi workspace delete [-h] [--id identifier] [--discard] [path] [--unload <unload_mode>]

Description: Delete a Workspace. The Workspace directory will be deleted and
the Workspace will be removed from the database.

Positional arguments:
  path             Path to the Workspace to be deleted.

Optional arguments:
  --discard        Do not back up unmanaged files.
  --id identifier  Identifier of the Workspace to be deleted.
  --unload MODE    Specify handling of IVPs that will be unloaded from the workspace.
                   MODE is integer 0-2:
			0 (default) - block unload for open files, 
                       1 - block unload for open+modified files (unmodified files will be reverted),
                       2 - same as 1 but unopened modified files will be backed up to BACKUP_DIR. 
                       Higher mode number gives lower performance.						
  -h, --help       Show this help message and exit

Discarding Unmanaged files

Command Option Description
--discard Instead of backing up unmanaged IP files to the system temporary directory (set by $TMPDIR, default /tmp), discard them.

Deleting Workspaces by UUID

Command Option Description
--id identifier UUID of the workspace to be deleted. Note this only deletes the server workspace, not the on disk workspace.

If the workspace gets deleted outside of Perforce IPLM, for example via 'rm --rf' the server side representation of the workspace will remain, even though the physical on disk workspace is gone. These server only workspaces can be deleted via the id option. The workspace ID can be found by running a 'pi ws list --format json' or if model that shows it has been configured (refer to the Reports_uuid section in the Client Configuration section) it can be listed in table format:

pi ws list --format json Command String
> pi ws list --model uuid
┌─────────────────────────────┬────────────┬─────────────────────────────────────────────────────┬──────────────────────────────────────┐
│ TOP IPV                     │ CREATED BY │ PATH                                                │ UUID                                 │
╞═════════════════════════════╪════════════╪═════════════════════════════════════════════════════╪══════════════════════════════════════╡
│ tutorial.analog_top@1.TRUNK │ admin      │ /tmp/workspaces/release/tutorial/analog_top/TRUNK/1 │ d7c8b34f-4d02-4c5b-9135-e00aa933ae4e │
│ tutorial.padring@6.TRUNK    │ admin      │ /tmp/workspaces/ws1                                 │ d3caea91-e115-494f-85e1-e79bdf01e68d │
│ tutorial.tutorial@7.TRUNK   │ admin      │ /tmp/workspaces/release/tutorial/tutorial/TRUNK/7   │ 5970f7f4-2d5d-4741-91e7-08cf0c500aee │
│ tutorial.tutorial@1.TRUNK   │ admin      │ /tmp/workspaces/release/tutorial/tutorial/TRUNK/1   │ 76cb651f-543b-453d-bca9-c2bd81ce8080 │
└─────────────────────────────┴────────────┴─────────────────────────────────────────────────────┴──────────────────────────────────────┘
Found 4 matching object(s).

Once found use the --id option to delete it:

--id Option
> pi ws rm --id d3caea91-e115-494f-85e1-e79bdf01e68d
Successfully deleted Workspace 'd3caea91-e115-494f-85e1-e79bdf01e68d'.

Unload Mode

Unload mode is a perforce IP specific function, the unload mode is specified as a number 0-2, with lower mode numbers resulting in higher performance, and higher unload mode numbers resulting in more careful and conservative checking and preservation of file modifications when an IP is unloaded from the workspace.

Unload Mode Default Description
0 Y Block IP unload for p4 open files. This is a server only check and the quickest unload option
1 N Block IP unload open and modified files. Requires on disk checks so is slower, auto reverts open but unmodified files automatically
2 N Same as 1 but unopened modified files (edited without p4 edit) will be backed up to BACKUP_DIR piclient.conf directory