How can I examine a changeset in mercurial without looking up its parent? In mercurial, what's the equivalent of
git show HEAD^
Git-show gives the changeset metadata and the diff as well.
Your question has two parts. First, how to get the metadata and diff for a changeset all at once:
hg log --patch --rev tip
You can shorten the options:
hg log -pr tip
The second part of the question is how to say "the parent changeset of X" without looking it up. For that you can use the parentrevspec extension Martin mentioned.
Once you enable the extension you can do:
hg log -pr tip^
You could add an alias to your ~/.hgrc
file if you don't want to retrain your fingers from git's command:
[alias]
show = log -pr
Then you could use:
hg show tip^
A similar command to "git show HEAD^" would be:
hg log -pr -2 # -1 (last commit), -2 - one before it, etc.
OR
hg exp tip^ # tip^ is similar to -r -2
or for instance if you want to look at the last 3 commits (with diff):
hg log -pr -3: # colon means start 3 commits behind and up to tip inclusive
A bit to late with the answer, but still. :)
UPDATE: apparently now HG supports git syntax as well:
hg exp tip^^^..tip
or
hg log -pr tip~4
If you just want to see the contents and differential of a commit, use this:
hg diff -c <the commit hash or bookmark name>
To see the commit you've checked out (HEAD in git), do this:
hg diff -c -1
If you want to see the commit before it (HEAD^ in git), do this:
hg diff -c -2
Simple.
You should also take a look at the parentrevspec extension to enable a more Git-like syntax for specifying revisions.