Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Dmitry Potapov <dpotapov@gmail.com>
Cc: "Toralf Förster" <toralf.foerster@gmx.de>, git@vger.kernel.org
Subject: Re: feature request: git-log should accept sth like v2.6.26-rc8-227
Date: Fri, 11 Jul 2008 21:35:29 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0807112129290.8950@racer> (raw)
In-Reply-To: <alpine.DEB.1.00.0807112041470.8950@racer>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1833 bytes --]

Hi,

On Fri, 11 Jul 2008, Johannes Schindelin wrote:

> 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]

      reply	other threads:[~2008-07-11 20:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 18:57 feature request: git-log should accept sth like v2.6.26-rc8-227 Toralf Förster
2008-07-10 19:08 ` Junio C Hamano
2008-07-10 19:42   ` Jakub Narebski
2008-07-10 19:52     ` Toralf Förster
2008-07-10 20:03     ` Junio C Hamano
2008-07-10 22:24       ` Johannes Schindelin
2008-07-10 22:52         ` Junio C Hamano
2008-07-10 23:08           ` Jakub Narebski
2008-07-10 23:47           ` Johannes Schindelin
2008-07-10 20:36     ` Linus Torvalds
2008-07-10 19:29 ` Johannes Schindelin
2008-07-11 13:39   ` Toralf Förster
2008-07-11 14:36     ` Johannes Schindelin
2008-07-11 14:44       ` Toralf Förster
2008-07-11 14:44     ` Dmitry Potapov
2008-07-11 14:58       ` Toralf Förster
2008-07-11 19:29         ` Dmitry Potapov
2008-07-11 19:57           ` Johannes Schindelin
2008-07-11 20:35             ` Johannes Schindelin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.00.0807112129290.8950@racer \
    --to=johannes.schindelin@gmx.de \
    --cc=dpotapov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=toralf.foerster@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox