Created
January 4, 2014 12:40
-
-
Save KayEss/8255030 to your computer and use it in GitHub Desktop.
Some Python code for parsing the output of the `svn log` command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import subprocess | |
import sys | |
REPO="file:///var/backups/fsl-svn/felspar/" | |
def capture(args): | |
print args | |
return subprocess.check_output(args) | |
def log(path): | |
location = os.path.join(REPO, path[1:]) | |
logdata = capture(['svn', 'log', '-v', '--incremental', location]).split('-'*72) | |
for logitem in logdata: | |
lines = logitem.split('\n\n') | |
meta = lines[0].split('\n') | |
if len(meta) > 2: | |
print '-' * 72 | |
print meta[1] | |
for change in meta[3:]: | |
details = change.strip().split(' (') | |
change = details[0][2:] | |
print details[0][0], change[1:] | |
log(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment