I accidently marked for delete my depo which has thousands of files. but when I try to revert my p4v client hangs and stops working.
I have everything setup on my windows xp virtual machine.
I am trying to use the comand line as follows. (my workspace is 1 to 1 mapped with depo.
Initially i tried other revart varients mentiond on the perforce website : p4 [g-opts] revert [ -a -n -k -c changelist# ] but to no avail.
p4v -c workspace revert -c default //.. and the process has been running for two hours now.
Anyone- any idea on how to revert the mark for deleted files
Related
I have a couple files checked out in Perforce on a different computer that I won't have access to until tomorrow. I received a request to revert them but I'm not sure how to do that from my home computer. I don't see an option and I can't find any results about this for the visual client. Is it even possible?
I ended up finding a suitable solution for myself.
I opened P4V and navigated to my workspaces. I edited the one with the checked out files and changed the workspace root and host to be from my current computer. After applying that, I was able to revert them as I normally would from the P4V client.
p4 revert takes as an option the client name, i.e workspace name.
From P4V>File> Open Command window here and try :
p4 revert -C *yourotherworkspace* -c changelist //...
If this is not enough you might have to add some global options settings like :
p4 -H remote_computer_name revert -C *yourotherworkspace* -c changelist //...
After a while of working with perforce I was left with a lot of still open change lists.
To clean up I want to get rid of a subset of them.
So here is what makes this complicate:
For a subset of the changes the host of the client has changed.
Some changes contain shelved files.
Files from the change list may be deleted or moved.
When one or more of above points are true for a change list, p4v (the visual client) will not allow you to delete the change list.
So what is an effective way of deleting these change lists?
First of all, perforce refuses to work on any change lists if the host differs in their workspace. So step one is to change the host of the workspace to the current one. This can easily be done with the visual client p4v. Open the properties of a workspace, choose edit and change the host.
Then you can use the command line to get rid of the pesky change list(s):
# to delete a changelist
CLIENT="name_of_your_client"
CHANGE="number_of_the_changelist_to_delete"
p4 -c $CLIENT shelve -c $CHANGE -d //... # Delete all shelved files from it.
p4 -c $CLIENT revert -k -c $CHANGE //... # Revert all files from changelist (only metadata).
p4 -c $CLIENT change -d $CHANGE # Finally delete the changelist.
After the last command the change list will be gone forever.
Fixing the hostname can be done from the command line like this:
client_hostname="$(p4 client -o ${CLIENT} | grep "^Host" | awk '{print $2}')"
p4 client -o ${CLIENT} | sed "/^Host:/ s=${client_hostname}=${HOSTNAME}=" | p4 client -i
Had the same problem some time ago and wrote a script (p4-delete-changelist) that overcomes all of these problems (and another one - deleting p4 fixes).
Note that the script depends on another file in the repository.
My workflow for testing my changes to our source code on a remote machine is the following:
1) On local machine: Shelve changes that I'd like to test
2) On remote machine (ssh):
$ p4 revert //...
$ p4 sync
$ p4 unshelve -s <changelist number>
$ ./run_test_scripts
This seems to work fine when I've only made changes to files that already exists. If I've added new files these will be created during p4 unshelve, but not deleted during p4 revert. The documentation says that this is what p4 revert does so it isn't unexpected, but causes some problems if I want to test the same files again:
$ p4 revert //...
<some file>#none - was add, abandoned
$ p4 sync
File(s) up-to-date.
$ p4 unshelve -s <changelist number>
Can't clobber writable file <some file>
Is there way I can delete the files abandoned Perforce?
I think what you're looking for is p4 revert -w. From the help:
The -w flag causes files that are open for add to be deleted from the workspace when they are reverted.
Note: I'm using the 2013.2/719516 client against a 2013.2/708877 server, in case that switch was added recently...
Edit: just reread your question - this is a workaround, perhaps not a full solution...
There is a setting in P4Win that allows you to overwrite files when unshelving:
Overwrite workspace files even if they are writeable
I normally use that in combination with another option (again in the gui):
Revert checked our files before unshelving
They solve my problem.
Looking in the console output while running this from the gui, it looks like it is the -f parameter in the unshelve command.
p4 unshelve -s <changelist> -f -c <changelist> <files>
I'm new to Perforce and, to be honest, I'm hating it.
I had about 20 files in my c:\workspaces\perforce directory and I selected all of them and hit the delete key.
They were all checked in before I deleted them.
I've been pulling my hair out trying to figure out how to get them back (Perforce is sooooo unintuitive) but there's nothing that stands out to a n00b like me to.
How can I get the latest revisions back into the directory from Perforce?
You need to do a force sync.
On the command line:
$> p4 sync -f
In the P4V GUI:
Right-click on the directory to update
Select 'Get Revision'
In the dialog, check 'Force operation'
Click 'Get Revision'
The perforce server keeps track of which files you pulled in last time. This is done so that, the next sync only brings in the files which have changes since the last sync, instead of all the files once again.
To override this behavior, you need to use the -f option.
The -f flag forces resynchronization even if the client already has
the file, and overwriting any writable files. This flag doesn't
affect open files.
If you're using the command line client, you can run this command from the directory where you want to sync up:
p4 sync -f ...
You might also want to check the list of opened files, since sync -f will not be bringing in changes corresponding to those files (even if you have deleted them).
This command should list all the opened files:
p4 opened ...
If you have any files listed in the above list, which you had deleted as well, you should revert them before running sync -f.
p4 revert <FILE1> <FILE2>
p4 sync -f ...
If you're using p4v, you could follow the steps mentioned by dwinkle:
1. Right click the folder in your workspace
2. Choose `Get Revision` in the context menu.
3. Choose `Get Latest revision`
4. Check `Force Operation (replace file even if you already have the revision specified)
5. Click on `Get Revision` button to fetch the files.
To look at the list of opened files using p4v, you would have to look at your list of pending changelists. You should be looking in the default changelist, if you have not put the files in any speficic changelist. Right click on files that you see there that you had deleted earlier, and choose Revert.
if you have files checked out, and then deleted. You need to revert(p4 revert -a //...) the folder before you get latest forced (p4 sync -f).
An alternative:
p4 reconcile
p4 revert //...
If you don't care about the old client, one solution would be to pull down a new client:
p4 newclient
p4 sync
If you want the client to have the same name, you can do a forced sync as others have mentioned:
p4 sync -f
If you want the client to have the same name, but your directory is no longer recognized as a p4 workspace, you will need to delete the client and then recreate it.
p4 -c <client_name> client -d <client_name>
p4 newclient
Right click on parent directory.
Click "Reconcile" in context menu.
Let a new change list be created.
Right click changelist.
Revert change.
In my case I tried everything and I couldn't get all of my files to revert, so I tried deleting them and then I couldn't get all of them back. I restarted my pc, and tried numerous solutions found online. In the end my problem was solved by one or all of the following: upgrading to the latest P4V application, running the application with elevated permissions, and going to lunch after forcing get latest.
If you wasted half of a day. You may want to try the above.
I've deleted all the files in my directory. How can I get them back?
One wrinkle to this that I just stumbled over is that if you remove the directory you can't just use p4 sync -f to get it back. I wanted a complete clean version of the directory so I did a:
rm -rf directory1
However when I did a p4 sync -f directory1 on it, it spits out:
directory1 - no such file(s).
What I found that works is to recover a file inside of the directory first:
p4 sync -f directory1/some-file
You will have to know the name of one of the files inside of the missing directory which you can get using:
p4 files //depot/some/path/directory1/\*
Once you get one of the filenames, do:
p4 sync -f directory1/some-file
This should create the directory1 directory. Then you can do a full sync inside of the created directory:
cd directory1
p4 sync -f ...
Hope this helps someone else.
I wanted to change the path of mapping in perforce client
For ex:
//depot/a/... /home/user/xyz/...
to
//depot/a/... /home/user/p4/xyz/...
After changing the path using p4 client, I have deleted folder xyz using rm -rf.
Then ran p4 sync but I think some files are not getting synced to new path p4/xyz/.
The server thinks that the workspace/client already has the #head revision of these files and does not need to sync them again.
You can try using -f option to force a refresh however that is taking a hammer to problem that just needs a pair of pliers.
I would try a p4 sync -k //depot/a/...#none to update the server 'have' list. Type [p4 help sync][1] for more information about the command.
Try using the force (-f) flag. See documentation.
There should also be a checkbox in the GUI, if you're using the visual client.
Same problem here and none of the solution worked. It turns out that file I was trying to sync was p4 opened. Once I reverted that back using p4 revert it synced back.
Below solution works for me.
p4 sync -f //depot/a/...
What I did is,synced the whole base directory,directory which contains all my files and folders.
-f is necessary because it will actually copy, which doesn't happen in normal sync situation(try doing ls on file for confirmation).
In case of a single file rm -rf situation you can do
p4 sync -f path/to/file