"Translation of file content failed..." error in Perforce - perforce

I have the following error message in when submitting from my perforce client (p4v):
Translation of file content failed
near line 1 Submit aborted -- fix
problems then use 'p4 submit -c 22'.
Some file(s) could not be transferred
from client.
I don't know what it means or how to solve the problem.

The real porblem is the encoding, set the encoding to UTF-8 using the "Connection -> Choose Character Encoding..." menu item fixed the problem

Perforce may be confused as to the file's type. Perhaps this is a binary file that Perforce thinks is text? Right click on the file and select the "Change Filetype..." item. This will open a dialog that allows you to change the file's type. Make sure it is set correctly and submit the file again.

FWIW, this issue just occurred to me and I was unable to revert any files or perform pretty much any operation. Even removing files from workspace and then trying to get them again caused the translation of file content error. This issue started happening for me after P4V crashed.
To fix it, I just went to Connection > Choose Character Encoding and clicked OK on the dialog box (did not change the encoding to anything else - kept it what it already was) and that fixed it for me.

This problem can also occur when the file doesn't actually exist on disk. A couple of scenarios can play into this.
You open a file for 'add' before the file actually exists on disk. This is possible and allowed by Perforce. If you 'p4 add' a file before it exists and then try and submit the changelist before you actually put a local file in place, you will get this error.
You open a file for 'edit' and then by some mechanism, delete the file locally before you submit. Again, when submitting, you will see this error.
Honestly, I'm a bit surprised that the error indicated in the original question was due to a filetype mismatch. I've never seen that be the case. In case (1), a file that is 'p4 add'ed will be added as type 'text' by default if a file doesn't exist on disk. If the file was supposed to be a binary file, that would indicate a type mismatch, but that's not the cause of failure to transfer the file from the client. It's the fact that the file doesn't exist.
Anyway, that's my experience. I figured that i would share the cases where I've seen this error.

Related

Out of date files must be resolved or reverted | Perforce

