如何导出mercurial中的评论历史



如果我只想查看更改列表,也许可以将它们交给我的经理,或者将它们编辑为发布说明。我该怎么做?

理想情况下,我想要一个命令:导出修订版X&Y转换为文本文件

如果您真的只需要注释,那么可以使用以下内容:

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

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

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

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

根据您正在执行的操作,您可能还需要:而不是../::范围运算符。二者的区别见hg help revsets

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

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

最新更新