Workspace FAQs

Problems Deleting a Workspace

To successfully delete a workspace after encountering issues that prevent the deletion, let's consider files in the workspace that could be in one of the following states.

  1. Checked out but not modified
  2. Checked out and modified
  3. Modified but not checked out
  4. Missing (deleted or moved)
  5. Added/Deleted but not submitted

Let's delete a workspace containing files in each of these categories.

  1. checked_out.txt
  2. checked_out_mod.txt
  3. mod_not_checked_out.txt
  4. missing.txt
  5. added_not_submit.txt, deleted_not_submit.txt

Let's attempt to delete the workspace

Deleting Workspace
> pi ws rm /tmp/ws_BEwpNlfnbGCo
WARNING:Could not determine IP for file: d
ERROR:Delete error.
  Workspace has checkouts and cannot be removed:
drinks.vodka/rtl/mod_not_checked_out.txt (edit)
WARNING:Could not determine IP for file: d
WARNING:Could not determine IP for file: d
ERROR:Delete error.
  Workspace has checkouts and cannot be removed:
drinks.vodka/rtl/added_not_submit.txt (add)
drinks.vodka/rtl/checked_out.txt (edit)
drinks.vodka/rtl/checked_out_mod.txt (edit)
drinks.vodka/rtl/mod_not_checked_out.txt (edit)

Lets go back to the workspace and run some Perforce checks

Perforce Checks
> p4 opened
//depot/vodka/trunk/rtl/added_not_submit.txt#1 - add default change (text)
//depot/vodka/trunk/rtl/checked_out.txt#3 - edit default change (text)
//depot/vodka/trunk/rtl/checked_out_mod.txt#1 - edit default change (text)
//depot/vodka/trunk/rtl/deleted_not_submit.txt#1 - delete default change (text)

This does not give us information about mod_not_checked_out.txt or missing.txt the files which were edited without checkout and unix deleted (or moved) files. Lets clean up the opened files then run p4 status. There is no need to worry about missing.txt since unix deleted files do not prevent the deletion of a workspace. A warning message is printed for the case of unix deleted files.

p4 Status
> p4 status
missing.txt - reconcile to delete //depot/vodka/trunk/rtl/missing.txt#1
mod_not_checked_out.txt - reconcile to edit //depot/vodka/trunk/rtl/mod_not_checked_out.txt#1

The directory cannot be deleted with these changes made outside of Perforce

Perforce Changes
> pi ws rm /tmp/ws_BEwpNlfnbGCo
WARNING:Could not determine IP for file: d
ERROR:Delete error.
  Workspace has checkouts and cannot be removed:
drinks.vodka/rtl/mod_not_checked_out.txt (edit)

Now after running `p4 sync -f mod_not_checked_out.txt` the workspace can be removed.

p4 Sync
> pi ws rm /tmp/ws_BEwpNlfnbGCo
WARNING:Could not determine IP for file: d
Successfully deleted Workspace '/tmp/ws_BEwpNlfnbGCo'.


Include Perforce Clients in "pi workspace list"

To determine the Perforce client we can run:

pi ws ls -v
> pi ws ls -v | grep -e 'Top\|Client'
    Top IPV                   - drinks.vodka@1.TRUNK
    P4 Client                 - ws:mdxtest::simon:drinks.vodka:d46736d1

Delete a zombie workspace from the database

Often customers will delete a workspace using Unix "rm" which leaves a unattached workspace object behind in the Perforce IPLM database. These can be deleted using the workspace id as follows
WS ID
> pi ws rm <ws path> --id <UUID-STRING>

First we need to identify our workpaces UUID. In the following example we have a number of workspace in the system

pi ws ls
> pi ws ls
┌──────────────────────┬────────────┬───────────────────────────────┬───────────┐
│ TOP IPV              │ CREATED BY │ CREATED ON                    │ PATH      │
╞══════════════════════╪════════════╪═══════════════════════════════╪═══════════╡
│ drinks.vodka@1.TRUNK │ admin      │ 2017-03-26 13:07:34 -0700 PDT │ /tmp/ws9  │
│ drinks.vodka@1.TRUNK │ admin      │ 2017-03-26 13:16:59 -0700 PDT │ /tmp/ws12 │
│ drinks.vodka@1.TRUNK │ admin      │ 2017-03-26 13:17:04 -0700 PDT │ /tmp/ws13 │
│ drinks.vodka@1.TRUNK │ admin      │ 2017-03-26 13:17:07 -0700 PDT │ /tmp/ws14 │
│ drinks.vodka@1.TRUNK │ admin      │ 2017-03-26 13:17:10 -0700 PDT │ /tmp/ws15 │
└──────────────────────┴────────────┴───────────────────────────────┴───────────┘
Found 5 matching object(s)

and we want to delete the workspace located in /tmp/ws13, however this has already been Unix deleted

To determine the UUID string

UUID String
> pi ws ls -q 'path="/tmp/ws_EGCnOIOrHBxo"' -v | grep ID
    Workspace ID              - 8e1c7cbe-7768-45db-9386-9a7b2b0d7e8b

Finally to delete the workspace we can run

Deleting Workspace
> pi ws rm /tmp/ws13 --id 8e1c7cbe-7768-45db-9386-9a7b2b0d7e8b
Successfully deleted Workspace '8e1c7cbe-7768-45db-9386-9a7b2b0d7e8b'