Could TFS plug-in check Eclipse vs. TFS file encoding and add problem marker if they are different?

Proposed Answer Could TFS plug-in check Eclipse vs. TFS file encoding and add problem marker if they are different?

  • 19 April 2012 18:52
     
     

    We have numerous projects in TFS and I have recently discovered that there have been many file checked in over the years that have an incorrect file encoding set in TFS.  This is especially a problem when a source code file has binary encoding set because TFS will not allow merging to run anymore.

    Is it possible to update the TFS plug-in for Eclipse to inspect the Eclipse perceived file encoding and generate a problem marker when it differs from the TFS encoding that is set?  Without an automated check, it is very time consuming to walk through a project and bring up the properties sheet to view the TFS encoding.

    Also, it save several clicks if you could replace the "Encoding:" static label and "Set Encoding..." button on a TFS item's property sheet with the drop-down for setting the encoding that is part of the modal dialog that pops up when clicking the button.

Semua Balasan

  • 30 April 2012 13:34
    Pemilik
     
     Saran Jawaban

    Sorry, there's currently no such feature in the TFS plug-in for Eclipse.  We have an item on our feature backlog to detect encoding changes and pend them as changes.

    A possible solution to your problem would be to decide on a standard encoding for all files (like UTF-8) and convert all the source files and TFS encodings at once.  Developers can configure Eclipse to use that standard encoding (Preferences, General > Workspace > Text file encoding) so new files are correct.  Converting the file contents depends on the tools you're using, but can probably be automated.  Changing all the TFS file encodings can be done with one recursive CLC command like "tf checkout -r -type:utf-8 src/*.java".

    You could also write a check-in policy that checks that the Eclipse resource's encoding matches the TFS encoding before allowing the check-in.  The PendingChange object contains the file's encoding and you can easily query Eclipse for a resource's encoding.