How to restore perforce from version files? - perforce

I tryed migrate from perforce 2005 to 2010 and failed. I created checkpoint and journal files (with p4d -jc command), copy version files on old machine. But failed restore it on new machine. On first try i get
"Journal file 'journal' replay failed at line 9680!
Bad opcode '' journal record!"
error. I found in journal file zero bytes and remove it. On second try I get error:
"Perforce server error
1 out of sequence journals were not replayed"
What do next? How to repair journal file? Can I restore Perforce database without journal file using only version files?
P.S. Perforce still work on old machine.

Your journal got corrupted at some point. Since perforce is still running on the old machine I suggest you to start the migration over ensuring at each step that nothing got corrupted. For instance look at the journal size after generation, or better make a md5 or an sha1 of it, and check everything is still ok on the new machine. Also ensure that p4d is stopped before copying any file.
Since you upgrade from p4 2005 to p4 2010 you probably have a specific procedure, did you follow it?

Related

VS 2019 don't delete files immediately

I accidentally deleted a wrong file in Visual Studio 2019 before commiting the changes. I lost not a lot of work but I want to prevent this in future.
Can I setup VS 2019 somehow that files are not immediately deleted but kept in a cache for a while?
Supposedly there is already a backup folder which VS uses for deleted files, but this folder was empty in my case. And also the fact that VS moves files into the Windows bin doesn't help me because my repository is not on the system drive.
Do you know about any settings in VS or is there maybe an extension?
Not exactly what you are looking for but this extension could help you. It migth not prevent the deletion, but give you the opportunity to recover the code.
I haven`t tested it and I am also not sure if it will work with VS2019.
A visual source code plugin for maintaining local history of files.
Every time you modify a file, a copy of the old contents is kept in the local history. At any time, you can compare a file with any older version from the history. It can help you out when you change or delete a file by accident. The history can also help you out when your workspace has a catastrophic problem. Each file revision is stored in a separate file inside the .history folder of your workspace directory (you can also configure another location, see local-history.path).
https://marketplace.visualstudio.com/items?itemName=xyz.local-history
The answer here is to use a version control system (like git) and keep a full history of your project.
Even on simple personal projects it is worth doing.

How to the history of files changed on a Rsync server

How can I instruct RSYNC server to keep a copy of the old versions of the files that were updated?
Background info:
I have a simple RSYNC server running on Linux which I am using as a backup of a large file system (many TB). Let's call it the backup server.
On the source server, we run daily:
$ rsync -avzc /local/folder user#backup_server::remote_folder
In theory, no files should be changed on the source server, we should only receive new files. But, nonetheless, it might be possible that some updates are legit (very very seldom). If rsync detects the change, it overwrites the old version of file on the backup server with the new one. Now, here is the problem: if the change was a mistake, I lose the data and do not have the ability to recover it.
Ideally, I'd like that rsync server keeps a backup of the replaced files. Is there a way to configure that?
My backups are local to the same machine (but different drive on a mount point of /backup/)
I use --backup-dir=/backup/backups-`date +%F`/ but then it starts nesting the things rather than having a load of backups-yyyy-mm-dd/ in the /backup/ folder.
If someone has a similar issue, there is a easy solution:
Execute a simple cron that changes access rights in the destination computer.

Migrating Perforce from case-sensitive to case-insensitive

I'll be migrating a Unix Perforce installation to a new (Unix) server with more storage next month. Because we now have a lot of Windows users, I'd like to start up the new server in case-insensitive mode (-C1). According to Perforce, this scenario isn't supported (http://answers.perforce.com/articles/KB_Article/Cross-Platform-Perforce-Server-Migration).
My question: Assuming I can verify that there are no case conflicts among current files and directories in the depot, would restoring a case-sensitive checkpoint using case-insensitive mode work? What if there are deleted files and directories that contain case conflicts? what would happen if a rollback was attempted to a time when case conflicts existed?
As I see it, my only other option for keeping the file histories accessible would be to start the new server with the current file versions. Then on the existing server I'd delete most of the existing user accounts, transfer the license to the new server, and keep the old server around (indefinitely) under the free license model.
Thanks for any help!
Finally got around to preparing for this migration, and I can now state definitively:
p4d will NOT allow you to restore a checkpoint with case-insensitive mode turned on (-C1) if that checkpoint was created in case-sensitive mode on a Linux server.
When you try, it will report an error that the checkpoint was created in case-sensitive mode.

Perforce overwrote code that I forgot to checkout. How do I recover it?

I forgot to check out a source code file before modifying it.
When I get last revision, Perforce overwrote that file, so my work is totally lost.
Is it possible to recover the file?
For future use, update your client workspace so that you specify "noallwrite, noclobber". If noclobber is set, Perforce will not overwrite your writable un-opened files: http://www.perforce.com/perforce/doc.current/manuals/cmdref/client.html
Only if your editor or your operating system saved a copy or it's been modified long enough that it made its way to your backups. Perforce will not make copies of such files, it blindly assumes that you didn't lie and will always honestly tell it when you want to edit a file.
if you are using eclipse then its possible to retrieve the local version using Compare With -> Local history . It helped me.
This has happened to me recently. For some reason, after I "p4 sync"-ed my workspace, and do p4 resolve, I noticed that my changes to a file were missing. I'm not sure if my changes were not saved or I haven't checked out the file. But I really remembered that my changes were saved. :(
I have been using Visual Studio for development and it doesn't have local history unlike in Eclipse. Luckily, that file is a javascript file and I have been testing my application in Internet Explorer. Since IE does some caching on some internet data like js files, what I did is to check the directory where it saves temporarily files (Internet Options -> Browser history settings ) there you'll see different versions of the files saved. I did recover my files! It was really just luck!
After that incident, I installed a plugin for visual studio for storing local history of files everytime it's being saved. http://visualstudiogallery.msdn.microsoft.com/226c2108-9da9-407d-b90d-9783040d27b8
Best thing to avoid these cases is to:
branch out your files first into a separate devline during development and submit every milestones you accomplished
incrementally. In this way you'll always have versions of important
changes you do during development. After this you could
integrate it back to the parent branch/mainline.
http://answers.perforce.com/articles/KB_Article/Branching-Codelines-and-Merging-Changes
Hope this helps!
If you fired the following command (which is a FORCE sync option), only then will Perforce update ALL your files.. including ones which are WRITABLE. The only exception is that any file that you have OPENED in perforce will not be overwritten. So if your file was made WRITABLE using OS command, and not using p4 open.. they will get overwritten by p4 sync -f.
p4 sync -f
The other possibility is that you did p4 sync, and still perforce overwrote your writable files (which were not opened using p4) because your workspace settings don't have noallwrite, noclobber specified. Usually by default, these settings are already specified, so that Perforce doesn't clobber writable files.

Linux SVN recover files

A recent update over unversioned directories removed a bunch of files. Is there a way I can manually recover these lost files?
P.S. I cannot recover them from subversion, as the files I am looking for were never committed to SVN control. I have looked in the linux trash folder, which only contains files which have been manually deleted.
edit: Actually, the files were lost through an accidental svn rm operation. Unfortunately I cannot use revert as the files I am trying to recover were newly created and not under version control yet. Any ideas?
If files were lost during a svn update operation, there's not a lot you can do. I would suggest looking for hidden backup files that your editor may have created (in the directory where the file originally was or in the editor's temporary directory).
If you remember the name of one of the files, you can try using find to see if there's a backup copy of it somewhere on the disk.

Resources