[kernel-sec-discuss] r1646 - scripts
Michael Gilbert
gilbert-guest at alioth.debian.org
Tue Dec 15 02:12:01 UTC 2009
Author: gilbert-guest
Date: 2009-12-15 02:12:01 +0000 (Tue, 15 Dec 2009)
New Revision: 1646
Modified:
scripts/find-commit
Log:
find-commit:
- refactor git pull code so that it actually works
- preselect only interesting log files with grep before full search
(searches are now about 100x faster)
Modified: scripts/find-commit
===================================================================
--- scripts/find-commit 2009-12-14 22:50:49 UTC (rev 1645)
+++ scripts/find-commit 2009-12-15 02:12:01 UTC (rev 1646)
@@ -19,6 +19,7 @@
import os
import sys
+import urllib
import tempfile
if ( len( sys.argv ) < 2 ):
@@ -56,9 +57,12 @@
fread = open( './.git/refs/heads/master' , 'r' )
local_hash = fread.readline().strip( '\n' )
fread.close()
-pipe = os.popen( 'git ls-remote .' )
-remote_hash = pipe.readline().split()[0]
-pipe.close()
+fread = urllib.urlopen( 'http%s/packed-refs' % giturl[3::] , 'r' )
+split = [ '' , '' ]
+while ( split[1] != 'refs/heads/master' ):
+ split = fread.readline().strip( ' \n' ).split()
+remote_hash = split[0]
+fread.close()
if ( local_hash != remote_hash ):
if ( os.system( 'git pull' ) != 0 ):
sys.exit( 1 )
@@ -100,7 +104,10 @@
# search thru the generated files for text of interest
foundtext = False
-for fname in fnames:
+pipe = os.popen( 'grep %s %s*' % ( sys.argv[1] , rootname ) )
+pline = pipe.readline()
+while pline:
+ fname = pline.split()[0].rstrip( ':' )
fread = open( fname , 'r' )
line = fread.readline()
while line:
@@ -116,3 +123,5 @@
foundtext = True
line = fread.readline()
fread.close()
+ pline = pipe.readline()
+pipe.close()
More information about the kernel-sec-discuss
mailing list