git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Gitk feature - show nearby tags

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Jun 4, 2006, 07:08 UTC
Message-ID
<e5bfff550606040008m4dbf02bdga4f4e6bc2d2fe9d@mail.gmail.com>
In-Reply-To
<17538.16015.53244.876090@cargo.ozlabs.ibm.com>
On 6/4/06, Paul Mackerras <paulus@samba.org> wrote:
Show 37 quoted lines
> Marco Costalba writes:
>
> > If I have understood correctly the patch runs a 'git rev-list --all
> > --topo-order --parents'
> > and then does a tree walking.
>
> Yes, that's right.  It means that gitk can show the nearest tags even
> if they aren't included in the current view.
>
> > I am wandering if there exist any native git way to found the previous tag.
>
> I don't know of any.  Doing the tree walking in Tcl turned out to be
> not too much of an overhead, though; it does the whole kernel
> repository in 1.5 seconds on my G5.
>
> > 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?
>
> I'm not sure exactly what that would do, but gitk can show more than
> one tag (the term "nearest tag" is only a shorthand approximation for
> what it does).  For example, if you have two tagged commits where
> neither is an ancestor of the other, and do a merge of the two, gitk
> will show both tags when you select the merge.
What you suggest we need it's a kind of history of tags.
Currently we can run
git-rev-list --top-order --parents HEAD -- foo.c
and we get an history of file foo.c *with modified parents*
Junio, could be possible have something like
git-rev-list --top-order --parents --tags
with the history of tags ?

And, according to Paul suggestions, not only tags, but merge revisions between tags.

A more general and IMHO very powerful tool could be something like

git-rev-list --top-order --parents --selected-only HEAD -- <sha 1> <sha 2> ..... <sha n>

Where git rev list gives the history, with modified parents, of the given revisions _only_ plus the merging revisions among them.

This could be used for tags (got from git-peek-remote), for branches and in general for a given set of interesting revisions.

Once we have the history of tags, perhaps requested once at startup, we can get the previous tags of a given revision, our original problem, with

git-rev-list --topo-order <sha> ^tagList[0] ^tagList[1] .... ^tagList[n-1] ^merge[0] ... ^merge[k]

And have one or more tags according if results is a rev in tagList or mergeList. Having the tag history it's easy to look up _all_ the tag ancestors.

       Marco
P.S: another use of

git-rev-list --top-order --parents --selected-only HEAD -- <sha 1> <sha 2> ..... <sha n>

could be this:

Currently both qgit and gitk can filter revisions with a given set of filter rules, but the results are shown together with the other revisions or as a list of matching revisions with no useful graph information. We could feed git-rev-list --top-order --parents --selected-only with the list of matching revisions and have a pretty and sensible graph too.

Previous: Paul MackerrasNext: Junio C Hamano
Message 5 of 29 in “Gitk feature - show nearby tags”
  1. Paul MackerrasJun 3, 2006
  2. Junio C HamanoJun 3, 2006
  3. Marco CostalbaJun 3, 2006
  4. Paul MackerrasJun 4, 2006
  5. Marco CostalbaJun 4, 2006
  6. Junio C HamanoJun 4, 2006
  7. Marco CostalbaJun 4, 2006
  8. Junio C HamanoJun 4, 2006
  9. Marco CostalbaJun 4, 2006
  10. Junio C HamanoJun 4, 2006
  11. Junio C HamanoJun 4, 2006
  12. Marco CostalbaJun 4, 2006
  13. Marco CostalbaJun 4, 2006
  14. Junio C HamanoJun 4, 2006
  15. Marco CostalbaJun 4, 2006
  16. Junio C HamanoJun 5, 2006
  17. Marco CostalbaJun 5, 2006
  18. Paul MackerrasJun 3, 2006
  19. Junio C HamanoJun 3, 2006
  20. Paul MackerrasJun 4, 2006
  21. Jonas FonsecaJun 3, 2006
  22. Jakub NarebskiJun 3, 2006
  23. Jonas FonsecaJun 3, 2006
  24. Junio C HamanoJun 4, 2006
  25. Jonas FonsecaJun 5, 2006
  26. Junio C HamanoJun 5, 2006
  27. Junio C HamanoJun 5, 2006
  28. Jonas FonsecaJun 5, 2006
  29. Jonas FonsecaJun 5, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.