Examining a changeset in HG

前端 未结 5 1879
执念已碎
执念已碎 2020-12-24 06:08

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

5条回答
  •  情歌与酒
    2020-12-24 06:34

    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^
    

提交回复
热议问题