如何在mercurial中导出评论历史记录?

时间:2014-09-22 12:15:04

标签: mercurial

如果我只想查看更改列表 - 可能会将它们提供给我的经理或将其编辑为发行说明。我怎么能这样做?

理想情况下,我想要一个命令:导出修订版X和版本之间的所有评论。 Y成文本文件。

2 个答案:

答案 0 :(得分:3)

如果您确实只需要评论,请使用以下内容:

hg log --template '{desc}\n\n' -r X..Y

其中X和Y分别是起始和结束修订的修订版。如果您需要更多上下文(例如作者,日期,修订ID),请相应地展开模板,例如:

hg log --template 'Author: {author}\nDate: {date|isodate}\nID: {node|short}\n\n{desc}\n-----\n' -r X..Y

有关如何自定义输出的详细信息,请参阅hg help templates

根据您的操作,您可能还需要:而不是.. / ::范围运算符。请参阅hg help revsets了解两者之间的差异。

答案 1 :(得分:1)

你有一个很好的答案,但如果你是传统主义者,你甚至可以使用更改日志格式:

hg log --style=changelog -r X..Y

给你一些类似的东西:

2013-11-29  Chris Jerdonek  <chris.jerdonek@gmail.com>

        * mercurial/parsers.c, tests/test-parseindex2.py:
        parsers: fail fast if Python has wrong minor version (issue4110)

        This change causes an informative ImportError to be raised when
        importing the extension module parsers if the minor version of the
        currently-running Python interpreter doesn't match that of the
        Python that was used when compiling the extension module. Here is an
        example of what the new error looks like:

         Traceback (most recent call last): File "test.py", line 1, in
        <module> import mercurial.parsers ImportError: Python minor version
        mismatch: The Mercurial extension modules were compiled with Python
        2.7.6, but Mercurial is currently using Python with
        sys.hexversion=33883888: Python 2.5.6 (r256:88840, Nov 18 2012,
        05:37:10) [GCC 4.2.1 Compatible Apple Clang 4.1
        ((tags/Apple/clang-421.11.66))] at: /opt/local/Library/Frameworks
        /Python.framework/Versions/2.5/Resources/
        Python.app/Contents/MacOS/Python