Skip to content

Instantly share code, notes, and snippets.

@plexus
Created December 16, 2011 09:01
Show Gist options
  • Save plexus/1485222 to your computer and use it in GitHub Desktop.
Save plexus/1485222 to your computer and use it in GitHub Desktop.
svn log, one line per commit
#!/usr/bin/awk -f
# Convert the "svn log" output into a one liner format, which is easier to grep
# or use in scripts. Pipe "svn log" into this script
# When we get a line that starts with a revision number, put the data in variables
/^r[0-9]+/ {
rev=$1
user=$3
date=$5
time=$6
lines=13
}
# Anything that isn't a revision line, a separator line or an empty line
# will be part of the commit message. Concatenate these into the comment variable
! (/^r[0-9+]/ || /^-+$/ || /^$/) {
comment = comment $0
}
# With every separator line, output what we stored before and reset the comment variable
# To skip the first line we also check if we've already stored a revision
/^-+$/ && rev {
print rev " | " user " | " date " | " time " | " comment
comment = ""
}
@tomjenkinson
Copy link

Great, thanks!

@gerrich
Copy link

gerrich commented Mar 15, 2013

nice

@s3v1
Copy link

s3v1 commented Oct 8, 2014

Nicely done, it works great for me, even under cygwin

@PandaEox
Copy link

thumbs up

@scue
Copy link

scue commented Mar 30, 2015

Thx

@clippered
Copy link

cool, thanks

@zhangys-lucky
Copy link

thanks

@bddppq
Copy link

bddppq commented Dec 9, 2015

lines should be $lines at line 12

@hxgdzyuyi
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment