Skip to content

Instantly share code, notes, and snippets.

@hawkowl
Created February 2, 2014 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawkowl/8771120 to your computer and use it in GitHub Desktop.
Save hawkowl/8771120 to your computer and use it in GitHub Desktop.
twistedDocSearch.py
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment