Recursively remove .svn directories (ruby script)
require 'find' require 'fileutils' Find.find('./') do |path| if File.basename(path) == '.svn' FileUtils.remove_dir(path, true) Find.prune end end
1160 users tagging and storing useful source code snippets
require 'find' require 'fileutils' Find.find('./') do |path| if File.basename(path) == '.svn' FileUtils.remove_dir(path, true) Find.prune end end
(?m)^@@.*?^(?=@@)
railstrunk app_name
mkdir -p happy_app happy_app/trunk happy_app/tags happy_app/branches svn import happy_app http://myserver/myrepos/happy_app -m "Layout for happy_app" rm -rf happy_app svn co http://myserver/myrepos/happy_app/trunk happy_app railstrunk happy_app
#!/bin/bash rails_dir=~/code/ruby/rails if [ $# != 1 ]; then echo "Usage: $0 app_name" echo echo "Creates a rails application under app_name." echo echo "If app_name is a subversion working copy, rails is set as an external" echo "and generated files are committed." echo echo "If $rails_dir exists, things are sped up by either symlinking it" echo "(for non-versioned apps) or copying it to the vendor dir." echo echo "$rails_dir should be a rails trunk working copy." exit fi dir=$1 mkdir -p $dir cd $dir if [ -n "`ls`" ]; then echo "Can't create app: $dir is not empty." >&2 exit 1 fi if [ -d $rails_dir ]; then if [ "`svn info $rails_dir 2>/dev/null | grep URL:`" != "URL: http://dev.rubyonrails.org/svn/rails/trunk" ]; then echo "$rails_dir is not a rails trunk working copy. Not going to use it." >&2 elif [ -n "`svn st $rails_dir`" ]; then echo "$rails_dir is modified. Not going to use it." >&2 else use_rails_dir=1 fi fi if [ -z "`svn info 2>/dev/null`" ]; then mkdir vendor if [ -n "$use_rails_dir" ]; then ln -s $rails_dir vendor/rails cd vendor/rails svn up cd ../.. else svn co http://dev.rubyonrails.org/svn/rails/trunk vendor/rails fi ruby vendor/rails/railties/bin/rails . rm public/index.html else svn mkdir vendor svn ps svn:externals 'rails http://dev.rubyonrails.org/svn/rails/trunk' vendor svn ci -m 'set rails external to rails trunk' [ -n "$use_rails_dir" ] && cp -r $rails_dir vendor/rails svn up ruby vendor/rails/railties/bin/rails . rm public/index.html rm log/* mv config/database.yml config/database.yml.sample svn add . --force svn ps svn:ignore '*' tmp/cache tmp/pids tmp/sessions tmp/sockets svn ps svn:ignore 'database.yml' config svn ps svn:ignore '*.log' log svn ci -m "- created rails app - moved database.yml to database.yml.sample - deleted public/index.html - ignored logs and tmp" cp config/database.yml.sample config/database.yml fi
#!/usr/local/bin/ruby puts( ( `svn pl -R`.scan(/\S.*'(.*)':\n((?: .*\n)+)/)\ .inject({}) { |h, (d, p)| h[d] = p.strip.split(/\s+/); h }\ .select { |d, ps| ps.include? 'svn:externals' }\ .map { |xd, ps| [xd, `svn pg svn:externals #{xd}`] }\ .map { |xd, exts| exts.strip.split(/\s*\n/).map { |l| xd + '/' + l.split(/\s+/).first } }\ .inject { |a, b| a + b }\ .map { |d| "cd #{d} && svn up 2>&1" } \ << 'svn up . --ignore-externals 2>&1' )\ .map { |cmd| [cmd, Thread.new { `#{cmd}` }] }\ .map { |cmd, thread| "#{cmd}\n#{thread.value}" }.join("\n") )
vi /usr/local/bin/release (and dump snippet into it) chmod +x /usr/local/bin/release cd /path/to/checked-out-trunk release
#!/usr/bin/ruby today = Time.now.strftime('%Y-%m-%d') if `svn info`.to_a[1] !~ /^URL: (.*)\/Trunk$/ puts "Repository invalid. Must be in Trunk." exit end repo_url = $1 repo = repo_url.split('/').last release_url = repo_url + "/Releases" if `svn ls #{release_url}`.to_a.last =~ /#{today}--(\d+)/ num = $1.to_i + 1 else num = 1 end release = "#{today}--#{num}" cmd = "svn copy #{repo_url}/Trunk #{release_url}/#{release} -m 'copy #{repo} trunk to release #{release}'" puts cmd puts print "Execute command? " if gets.chomp.upcase != 'Y' puts "Nothing done." exit end `#{cmd}` puts "Copied as #{release}." puts "Execute on the remote machine:" puts "svn switch #{release_url}/#{release}"
for i in `svn st | grep ? | awk -F " " '{print $2}'`; do svn add $i; done
#!/usr/bin/ruby sign, action, doit = ARGV sign = '\?' if sign == '?' list = IO.popen("svn st") list.each {|i| if (i =~ /^#{sign}\s*(.*)/) cmd = "svn #{action} '"+$1+"'" print cmd + "\n" system(cmd) if doit end }
svnadmin dump /path/to/repos > proj.dump cat proj.dump | svndumpfilter exclude somefolder > cleanproj.dump STOP SVN services BACKUP /path/to/repos/conf /path/to/repos/hooks (all custom configuration for this repository) DELETE /path/to/repos svnadmin create /path/to/repos RESTORE /path/to/repos/conf /path/to/repos/hooks svnadmin load /path/to/repos < cleanproj.dump RESTART SVN services
$HTTP["url"] =~ "/\.svn/" { url.access-deny = ( "" ) }
for X in `find . -maxdepth 2 -type d -name ".svn" | cut -d / -f 2`; do svn update ./$X; done
#!/bin/sh -e ########################################################### # Back up Subversion repositories ########################################################### PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Subversion config ########################################################### # My config #SVN_DIR="/var/svn" #BACKUP_DIR="." SVN_DIR="" BACKUP_DIR="" SVN_REPOS=`ls $SVN_DIR` # Dump repositories ########################################################### for repos in $SVN_REPOS; do svnadmin dump --incremental --deltas --quiet $SVN_DIR/$repos \ > $BACKUP_DIR/$repos done exit 0
#For Darwinports ln -s /opt/local/bin/sv* /usr/bin/ #For Fink ln -s /sw/bin/sv* /usr/bin/
svn add `svn st | grep '\?' | tr '\?' ' ' | xargs`
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
svn log --stop-on-copy | grep -e "--------" | wc -l
#!/usr/local/bin/bash # # Author: Jacques Marneweck# License: http://www.php.net/license/3_0.txt PHP License v3.0 # http://www.powertrip.co.za/ LOCALVER=`/usr/local/bin/svnlook youngest /home/svn/livejournal` REMOTEVER=`/usr/bin/ssh jacques@hostname /usr/local/bin/svnlook youngest /home/svn/livejournal` echo "Local version is ${LOCALVER}" echo "Remote version is ${REMOTEVER}" if [ "$REMOTEVER" -gt "$LOCALVER" ]; then echo "Remote version is greater than local version" START=$(echo "${LOCALVER} + 1" | /usr/bin/bc -l) /usr/bin/ssh jacques@hostname /usr/local/bin/svnadmin dump --incremental --deltas --revision ${START}:${REMOTEVER} /path/to/repo | /usr/local/bin/svnadmin load --ignore-uuid /path/to/repo else echo "Both local and remote version have the same data" fi
pacific# cat /home/svn/repos/hooks/post-commit
#!/bin/sh REPOS="$1" REV="$2" /usr/local/bin/svnnotify -r $REV -C -d -H HTML::ColorDiff -p $REPOS -t staff@lists.textdrive.com --from jason@textdrive.com --reply-to staff@lists.textdrive.com
svn switch --relocate http://textpattern.com/svn/repos/current/textpattern http://svn.textpattern.com/current/textpattern
svn info | grep URL
URL: http://svn.textpattern.com/current/textpattern