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.
- Checked out but not modified
- Checked out and modified
- Modified but not checked out
- Missing (deleted or moved)
- Added/Deleted but not submitted
Let's delete a workspace containing files in each of these categories.
- checked_out.txt
- checked_out_mod.txt
- mod_not_checked_out.txt
- missing.txt
- added_not_submit.txt, deleted_not_submit.txt
Let's attempt to delete the 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
> 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 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
> 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.
> pi ws rm /tmp/ws_BEwpNlfnbGCo WARNING:Could not determine IP for file: d Successfully deleted Workspace '/tmp/ws_BEwpNlfnbGCo'.
To determine the Perforce client we can run:
> pi ws ls -v | grep -e 'Top\|Client'
Top IPV - drinks.vodka@1.TRUNK
P4 Client - ws:mdxtest::simon:drinks.vodka:d46736d1
> 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 ┌──────────────────────┬────────────┬───────────────────────────────┬───────────┐ │ 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
> 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
> pi ws rm /tmp/ws13 --id 8e1c7cbe-7768-45db-9386-9a7b2b0d7e8b Successfully deleted Workspace '8e1c7cbe-7768-45db-9386-9a7b2b0d7e8b'