Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 11-20 of 37 total

Remove all .svn folders from directory recursively

   1  
   2  find . -name .svn -print0 | xargs -0 rm -rf

Adding new files to a Subversion Repo

   1  
   2  # List all new files
   3  svn st | grep ? | sed "s/^? //"
   4  
   5  # Add all new files
   6  svn st | grep ? | sed "s/^? //" | xargs svn add
   7  
   8  # Another way to add all new files
   9  svn add * --force

unix wizards of the realm:

// SVN ignore based on .cvsignore file:

   1  
   2  svn propset svn:ignore -F .cvsignore .


// grep:
   1  
   2    … with line number: -n
   3    … with file name: -H


// os x housekeeping:
   1  


// install perl module:
   1  
   2  sudo perl -MCPAN -e 'install Bundle::LWP'


// meta refresh (i have never typed this line start to finish in my life. i have probably copy-pasted it 7,000 times
   1  
   2  <meta http-equiv=Refresh content="0; URL=http://blog.jm3.net/" />


// get files off codeswami:
   1  
   2  ssh -l cs 208.101.26.91


// SQL tricks:
http://jm3.net/cgi-bin/safe/wiki.pl?MySqlLibrary

clear directory with svn files

// description of your code here
It command line clear svn directory
   1  
   2  find d . -name .svn -exec rm -rf '{}' \; -print

enable svn $Id$-style keywords

svn propset svn:keywords "Date Author Id Revision" *css

Opera Syncing using Svn

This batch file allows to run opera after checking out your web-based opera profile. When you terminate your opera session, the batch will commit the changes you made to your profile during the opera session.

   1  
   2   REM OperaSync.bat
   3   @echo off
   4   
   5   set PRG=Opera
   6   set TARGET=%APPDATA%/%PRG%/%PRG%/profile
   7   set EXEC=%PROGS%/%PRG%/%PRG%.exe
   8   set REPO=https://********.googlecode.com/svn/trunk/%PROG%Sync
   9   set USER=*************
  10   
  11   echo Checking out from %REPO% ...
  12   svn checkout %REPO% "%TARGET%" --username %USER%
  13   echo %PROG% running ...
  14   %EXEC%
  15   echo Commiting to %REPO% ...
  16   svn commit -m --force-log "%TARGET%"
  17   echo Done.
  18   
  19   @echo on


Here's the list of files that I update from a svn repo for my Opera profile
   1  
   2  contacts.adr
   3  files.txt
   4  jscripts/
   5  jscripts/deliciousmp3.js
   6  notes.adr
   7  opcacrt6.dat
   8  opcert6.dat
   9  opera6.adr
  10  search.ini
  11  sessions/
  12  sessions/autosave.win
  13  sessions/autosave.win.bak
  14  speeddial.ini

Add all new files in subfolders to Subversion

The following to shell commands add all new files to the svn repository.

   1  
   2  newfiles=`svn status | grep '?' | cut -c 8-`
   3  for f in $newfiles; do svn add $f;done

Exclude certain files from an SVN commit

   1  
   2  svn st | grep M | egrep -v routes | awk -F' ' '{ print $2}' | xargs svn ci -m "blah"
   3  
   4  # where egrep -v routes is replaced with all the crap you don't wanna commit
   5  
   6  ie - egrep -v routes | egrep -v this | egrep -v that
   7  
   8  # I can write a script that takes those expressions as command-line options to make it easier if you're interested.. or we can write it together.. we can do it in ruby!

grep for a file, excluding svn metadata directories and files

Grep for something, excluding the annoying svn metadata (.svn**)
The find piece could also be used for more general tasks -- just remove the pipe and take a look at the output to see if it will work for you.
I tried (and failed) to use the find to a path preserving copy from within a subdirectory in a checkout...though there must be a way.

   1  
   2  find . -path '*/.svn' -prune -o -type f -print | xargs -e grep -I -n -e PATTERN

Migrate rhtml views into erb views within subversion repository

From Brandon Keepers:

To migrate rhtml views into erb views within subversion repository:

   1  
   2  Dir.glob('app/views/**/*.rhtml').each do |file|
   3    puts `svn mv #{file} #{file.gsub(/\.rhtml$/, '.erb')}`
   4  end
« Newer Snippets
Older Snippets »
Showing 11-20 of 37 total