Mercurial提交消息和日志,支持哪种编码,Hg是否在乎? [英] Mercurial commit messages and log, what encoding is supported, does Hg care at all?

查看:72
本文介绍了Mercurial提交消息和日志,支持哪种编码,Hg是否在乎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过我的包装库针对Mercurial进行简单的提交,使用Unicode:æøåÆØÅ的简单文本作为我的提交消息.这将写入文本文件,并使用适当的参数提供给Mercurial:

I tried doing a simple commit through my wrapper library for Mercurial, using the simple text of Unicode:æøåÆØÅ as my commit message. This is written to a text file and given to Mercurial with the appropriate parameter:

hg commit --logfile FILE

如果我随后查看带有TortoiseHg的存储库,则会正确再现字符.在控制台上,它们被扭曲了:

If I subsequently look at the repository with TortoiseHg, the characters are reproduced correctly. On the Console, they are mangled:


[C:\Temp] :hg log
changeset:   0:6a0911410128
tag:         tip
user:        Lasse V. Karlsen 
date:        Wed Dec 01 21:48:54 2010 +0100
summary:     Unicode:æøåÆØÅ

如果我将hg log的输出重定向到一个文件,并打开它,则æøåÆØÅ可以正确再现.

If I redirect the output of hg log to a file, and open it up, æøåÆØÅ is reproduced correctly.

所以,我的问题是这样:

So, my question is this:

  • 我可以要求hg直接将日志写入文件,还是必须重定向标准输出?
  • 这会导致控制台的python编码出现问题,即.有些字符会导致hg崩溃,而不仅仅是破坏输出?
  • 我应该遵守的提交消息是否有已知的受支持编码?
  • Can I ask hg to write the log to a file directly, or do I have to redirect standard output?
  • Will this cause problems with python encoding for console, ie. some characters will make hg crash instead of just mangling the output?
  • Is there a known supported encoding for the commit messages that I should adhere to?

还是那么简单:

  • Mercurial不在乎,它接受我提供的文件内容,无论内容如何,​​并将其存储为提交消息.在生成日志时,它会被转回到控制台中,成为Python控制台输出库在这方面的限制吗?

推荐答案

以下内容可能无法解决问题,但可以帮助调试.

The following may not solve the issue but can help debug it.

签出: https://www.mercurial-scm.org/wiki/EncodingStrategy

如果我将hg log的输出重定向到一个文件,并打开它,则会正确地复制æøåÆØÅ.

If I redirect the output of hg log to a file, and open it up, æøåÆØÅ is reproduced correctly.

因此,至少Mercurial正确存储了提交信息.只是混乱了输出.

So at least mercurial is storing the commit information correctly. It is only the output that is messed up.

一些工作正在按照这些思路进行,但与此无关

Some work happening along these lines but not related to this

有关如何处理字符集兼容性问题的最后一段,请参见: https://www .mercurial-scm.org/wiki/CharacterEncodingOnWindows

See the last paragraph on how to deal with character set compatibility problems: https://www.mercurial-scm.org/wiki/CharacterEncodingOnWindows

它说:

  • 设置您的控制台代码页以匹配您的系统代码页
  • 使用环境变量覆盖Mercurial的编码
    • 设置HGENCODING将覆盖检测到的系统字符集.
    • set your console code page to match your system code page
    • override Mercurial's encoding with an environment variable
      • Setting HGENCODING will override the detected system character set.
      • 使用全局--encoding选项将使您可以在每个命令上设置首选编码.
      • 通过完全消除讨厌的控制台,这也消除了问题.
      • 这使比尔·盖茨哭了.

      这篇关于Mercurial提交消息和日志,支持哪种编码,Hg是否在乎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