Previous revision

Greg Ward greg-hg at gerg.ca
Sat Jun 20 20:00:15 CDT 2009


On Sat, Jun 20, 2009 at 8:16 PM, Krzysiek
Pawlik<krzysiek.pawlik at people.pl> wrote:
> I was missing simple way of showing diff for specific revision, it can be done
> with for example `hg diff -r 852:853' or `hg log -p -r 853' -- but the first
> requires typing a lot of numbers and is error prone (especially when repository
> hits revisions >=10000), the second one displays log entry which is not needed
> when you're interested in diff only.

Sounds like you're looking for the 'parentrevspec' extension:

"""
parentrevspec extension - use suffixes to refer to ancestor revisions

This extension allows you to use git-style suffixes to refer to the
ancestors of a specific revision.

For example, if you can refer to a revision as "foo", then:

- foo^N = Nth parent of foo
  foo^0 = foo
  foo^1 = first parent of foo
  foo^2 = second parent of foo
  foo^  = foo^1

- foo~N = Nth first grandparent of foo
  foo~0 = foo
  foo~1 = foo^1 = foo^ = first parent of foo
  foo~2 = foo^1^1 = foo^^ = first parent of first parent of foo
"""

Enable it like any other extension, and off you go.

(Hmmm: another good argument in favour of the just-proposed patch to
make unconfigured extensions more discoverable through the help.)

(Hmmm #2: really, why is this an extension?  How painful/expensive
would it be to move this syntax into core Mercurial?  One of my
biggest annoyances with Subversion was (is!) its inability to subtract
1.  "hg log -p" makes this faaaar less of a problem with Mercurial,
but the "^" syntax is still pretty darn handy.)

(Grain of salt/full disclosure: I don't actually use parentrevspec
myself, so maybe I don't need it as much as I think I do.  Or maybe I
would use it if it were in the core.  ;-)

Greg


More information about the Mercurial-devel mailing list