Search code examples
gitmercurial

Examining a changeset in HG


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.


Solution

  • 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^