[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Submitting svnignore for inclusion in contrib/client-side

From: Christopher Boumenot <boumenot_at_gmail.com>
Date: 2006-11-12 19:14:58 CET

I wanted to submit this simple script for inclusion in subversion. It
was becoming tedious to generate the svn:ingore properties, especially
for files generated by a build. It is really painful if your build
recurses into many directories, and generates a file in each one such as
Makefile.in generating Makefile. I finally wrote a script to
automatically add files to the ignore list.

The script works by running svn status from the current directory. Any
files with a status of ?, are appended to the current ignore list.

It is released under the same license as subversion.

Is there any interest in this?

Regards,
Christopher

#!/usr/bin/env ruby
#
# svnignore: recusively appends files to the svn:ignore property
#
# Run svnignore from the top level directory containing files you want
# to ignore. svnignore will append to your current list of ignores all
# files that report ? from svn status.

require 'tempfile'

h = Hash.new

`svn status .`.each do |line|
     next unless line =~ /\?/
     line.gsub!(/^\S+\s*/, '')

     fn = File.basename(line)
     dn = File.dirname(line)

     h[dn] ||= Array.new
     h[dn] << fn
end

h.each do |k,v|
     puts "Processing #{k} ..."

     tmp = Tempfile.new("svnignore.")
     tmp.write(IO.popen("svn propget svn:ignore #{k}").read().chomp!)
     tmp.write(v.join("\n"))
     v.each { |i| puts " -> #{i}" }
     tmp.close()

     %x{svn propset svn:ignore --file #{tmp.path} #{k}}
end

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 12 19:15:28 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.