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?
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.
Why it's only 11 clicks in P4V, through an arbitrary sequence of menu items.
Right click on the changelist
Delete shelved files
'Yes'
Right click on the changelist
Remove all jobs
Right click on the changelist
Revert files
'Revert'
Right click on the changelist
Delete pending changelist
'Yes'
Let's send Perforce to usability school.
Here's a scriptable procedure for deleting a Perforce client. Use with care: this deletes all your work in progress on the client!
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.
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.
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
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.)
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.
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.
try those steps :
1.Right click on the changelist
Choose 'Change Ownership'
In the workspace box choose already existing workspace and click OK
right click on changelist and choose delete and than ok.
All the files need to be reverted before the change list can be deleted.
Two steps via p4v (version 2013.4):
Revert all files.
Right click the pending changelist, and then choose "Revert Files"
Delete the change list.
Right click the changelist, and then choose "Delete Pending Changelist 'XXXXXX'"
This just worked for me in P4V for resetting the default changelist:
Right click on the default changelist and choose "Edit Pending
Changelist 'default'"
Click the button on the bottom right "Save as numbered changelist"
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.
Related
A person changes his laptop and discarding this perforce client and workspace. He had 2 files opened in a changelist but not sure on the changelist number.
I have admin rights and tried to unlock the file but couldn't do it
p4 -p p4ser:1001 unlock -f //doc/pascal/projmng/GP.xlsm
//doc/pascal/projmng/GP.xlsm - file(s) not opened in that changelist
Then i tried to find the change list by searching for opened files by that user
p4 -p p4ser:1001 opened -u joe | grep GP.xlsm
//doc/pascal/projmng/GP.xlsm#5 - edit default change (binary+l) by joe#joe_dt exclusive
I have the client name now as joe_dt and was able to find the changelist using changes
p4 -p p4ser:1001 changes //doc/pascal/projmng/GP.xlsm
Change 34784592 on 2015/05/28 by joe#joe_dt 'added POR stuf'
Now if i try to unlock, i get the same error.
p4 -p p4ser:1001 unlock -c 34521298 -f //doc/pascal/projmng/GP.xlsm
//doc/pascal/projmng/GP.xlsm - file(s) not opened in that changelist.
So now i have the client name alone which does not exists as the laptop was replaced. Don't know in which changelist this file is opened by the user joe.
Unlock -x also didn't help.
Am new to Perforce, can you guys help me how to unlock this file?
First, do this; it'll save you from having to keep typing "-p p4ser:1001". :)
p4 set P4PORT=p4ser:1001
The file's not "locked", it's "opened exclusively" -- these are two distinct states, and "unlock" only deals with the "locked" state.
A file can be "opened" but not "locked", and "unlock" takes a file from "opened+locked" to just "opened". Multiple people may have a file "opened" at the same time, even if one has it "locked", but nobody else can "submit" while somebody else has a lock.
A file with the "+l" filetype, though, is always opened exclusively, regardless of whether it's "locked" -- only one person can even have it open at a time. To release this the user who has the file open needs to either "submit" or "revert" it -- they can't release the lock while also keeping the file open as you can with a normal "lock". For an admin to release the file without deleting the client, they need to actually force a "revert" rather than a simple "unlock".
But since joe has discarded this client workspace, the simplest thing is to just delete it:
p4 client -d -f joe_dt
That should cause any files previously opened on that client to be abandoned, whether they were locked, exclusive, both, or neither.
I made my change successfully did a p4 change and have a numbered CL.
p4 describe -c 27701190 indicates it is pending, however p4 pending and p4 opened indicate "File(s) not opened on this client".
It's not critically important that my client be updated, but I'd like to submit this CL. (I'd also be happy with getting my client situation rectified).
What's the path to either submitting this CL or opening the files involved in this CL on my client?
You can open the files for edit after the fact (i.e., after you've changed them without telling Perforce you were going to change them). Just run the edit command and open them in the desired changelist with the -c switch:
p4 edit -c 27701190 "//depot/path to files/..."
I accidentally created a new changelist with files from WORKSPACE not from DEPOT and now under the changelist 4500 modified files are displayed (all dlls pdbs etc. alongside with the files i actually edited)
I'm using the p4v GUI. Is there anyway to undo this, without having to backup all the files then revert them using perforce, put them back and create a new changelist using DEPOT.
Thanks a lot, i hope there's a workaround :).
Not sure if this is what you're looking for, but to remove checked out files from your changelist without removing the edits:
p4 revert -k -c changelist# //...
If you haven't submitted the changelist, and all of the files are marked with '+' in the changelist in the Pending tab, you can click 'Revert' on the changelist. As long as the files were marked for add ('+') they'll be left intact in your workspace.
There's multiple ways.
Select View->Pending Changelists from the menu bar to view your pending changelist tab. You should see all of your checked out files grouped by changelist. Go to your desired changelist and expand into files.
You can Ctrl+left-click multiple files, then right-click on one of them and select Move to another changelist....
You can also choose to Submit... the files, and when the dialog box appears, their will be checkboxes next to each file. Uncheck the files you do not want to submit.
As another answerer mentioned, if you accidentally added files to Perforce that you did not intend to, you can indeed revert those files without actually deleting them (the only time a file will actually go away is when you do a p4 delete or p4 move.)
I encountered a similar issue, the solution i used is as follows:
1. Navigate to the workspace using p4v
2. Right click on one of the folders or files and click "Open Command window here"
3. run the following command to review dll or pdb respectively
p4 revert //....dll
p4 revert //....pdb
Thanks,
Lyon
If you right click on a pending changelist in p4v you should have the option to Revert unchanged files, which does exactly what it says on the tin.
I had made changes to a file and then shelved it.
Then I deleted the file.
Now I am not able to get it back to my workspace. I tried p4 sync -f and p4 unshelve ##.
What do I do ?
p4 unshelve is the correct command.
To figure out which shelf you need to unshelve, use p4 changes -s shelved and p4 describe -S
What's probably going wrong is that when you deleted the file, you still left it "opened" in Perforce (do p4 opened to see), so first do a p4 revert to revert the file, then you can successfully unshelve the shelf and you'll get your edited version back.
In p4v, go to the depot view, select the file, then hit ctrl-shift-s (pretty sure this works in linux too) this will open an explorer window which should be where the file is located. Maybe it's going to a different directory then the one you think?
If it's not there, right click the folder, and say get this revision, and check the force checkbox
Is there any option to shelve files that have been once committed? I need to expose them for a codereview. I've tried to fetch old versions and shelve them to produce something like back-diff, however it doesn't work for me: although files in shelve are old one, diff in P4V thinks they're identical to new ones.
You can diff a submitted changelist against the depot at a previous state. In your history tab, (View -> History in Menu Bar), select the changelist of interest. Drag the changelist onto the previous changelist number (be sure you have the top level of your depot/workspace selected, or at least a high enough point to include all your changes). This will open up a dialog which will be a type of directory diff which will show all the changed files. Use the arrows in the toolbar to move between changed files. Use the drag and drop and drag the old file onto the new one to see the changes between the files.
With the command line you can also do this: let's pretend your changelist is 1300
p4 diff2 ...#1299 ...#1300
but this uses the text-only 'diff'.
To produce the "back-diff" you wanted, you need to do the following:
Sync the relevant files to the revision you're interested in (p4 help sync)
Check out the relevant files into a new changelist (p4 help edit)
Sync the relevant files to the head revision (p4 help sync)
Resolve the files you have checked out by accepting target (p4 help resolve)
Shelve the files (p4 help shelve)
you can now provide the shelf as a diff of the changes that were made against head.
No. The files have been committed.
You want to back out the changelist, shelve that changelist, then back out the changelist again and submit to restore the depot to the state before you submitted.
How to do this
In P4V, select the 'Submitted Changelists' tab (View > Submitted Changelists) and find the changelist. Right-click the changelist and select 'Back Out Submitted Changelist ###'. It will prompt you create a new pending changelist.
In the 'Pending Changelist' tab (View > Pending Changelists), shelve the new changelist you just created.
Repeat step 1, creating a new pending changelist.
Submit.