Showing posts with label svn. Show all posts
Showing posts with label svn. Show all posts

Saturday, December 18, 2010

Svn commit all the readme's that where have modified.

Most of the time I'm working on multiple projects at the same time. This means many svn working directories. And sometimes its essential to commit a similar file across all working dirs. Here is quick commandline to get it done (for README files).

find ./ | grep README | grep -v svn | sed "s/^/svn status /" | sh | sed "s/^M *\(.*\)/svn commit \1 -m 'updating project readme'/"

Thursday, July 15, 2010

fixing "svn: Malformed file" and other broken svn file problems...

This happens when you get to smart for yourself and alter the contents of the .svn dir accidentally...


To fix it;
Basically move the whole working dir over and recheck out and then restore the new/edited/deleted files. Sounds hard but it is quite easy(especially if you have had to do it a few times).... Run the following commands on the console. And note the commands with "| sh" allow you to first confirm the exact action before executing it so use it to double check before you make a total mess


#move broken trunk out of the way
mv trunk broken
mkdir trunk 
cd trunk
svn checkout https://server.svn/repos/project/trunk
cd ../broken

# make the new dirs -- confirm first...
find ./ -type d | grep -v svn | egrep "^./(app|test|lib|db)" | sed "s|\(.*\)|mkdir -p ../trunk/\1|"
find ./ -type d | grep -v svn | egrep "^./(app|test|lib|db)" | sed "s|\(.*\)|mkdir -p ../trunk/\1|" | sh

# move all the normal non-svn files that are relevant back in (im my case its a rails app) -- confirm first... find ./ -type f | grep -v svn | egrep "^./(app|test|lib|db)" | sed "s|\(.*\)|cp \1 ../trunk/\1|" find ./ -type f | grep -v svn | egrep "^./(app|test|lib|db)" | sed "s|\(.*\)|cp \1 ../trunk/\1|" | sh

# remove all deleted files. -- confirm first... svn status | grep "^D" | sed "s|^D *|svn del ../trunk/|" svn status | grep "^D" | sed "s|^D *|svn del ../trunk/|" | sh