Re: Gitk feature - show nearby tags
- From
- Marco Costalba <mcostalba@gmail.com>
- Date
- Jun 3, 2006, 11:16 UTC
- Message-ID
- <e5bfff550606030416s2ef6182crbde1395dd29e5b94@mail.gmail.com>
- In-Reply-To
- <7vslmm8rcd.fsf@assigned-by-dhcp.cox.net>
On 6/3/06, Junio C Hamano <junkio@cox.net> wrote:
Show 15 quoted lines
> Paul Mackerras <paulus@samba.org> writes: > > > I just pushed out an update to the "new" branch of the gitk.git > > repository, which adds a feature that I have often wished for: it will > > now show the nearest preceding and following tags when you select a > > commit. This is very useful if you need to identify which release was > > the first to incorporate a particular patch, or if you need to know > > which release a patch might have been based on. > > Another thing that would equally be useful is to show which > branch a particular commit is on, so for example I can pick one > commit while doing "gitk next" to view the next branch and see > which topic it belongs to, and "gitk this-topic" to see which > commits on that topic, if any, are not yet in the "next" branch. >
If I have understood correctly the patch runs a 'git rev-list --all --topo-order --parents' and then does a tree walking.
I am wandering if there exist any native git way to found the previous tag.
As example given a selected revision with id <sha> is it possible to do something like this to fond the ancestor?
1) get the tag list with git-peek-remote or something similar if tags are not already loaded
2) given the tagList vector with n elements run
git-rev-list --topo-order <sha> ^tagList[0] ^tagList[1] .... ^tagList[n-1]
3) take the last sha spit out by git-rev-list, be it <lastSha>.
4) Previous nearest tag is the parent of lastSha
I've missed something?
Marco