Steve Mark
Steve Mark

Reputation: 487

How to delete a perforce client with pending changelist

I have a workspace in perforce in which I made some files mark for delete. Now I want to delete that workspace forcefully.

But I don't have admin rights. How can I achieve this?

Upvotes: 45

Views: 103521

Answers (8)

nybon
nybon

Reputation: 9591

All the files need to be reverted before the change list can be deleted.

Two steps via p4v (version 2013.4):

  1. Revert all files.

    Right click the pending changelist, and then choose "Revert Files"

  2. Delete the change list.

    Right click the changelist, and then choose "Delete Pending Changelist 'XXXXXX'"

Upvotes: 3

Zilicon
Zilicon

Reputation: 3860

Wrote this script called p4-delete-client for deleting a p4 client (which has changelists & other problems).
It has the following features:

  • automatically deletes changelists (reverts pending & deletes shelved)
  • fixes hostname (if differs from the one the client was created on)
  • unlocks the client if locked
  • deletes the client
  • deletes associated files (can be configured not to from arguments)

Note that the script relies on other scripts in the repo.

Upvotes: 5

Gareth Rees
Gareth Rees

Reputation: 65854

Here's a scriptable procedure for deleting a Perforce client. Use with care: this deletes all your work in progress on the client!

  1. Revert all changed files on this client.

    p4 -c $CLIENT revert -k //...
    

    Note the use of the -k option, which "marks the file as reverted in server metadata without altering files in the client workspace". Since we are going to delete the client later, we don't care about updating the client workspace. This speeds things up if you have many files open.

  2. Delete all shelved files from pending changes associated with the client.

    p4 changes -s shelved -c $CLIENT | cut -d' ' -f2 |
    while read CHANGE; do p4 shelve -c $CHANGE -d //...; done
    

    If you never use p4 shelve you can omit this step.

  3. All pending changes associated with the client are now empty. Delete them.

    p4 changes -s pending -c $CLIENT | cut -d' ' -f2 | p4 -b 1 -x - change -d
    
  4. There are now no pending changes associated with the client. Delete the client.

    p4 client -d $CLIENT
    

(This process ought to be much easier! In particular, there seems no good reason why we have to delete shelved files associated with a client before deleting the client. If you find yourself struggling with this, do contact Perforce support and suggest that it be made simpler.)

Upvotes: 21

John Starr Dewar
John Starr Dewar

Reputation: 1371

This just worked for me in P4V for resetting the default changelist:

  1. Right click on the default changelist and choose "Edit Pending Changelist 'default'"

  2. Click the button on the bottom right "Save as numbered changelist"

  3. Right click on the new changelist and choose "Delete changelist XXX"

You can also right click on the new changelist to revert the files for whatever you need to do, which is not available as an option on the default changelist.

Upvotes: 0

aristotaly
aristotaly

Reputation: 399

try those steps :

  1. 1.Right click on the changelist

  2. Choose 'Change Ownership'

  3. In the workspace box choose already existing workspace and click OK

  4. right click on changelist and choose delete and than ok.

Upvotes: 2

Colonel Panic
Colonel Panic

Reputation: 137524

Why it's only 11 clicks in P4V, through an arbitrary sequence of menu items.

  1. Right click on the changelist
  2. Delete shelved files
  3. 'Yes'
  4. Right click on the changelist
  5. Remove all jobs
  6. Right click on the changelist
  7. Revert files
  8. 'Revert'
  9. Right click on the changelist
  10. Delete pending changelist
  11. 'Yes'

Let's send Perforce to usability school.

Upvotes: 49

Juve
Juve

Reputation: 10824

Here is what I did to empty my default change set, which had a lot of files checked out for edit:

 p4 opened | sed 's/#.*$//g' |  xargs -iF p4 revert F

This will cut off the comment part from the filename produced by p4 opened and pipe the filename to p4 revert. After that I had nothing pending and p4 changes -c my-client-name -s pending yields nothing. If you have a huge change set this will take a while.

Upvotes: 10

Bryan Pendleton
Bryan Pendleton

Reputation: 16339

Run p4 opened to see all your opened files and run p4 revert to revert them.

Then run p4 changes -c your-client-name -s pending to see all your pending changelists. Since in the first step you reverted all your open files, these changelists will all be empty. Run p4 change -d change-number to delete each empty pending changelist.

Then you can run p4 client -d to delete your client.

Upvotes: 57

Related Questions