#!/bin/sh - # $Id$ # # Copyright (C) 2009-2011 Internet Systems Consortium ("ISC") # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. # # This script grovels the log from a Subversion repository, looking # for deletion events, to make it easier to figure out what revision # number to specify when pulling deleted content from the repository. # # The contortions to insert XSL commands into the XML stream produced # by Subversion are a bit odd, but avoid the need for temporary files. # We use awk and xsltproc because they're fast. svn log --xml --verbose ${1+"$@"} | awk ' { print; } NR == 1 { print ""; print "]>"; print ""; } NR == 2 { print ""; print " "; print " D"; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print ""; } ' | xsltproc - | sort -k 2 | awk '{ printf "%6d %s %s\n", $2, $1, $3 }'