How do I tell TortoiseHg that a file is not binary?
Someone has recent开发者_JAVA技巧ly added a PowerShell (.ps1) script to our Mercurial repository. The file is plain text but TortoiseHg seems to think it's binary and displays a message: "File or diffs not displayed: File is binary".
How to I tell TortoiseHg that ps1 files are text and not binary. I'm using version TortoiseHg 2.0.3
The files are encoded in UCS-2 encoding and I used notepad++ to convert it to UTF-8.
Now that's done, mercurial seems to recognises the file as text and performs a diff properly.
It's time I read this again!
It might be worth looking at this, too as UCS-2 seems closely related to UTF-16. According to that link, it super-cedes it but the effort to move Windows to UTF-16 from UCS-2 has been ongoing since before 2000!
Sorry for responding to a post that's so old, but for historical purposes, a few comments are in order.
First, the underlying code repository (mercurial) treats all files as binary as far as revisions go. All that you're losing here is the ability to see the differences, the physical differences are still tracked, and the nature of those changes aren't any larger by virtue of the fact that Tortoise can't display them. (JPEG binary files, by contrast, have large binary differences even for small pixel changes; whereas these files will have relatively small differences.)
Second, even though Tortoise can't display the differences, kdiff3 can if you set up your mercurial.ini file appropriately. In your home directory, you likely have a mercurial.ini file, even if just to record your username. If you expand it out to include merge-patterns. Look here for merge-patterns: http://www.selenic.com/mercurial/hgrc.5.html.
There, you'll see how to tell mercurial that differences in these files should be displayed with kdiff3, even though mercurial believes them to be binary. Tortoise still won't display the differences on the workbench, but you can right-click the file and show differences to parent, and you'll see the differences just fine. It ain't perfect, but it's better than nothing.
Using notepad++ helps with converting UCS-2 encoding to the UTF-8.
However, when I use it, for example, to convert XML (Visual Studio csproj) file, do not forget to change the XML encoding from utf-16 to utf-8, like:
<?xml version="1.0" encoding="utf-8"?>
精彩评论