You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Christopher Boumenot <bo...@gmail.com> on 2006/11/12 18:14:58 UTC

Submitting svnignore for inclusion in contrib/client-side

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

RE: Submitting svnignore for inclusion in contrib/client-side

Posted by we...@tigris.org.
Great script!  thanks!

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1854481