Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refer to a mercurial revision relative to a named revision

In git, you can do refer to revisions by something like master^^, meaning two revisions before master. Can you do the same in Mercurial in some way (or with some extension)? For example, if I want to do "the revision before tip", something like tip^.

edit: Rafa mentions hg parents which works for 1 level deep. How do I do it for arbitrary levels deep.

like image 516
Paul Biggar Avatar asked Aug 23 '10 11:08

Paul Biggar


1 Answers

For commands that have options to specify a revision, use -r -2 for the revision prior to the tip, -r -3 for the revision before that, etc.

From hg help revs:

A plain integer is treated as a revision number. Negative integers are treated as sequential offsets from the tip, with -1 denoting the tip, -2 denoting the revision prior to the tip, and so forth.

There is also the ParentrevspecExtension that allows you use syntax like: tip^ for the parent of tip, tip^^ for its parent, etc.

like image 68
Niall C. Avatar answered Oct 02 '22 18:10

Niall C.