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

Re: feature request: git-log should accept sth like v2.6.26-rc8-227

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 11, 2008, 20:35 UTC
Message-ID
<alpine.DEB.1.00.0807112129290.8950@racer>
In-Reply-To
<alpine.DEB.1.00.0807112041470.8950@racer>
Hi,
On Fri, 11 Jul 2008, Johannes Schindelin wrote:
Show 25 quoted lines
> On Fri, 11 Jul 2008, Dmitry Potapov wrote:
> 
> > On Fri, Jul 11, 2008 at 04:58:40PM +0200, Toralf Förster wrote:
> > > 
> > > $> git-log v2.6.26-rc9.. --pretty=short | grep "^commit" | cut -f2 -d' ' | xargs -n 1 git describe | grep '\-56\-'
> > 
> > The fastest way to do the same would be:
> > 
> > git rev-list v2.6.26-rc9.. | xargs git describe | grep '\-56\-'
> 
> You forgot the "--all" option to rev-list.
> 
> And I doubt it would be the "fastest" way, in terms of execution speed.
> 
> Also, it leaves out this case:
> 
> rc9 - A - B - C - D - F
>     \               /
>       ----- E -----
> 
> F would be "rc9-5", but also "rc9-2".
> 
> Oh, and this would leave out reflogs, too.
> 
> Can we please let this concept die now?

Heh, just as an intellectual exercise, I could not resist trying to brush up my l33t py7h0n sk1llz (and I am sure somebody will teach me something useful again):

-- snipsnap -- #!/usr/bin/python

import os import sys

if len(sys.argv) != 2:
	print 'Usage:', sys.argv[0], '<pseudo-describe>'

# split argument dash = sys.argv[1].rindex('-') tag = sys.argv[1][0:dash] generation = int(sys.argv[1][dash + 1:])

# get sha1 of given tag's commit pipe = os.popen('git rev-parse ' + tag + '^{commit}') sha1 = pipe.readlines()[0].strip() pipe.close()

# 'number' will contain (positive) distance to given commit number = dict() number[sha1] = set() number[sha1].add(0)

pipe = os.popen('git rev-list ^' + sha1 + ' --all --parents') rev_list = pipe.readlines() pipe.close()

rev_list.reverse()
for line in rev_list:
	list = line.strip().split(' ')
	number[list[0]] = set()
	for parent in list[1:]:
		if parent in number:
			for n in number[parent]:
				number[list[0]].add(n + 1)
	for n in number[list[0]]:
		if n == generation:
			print list[0]
Previous: Johannes Schindelin
Message 19 of 19 in “feature request: git-log should accept sth like v2.6.26-rc8-227”
  1. Toralf FörsterJul 10, 2008
  2. Junio C HamanoJul 10, 2008
  3. Jakub NarebskiJul 10, 2008
  4. Toralf FörsterJul 10, 2008
  5. Junio C HamanoJul 10, 2008
  6. Johannes SchindelinJul 10, 2008
  7. Junio C HamanoJul 10, 2008
  8. Jakub NarebskiJul 10, 2008
  9. Johannes SchindelinJul 10, 2008
  10. Linus TorvaldsJul 10, 2008
  11. Johannes SchindelinJul 10, 2008
  12. Toralf FörsterJul 11, 2008
  13. Johannes SchindelinJul 11, 2008
  14. Toralf FörsterJul 11, 2008
  15. Dmitry PotapovJul 11, 2008
  16. Toralf FörsterJul 11, 2008
  17. Dmitry PotapovJul 11, 2008
  18. Johannes SchindelinJul 11, 2008
  19. Johannes SchindelinJul 11, 2008

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.