I am a Perforce beginner (and a coder beginner to be frank). I got this error message when I Checkout → Submit. I would like to try to solve these out of date files, but what and where are they? Any advice would be great, thanks!
Log does not seem to show any list of "out of date files"
Look at changelist 51 in the "Pending" tab. If there are any files with question marks next to them, they require a resolve (that's where you combine the changes in your workspace with newer changes from the depot). You can resolve all outstanding files by just right-clicking changelist 51 and selecting "Resolve..."; it will iterate through all the necessary resolves automatically.
If that doesn't fix it, you should be able to get a better error message by going to the command line and running the p4 submit -c 51 command suggested by the error message. The submit will fail for the same reason, but at the command line you should be able to see the list of files that were included in the changelist, which ones failed to submit, and more information about why. (For example, if a file has been deleted and you were trying to edit it, an edit makes no sense and you need to revert it and/or reopen it as a re-added file -- the error messages at the command line will give you more information about cases like these.)

Perforce not downloading file even with forced Get Revision

After too much time of searching what could be the cause of a really strange but simple-looking problem and not finding anything on the internets, I came here to dip in the knowledge of the people of StackOverflow. Here is my situation:
In P4V, I right-click on a file > Get Revision... > Get latest revision selected, with Force Operation (replace file even if you already have the revision specified) checked.
But then, in the console panel: file(s) up-to-date. no files updated
What is going on? What is the Force Operation option for, if it doesn't force the operation?
The red check mark indicates that the file is open for edit (or “checked out” in P4V’s parlance), which protects it from being updated by a sync operation (that’s “get” to P4V). The “force” sync option will overwrite a file that’s manually been made writable, or a file whose contents have accidentally gotten out of sync with the depot through some other misadventure, but it will not overwrite a file that has been explicitly opened for edit, since an opened file is assumed to have local changes that have not been submitted.
Right-click the file and “Revert”. That will explicitly discard your local changes and return the local file to its state as of the last time you synced it from the depot.

What does "tampered with before resolve" mean on file resolve?

I'm trying to merge main stream to development stream and some files need to be resolved. On resolve I have an error:
filepath tampered with before resolve - edit or revert.
I tried to solve it as described here, but without success.
This is what verify command shows me:
for the target
filepath - branch change 9070 (text) A3269695246A89D21F341D8A5BB70B5B
for the source
filepath - edit change 22793 (text) 171BA2F3E0FFCEF3F7A34FDB7A2CEF69
filepath - add change 9049 (text) A3269695246A89D21F341D8A5BB70B5B
What do branch change, edit change, add change mean? Why is the MD5 identical but I still have an error? How to solve?
Perforce's client-server architecture is confusing you a bit here: the 'verify' command is reporting on the state of the files on the server, but the 'tampered with before resolve' message from 'p4 resolve' is alerting you to a problem with the state of the files on your client.
It appears, from the little bit of information that you provided, that:
Change 9049 added the source file, with digest A3269...
Change 9070 branched that source file to the target. Of course, the digest is the same for source and target, since the branch was a perfect copy of the file.
Change 22793 modified the source file, and hence its digest changed
You are then trying to integrate change 22793 from the source to the target.
This integration would be a straightforward "safe resolve" in most cases, because the file was changed only in the source, and the target was a perfect copy of the previous revision of the source.
However, the resolve command looked on your actual workstation copy of the target file, and discovered that the file that you have there is not a file with digest A3269...
Since the 'resolve' command was just about to replace your copy of the target file on your workstation with the merged result, it doesn't want to do that if there is a possibility that you made changes to that file (without opening the file for edit) that you don't want to lose.
So 'resolve' is trying to tell you to have a look at the copy of the target file that is currently on your workstation (using your text editor, e.g.), and see if you actually made changes to that file.
If you did, and you want to save those changes, then you can't perform this integration at this time; you need to instead open the file for edit (using 'edit -k' to retain your modified copy of the file, of course) so that Perforce can merge your edited copy with the changes from change 22793.
If you didn't make changes to the target file, or if you made changes but you don't want them, then you need to discard those changes explicitly, for example by:
reverting the pending integration to the target file
Running 'p4 sync -f target-file'
This is the sort of information that 'resolve' is trying to communicate in that very terse
filepath tampered with before resolve - edit or revert.
I also have faced this issue while executing p4 resolve -am for some file. the solution is to do p4 edit <filename> and then execute p4 resolve -am for that file.
It means that your local was edited without the app knowing about it (e.g., you forgot to do "p4 edit" first). I believe I've seen this when doing an integrate then changing the file before submitting it, too.

perforce doesn't overwrite file when forcing revision

My problem is not the "scary" issue of perforce overwriting my files, but the opposite, that it doesn't.
I want to be synchronized with code other people wrote, so I am doing in perforce: "get revision" and then "force operation" from the stream everyone are submitting their work to (after saving a backup of course for the file I am working on in my computer), but when I open the file in eclipse it remains with my changes.
Further - I am doing some small, deliberate changes in my file, and "get revision" and then "force operation" to it, and the same happens.
I have been working in the same workspace for the last days, and when I did it yesterday it overwrote my files, as expected.
Also, in the "submitted" tab in Perforce this file is not in the list, so I didn't accidentally submitted it somehow.
Also, by opening the file from the File System, my changes remain, so it doesn't seem like a problem with eclipse refreshing or something like that.
Ay idea, anyone?
If the file is recorded as "open" in Perforce (i.e. it is returned by the "p4 opened" command, or it appears in the "pending changes" tab in the GUI), even a force-sync won't overwrite it, because you're still working on it. If you want to discard your changes to get something someone else submitted, do one of these two things:
Sync as normal, then resolve with "accept theirs".
Sync as normal, then revert. (Or revert, then sync.)
The first option leaves the file open; the second option does not.
If you want to save a backup of your current work in Perforce (without submitting it), rather than making a local copy of it, you can "shelve" the pending changelist, and "unshelve" it at a later date to return your workspace to the shelved state.

TFS error Could Not Find File [ProjectName].vsmdi

This error when doing our first checkin is preventing us from adding the solution to TFS. Not sure how to resolve it.
This error generally means that there is a pending change to a file that does not exist on disk.
So for whatever reason, your VS has told TFS that is is making a change to the file [ProjectName].vsdmi. Subsequently, that file has been deleted from the disk. So when VS goes to do the checkin, it tries to check in [ProjectName].vsdmi but it doesn't exist on the disk. So you get the error.
Either
Undo the pending change and check in again
Find out whether you actually need that file (a vsdmi hile is related to the VS unit tests projects) and try to recover it.
I solved this a different way for a Class.cs file. The file existed on disk, TFS/VS could not find it for some reason.
Copied the file out of VS (to Notepad)
Deleted the file in Visual Studio
Re-created the file in VS by right clicking add->new.
Pasted back in and saved.
This worked.

Resources