threads / discuss / 42469

Advanced revision selection?

Subject: Advanced revision selection?

## tl;dr

2 messages between May 27, 2016 and May 27, 2016.

replies: 1people: 2as markdown or json

Nikolaus Rath· May 27, 2016, 15:39 UTC · lore
Hello,

Is there a way to specify revision ranges that has more power than what's described in gitrevisions(7)?

For example, is there a way to show "the three most recent commits preceding a tag that starts with "release-" that are also descendants of commit aebecf."?

In Mercurial, this can be done with a more verbose syntax (e.g. "last(ancestors(tag("re:release-.*")),3) and descendants(aebeccf)" for the above example). Is there no equivalent in Git, or am I looking for it in the wrong place?

Best, -Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«
Matthieu Moy· May 27, 2016, 15:59 UTC · re: Nikolaus Rath · lore

Re: Advanced revision selection?

Nikolaus Rath <Nikolaus@rath.org> writes:
> In Mercurial, this can be done with a more verbose syntax (e.g.
> "last(ancestors(tag("re:release-.*")),3) and descendants(aebeccf)" for
> the above example).

This has no direct equivalent in Git. A lot can be done passing options to "git rev-list" or so, for example, but I don't think a combination can be found for your exact example.

The closest I get is:
  git log `git for-each-ref refs/tags/release- --format '%(refname)'` -3
Which lists 3 commits preceeding a tag whose name starts with release-.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

← back to recent threads