Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examining a changeset in HG

Tags:

git

mercurial

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.

like image 702
notnoop Avatar asked Aug 21 '09 15:08

notnoop


People also ask

What is HG changeset?

A changeset (sometimes abbreviated "cset") is an atomic collection of changes to files in a repository. It contains all recorded local modification that lead to a new revision of the repository. A changeset is identified uniquely by a changeset ID.

What does changeset mean in git?

Indivisible simply means that a changeset is one single value in the stack of changes that are being made on a codebase. For example, if you look at a commit, you can check what individual files were modified, what was the previous state of the codebase and after, which would make it adhere to what a changeset is.

What does HG update do?

Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed.


2 Answers

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^ 
like image 175
Steve Losh Avatar answered Sep 18 '22 21:09

Steve Losh


I think you want hg export cset.

like image 27
tonfa Avatar answered Sep 21 '22 21:09

tonfa