简体   繁体   English

如何从命令行查看单个Mercurial提交?

[英]How to view a single Mercurial commit from the command line?

I would like to view from the commandline what was changed in given Mercurial commit similar to what one would see from hg status or from the TortoiseHg tool. 我想从命令行查看在给定Mercurial提交中所做的更改,类似于从hg status或TortoiseHg工具中看到的更改。 The closest I can seem to get is hg log --stat but that prints extra symbols (ie pluses and minuses) and I cannot specify at which specific revision I want to look. 我似乎能得到的最接近的是hg log --stat但是它会打印出额外的符号(即加号和减号),并且我无法指定要查看的特定修订版。

I need this because I have developers who have check-in comments like "." 我需要这样做是因为我有一些开发人员,他们的签到注释如“。”。 or ",". 要么 ”,”。 >:-( > :-(

It turns out that hg status has a --change argument where you can pass the revision number (eg 109), relative revision (ie -1 is last commit, -2 is second-last, etc), or the hash of the revision to it and it will print out the changes (ie additions, removals, and modification) that revision had. 事实证明, hg status具有--change参数,您可以在其中传递修订号(例如109),相对修订(即-1是最后一次提交,-2是倒数第二等等)或修订的哈希值到它,它将打印出该修订版所做的更改(即添加,删除和修改)。

--change isolates that revision and shows just from that revision, but replacing --change with --rev shows the cumulative effect since that revision to the current state. --change隔离该修订并仅显示该修订,但是用--rev替换--change --rev显示自该修订到当前状态的累积效果。

hg log -v -r <changeset>

changeset:   563:af4d66e2bc6e
tag:         tip
user:        David M. Carr <****>
date:        Fri Oct 26 22:46:02 2012 -0400
files:       hggit/gitrepo.py tests/test-pull.t
description:
pull: don't pull tags as bookmarks

or, using templates, something like 或者,使用模板,例如

hg log -r tip --template "{node|short} - files: {files}\n"

with output 带输出

af4d66e2bc6e - files: hggit/gitrepo.py tests/test-pull.t

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM