I have deleted client from perforce forcefully but it was not deleted from drop.
Can someone help on this ?
Use the p4 delete command to delete files at the head revision, e.g.:
p4 delete //depot/folder/...
p4 submit
Use the p4 obliterate command to wipe all revisions from the repository permanently (this can't be undone and requires Perforce admin privileges):
p4 obliterate -y //depot/folder/...
Deleting a client spec has absolutely nothing to do with any existing depot files.
Related
TL;DR: How do I sync an existing p4 workspace to a new label, so that all my previous changes are undone, and it is as good as a new sync?
Hi,
I have a perforce workspace synced to a label L1.
I added/deleted/edited a few files
I moved a few files inside a folder (mv a.txt b.txt new_folder/)
I want to cleanly sync this workspace to label L2 now.
I already removed all shelved and pending changelists, then tried
p4 reconcile -w ... && p4 revert -w ... && p4 sync ...#L2
Looks like it almost works, except that the files I moved inside a new folder do not get synced (p4 sync -f works though). But I do not want to use p4 sync -f on the entire workspace, as it would resync the unchanged files as well.
I am sorry if this question has been answered before, I am pretty new to perforce, so maybe could not find the correct terms to search for.
The ... path limits the scope of each operation to the current directory; if you ran those commands from a different directory than the one you moved the files to, that may be why they didn't get synced. I'd do:
p4 revert //...
p4 clean //...
p4 sync #L2
I have deleted a directory in a 3rd-party Perforce client. It should have used p4 delete, but I cannot be sure. It was not submitted.
Now:
I don't see the deleted directory in p4v.
p4 revert fails:
p4 revert //depot/path/deleted-directory/...
//depot/path/deleted-directory/... - file(s) not opened on this client.
I cannot force-sync deleted-directory to revert the deletion:
p4 sync -f //depot/path/deleted-directory
//depot/path/deleted-directory no such file(s).
p4 sync -f //depot/path/deleted-directory/...
//depot/path/deleted-directory/file1.txt#2 - deleted as /Users/me/depot/path/deleted-directory/file1.txt
I cannot reconcile them:
p4 reconcile //depot/path/deleted-directory/...
//depot/path/deleted-directory/... - no file(s) to reconcile.
p4 opened doesn't see them:
p4 opened
File(s) not opened on this client.
How do I get this deleted directory into a changelist or at least revert it?
I tried all suggestions from "I've deleted all the files in my directory. How can I get them back?" except for checking out a new workspace, which I will eventually do.
Short answer:
p4 undo //depot/path/deleted-directory/...#head
p4 submit
That will undo the head revisions in that directory (i.e. the deletion) by creating new revisions that are copied from the prior ones.
Longer answer to explain why all the things you tried didn't work:
p4 opened and p4 revert both operate on files that are currently open. If you hadn't yet submitted, then revert would put the files back, but since this deletion was already submitted, there were no open files to revert.
When you force-synced you were just forcing a re-sync to the head revision, which is deleted (just like the files in your workspace), so no matter how hard you force the sync all you're going to get is a lot of nothing. If you had done:
p4 sync "//depot/path/deleted-directory/...#<head"
in order to sync to the revision prior to #head, that would have done the trick. Note that no -f flag is necessary. Once the files were synced to the correct revision, you would also be able to undo the delete by following that sync command with:
p4 add //depot/path/deleted-directory/...
p4 submit
Similarly, reconcile didn't do anything because the files are deleted at the head revision and deleted in your workspace, so there's nothing to reconcile. If you wanted to get really weird with it you could undo the delete via reconcile by using a combination of sync and flush to simulate the condition of having re-added new copies of the files:
p4 sync "//depot/path/deleted-directory/...#<head"
p4 flush //depot/path/deleted-directory/...
p4 reconcile //depot/path/deleted-directory/...
In addition to being unnecessarily complex, this reconcile-based solution will lose the information of which revision the re-added files came from (thanks to the p4 flush), so I would not recommend it. Go with undo and if you're on an old server version that doesn't support that do the normal sync/add thing.
I am a perforce beginner user.
I am writing a script that adds, deletes and edits files and revert all changes at the end.
I tried to do the following to revert all changes:
p4 sync #oldRevision
p4 add
p4 sync
p4 resolve -ay
p4 submit
and this revert all changes and add the deleted files but it does not remove the new added files.
How can I remove the new added file?
I noticed that when I run "p4 sync #oldRevision" the new created file which was not exist in this release are mapped from the latest release and may be this is the issue
Thanks in advance
p4 undo "#>oldRevision"
Or if oldRevision is a changelist, add 1 and use a range. I.e. these two commands are the same:
p4 undo "#>1000" # undo all changes after 1000
p4 undo #1001,#now # undo all changes from 1001 to now
https://www.perforce.com/perforce/r16.2/manuals/cmdref/p4_undo.html
https://www.perforce.com/perforce/r16.2/manuals/cmdref/filespecs.html#filespecs.synopsis.using_revision_ranges
I have deleted some files/folders in my local machine but I did not commit the changes to repository.
How to get the deleted files back?
I am not getting the deleted files after performing the p4 sync -f. Why I am not getting the deleted files after the force sync?
If you haven't reverted the changes Perforce will still think you want to delete those files so won't restore them.
You need to go to the pending changelist and do a "revert" on those files to get them back.
Use the "p4 revert" command:
p4 revert -c default //...
This "revert[s] every file open in the default changelist to its pre-opened state."
Source
If you don't want to revert all the files, move the files you want to revert to a separate changelist and use the "-c" option.
If you only have a few files to revert you can specify the name of the file:
p4 revert lib/libopenssl.a include/openssl.h
for example, reverts exactly those two files (thanks to Bryan).
What is the p4 command to throw away all my uncommitted change in my Perforce workarea?
When using Git, the analogous command is: git reset --hard
If you haven't checked out the files you've edited, first do
p4 reconcile ...
to get the changes tracked by Perforce.
You don't need this if the changes you want to undo are already in any changelist.
Then, from the root of your workspace,
p4 revert ...
(... is the Perforce wildcard for everything under a given directory, not something you have to fill in yourself).
If you also want to delete untracked files from the disk, then if you're using the 2013.2 release or later, you can pass -w to p4 revert to also delete newly added files. See this answer for some background on this option.
The reconcile step would first detect these files and mark them for add, and then the revert step would unmark them for add and delete them. If -w isn't available then there's no clean way to do this and the files will be left untracked and on the disk after the revert.
p4 revert is the command you're looking for.
Remember, if you want to revert a specified changelist just, you must specify its changelist number like:
p4 revert -c changelistnumber
Or, if you are not running it from the workspace root, specify the workspace/client name, like:
p4 revert //myWorkspace/...