Re: GIT and the current -stable

Uwe Kleine-König
2007-04-14T11:56:07Z

[-- Attachment #1: Type: text/plain, Size: 1314 bytes --]

Hello Rene,

Rene Herman wrote:
> each time that a new -stable is released. Rather though, I'd like a simple
> "git pull" to do this while on this branch while a "git pull" while back on
> the master branch pulls from the originally cloned Linus repo again.
>
> Is this possible? Do I want it to be? Comments like "work like this
> instead" welcome as well; figuring out what the heck it is that I want from
> git seems to be one of the most difficult questions to answer...
Chris' mail made that somehow superfluous but anyhow. I have a Python
script to update my Linux tree. It's attached.

It automatically adds
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.x.y as a
remote as soon as v2.6.x is seen in Linus' repo and then fetches 2.6.16,
2.6.(last - 1) and 2.6.last. If you want to fetch all, change

for stable in (16, last_stable - 1, last_stable):

in

for stable in xrange(16, last_stable + 1):

The location of the repo is hardcoded to $HOME/gsrc/linux-2.6, but I
think everyone with a bit of intuition should be able to change that ...

So it's not a "git pull" for me, but "update-linux".

Best regards
Uwe

--
Uwe Kleine-König

main(){char*a="main(){char*a=%c%s%c;printf(a,34,a,34%c";printf(a,34,a,34
,10);a=",10);a=%c%s%c;printf(a,34,a,34,10);}%c";printf(a,34,a,34,10);}

[-- Attachment #2: update-linux --]
[-- Type: text/plain, Size: 1832 bytes --]

#! /usr/bin/env python

import os, re, subprocess, sys

silent = False

git_dir = os.path.join(os.getenv('HOME'), 'gsrc', 'linux-2.6', '.git')
os.putenv('GIT_DIR', git_dir)

devnull = open('/dev/null', 'w', 0)
if silent:
subprocess_stdout = devnull
else:
subprocess_stdout = None

if not silent:
print 'fetch origin'
subprocess.call(['git-fetch', 'origin'], stdout=subprocess_stdout)

sp_describe = subprocess.Popen(['git-describe', 'origin'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
sp_describe_stdin, sp_describe_stderr = sp_describe.communicate()

re_linuxver = re.compile('v2\.6\.(?P<minor>\d+)(?P<stable>\.\d+)?(?P<rc>-rc\d+)?(?P<git>-g[0-9a-fA-F]+)?')
mo = re_linuxver.match(sp_describe_stdin)

if not mo:
print 'cannot parse version of origin\'s HEAD'
sys.exit(1)

modict = mo.groupdict()

if modict['rc'] and not modict['stable']:
last_stable = int(modict['minor']) - 1
else:
last_stable = int(modict['minor'])

for stable in (16, last_stable - 1, last_stable):
if subprocess.call(['git', 'repo-config', 'remote.v2.6.%d.y.url' % stable], stdout=devnull) != 0:
subprocess.call(['git', 'repo-config', 'remote.v2.6.%d.y.url' % stable, 'git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.%d.y.git' % stable])
subprocess.call(['git', 'repo-config', 'remote.v2.6.%d.y.fetch' % stable, 'refs/heads/master:refs/remotes/stable/v2.6.%d.y' % stable])
subprocess.call(['git', 'repo-config', 'branch.v2.6.%d.y.remote' % stable, 'v2.6.%d.y' % stable])
subprocess.call(['git', 'repo-config', 'branch.v2.6.%d.y.remote' % stable, 'v2.6.%d.y' % stable])
subprocess.call(['git', 'repo-config', 'branch.v2.6.%d.y.merge' % stable, 'refs/heads/master'])

if not silent:
print 'fetch v2.6.%d.y' % stable
subprocess.call(['git-fetch', 'v2.6.%d.y' % stable], stdout=subprocess_stdout)