Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete a Perforce client workspace with pending files when the workspace has already been removed from disk?

How do I delete a workspace that has pending files when that workspace has already been removed from disk?

Caveats:

  • p4 command line only; not p4v gui
  • regular user access; no admin access

Scenario:

  • create a workspace named user_workspace on the disk in the ~/my_workspace directory
  • p4 edit files in workspace on the default pending changelist
  • remove workspace by hand (rm -rf ~/my_workspace)
    • workspace still exists on server with pending files

Solutions that don't work:

1: Delete workspace

Doesn't work because the workspace has files opened.

p4 client -d user_workspace

Client 'user_workspace' has files opened; use -f to force delete.

2: Delete workspace with force

Doesn't work because not admin.

p4 client -d -f user_workspace

You don't have permission for this operation.

3: Delete the pending changelist; then delete workspace (try 1)

p4 changes -c user_workspace -s pending

Only lists pending numbered changelists, does not handle the default pending changelist.

p4 -c user_workspace -d changelist_number

Not possible because there is no changelist number for the pending changelist.

4: Delete the pending changelist; then delete workspace (try 2)

Trying to do a p4 revert on a directory that does not exist anymore gives a strange error.

p4 revert ~/my_workspace

/home/user/my_workspace - must refer to client 'user_workspace'.

p4 -c user_workspace revert ~/my_workspace

/home/user/my_workspace - must refer to client 'user_workspace'.

setenv P4CLIENT user_workspace; p4 -c user_workspace revert ~/my_workspace

/home/user/my_workspace - must refer to client 'user_workspace'.

like image 546
engtech Avatar asked Feb 28 '11 18:02

engtech


People also ask

How do I get rid of pending Changelist?

To delete a pending changelist, you must first remove all files and jobs associated with it and then issue the p4 change -d changenum command. Related operations include the following: To move files to another changelist, issue the p4 reopen -c changenum command.

What does perforce Remove from workspace do?

The p4v Perforce GUI client has an 'Actions > Remove from Workspace' menu command which removes all files from the workspace that are under version control and were not opened for edit or delete.

How do I delete a shelved Changelist?

Using -d -c flag deletes the shelved files in the specified changelist so that they are no longer available for p4 unshelve operations. By default, only the user and client of the pending changelist can delete its shelved files.


2 Answers

1. Revert the pending changelist

Have to use Perforce depot notation instead of local directory notation because the local directory does not exist anymore.

p4 -c user_workspace revert -k //...

//blah/blah/blah/file#rev - was edit, reverted

2. Delete the client workspace

p4 client -d user_workspace

Client user_workspace deleted.

like image 57
engtech Avatar answered Sep 28 '22 06:09

engtech


this will give you the pending changes on the client

p4 changes -c user_workspace

this will delete the pending change list of your choice

p4 change -d <change list number>

after that, you can delete the client using

p4 client -d user_workspace 
like image 28
mimiA Avatar answered Sep 28 '22 07:09

mimiA