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

106 Views Asked by At

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. The closest I can seem to get is hg log --stat but that prints extra symbols (i.e. pluses and minuses) and I cannot specify at which specific revision I want to look.

I need this because I have developers who have check-in comments like "." or ",". >:-(

2

There are 2 best solutions below

1
On

It turns out that hg status has a --change argument where you can pass the revision number (e.g. 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 (i.e. additions, removals, and modification) that revision had.

--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.

0
On
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