Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can hg log show only the ancestors of a given revision?

Tags:

mercurial

One thing I really miss moving from svn to mercurial is that mercurial's hg log command insists on showing all history rather than only the history of my current working revision.

For example, I'm working on a repo with a lot of check-ins to another head within my branch, and the first 20 log entries have nothing to do with my line of development.

There are a bunch of options to hg log, but...
--rev shows the revision asked for but not its ancestors
--branch doesn't work because the active head is in the same branch as mine
--prune removes all ancestors of the other head, even if they're also my ancestors
--user doesn't work because I'm not the only user in this line of development

I guess I could hg strip, but that seems like overkill...

Thoughts?
Ryan

like image 929
Ryan Avatar asked Oct 07 '10 13:10

Ryan


People also ask

What does HG update do?

Description. Update the repository's working directory to the specified changeset. If no changeset is specified, update to the tip of the current named branch and move the active bookmark (see hg help bookmarks). Update sets the working directory's parent revision to the specified changeset (see hg help parents).


1 Answers

If you've got Mercurial 1.6 or later, you can use revsets to do this:

hg log --rev "ancestors(.)"
hg log --rev "reverse(ancestors(.))"  # Output in the same order as vanilla hg log
like image 173
Niall C. Avatar answered Sep 16 '22 14:09

Niall C.