public
Created

twistedDocSearch.py

  • Download Gist
twistedDocSearch.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# THIS IS A HAWKOWL SCRIPT
# HERE BE SPIDERS
# (C) HAWKOWL 2014, ORIGINAL CHARACT^W SCRIPT DO NOT STEAL
# (actually it's MIT)
 
# TO USE (you need a git repo):
# $ cd Twisted
# $ svn ls svn://svn.twistedmatrix.com/svn/Twisted/branches/ > branches.txt
# $ python twistedDocSearch.py branches.txt 2> /dev/null | sort | uniq > changedfiles.txt
 
import subprocess, sys
 
f = open(sys.argv[1])
 
for _branchname in f:
 
branchname = _branchname[:-2]
 
try:
 
diffSearch = "trunk..origin/{0}".format(branchname)
logCmd = ["git", "log", diffSearch, "--pretty=oneline"]
 
output = subprocess.check_output(logCmd)
splitOutput = output.splitlines()
hashes = []
 
for item in splitOutput:
tmp = item.split(" ")
hashes.append(tmp[0])
 
diffCmd = ["git", "diff", hashes[0], hashes[-1], "--name-only"]
diffOutput = subprocess.check_output(diffCmd)
 
splitDiffOutput = diffOutput.splitlines()
 
for line in splitDiffOutput:
if line.startswith("doc"):
print line
 
 
except Exception, e:
#print "branch {0} failed".format(branchname)
pass

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.