logo

Art Of Eclipse

« Home » « About » « Github »


svn add/remove newly added files

Sometimes we have an update of codebase many files updates also new files to be added and also removed, to overcome this issue you will need to add them or remove them without adding/removing files already exsits in the repo, the following command line script solve this issue.

add files

svn st | grep ^? | sed 's/? //' | xargs svn add

remove files

svn st | grep ^! | sed 's/! //' | xargs svn rm

Script to drop all tables form a database.

Just for my reference here is a script that will drop all the tables from the database at once
and don’t forget to replace the username, password and database name 😛

for i in $(mysql -u username -ppassword databasename -e "Show tables;" | grep -v Tables_in | grep -v "+"); do mysql -u username -ppassword databasename -e "drop table $i; "; done;

svn diff between tow repositories

To make svn diff include all the unversioned files from your local working copy you have to add these files first. svn diff outputs the same changeset that svn commit would use.

If you know for sure that all unversioned files should be added here’s what you could do.

Prepare a list of unversioned files by taking from the output of svn status all the lines that start with a question mark:

svn status | grep ^? | sed -r 's/^\? +//' > ../unversioned_files_list.txt

You can then pass that list of files to svn add using xargs:

xargs -r -d '\n' svn add < ../unversioned_files_list.txt

And then produce the patch:

svn diff > ../my_patch.patch

If you don't want to keep those files added, use the list of files to unadd them:

xargs -r -d '\n' svn rm --keep-local < ../unversioned_files_list.txt
svn diff --old=https://svn-777.prod.hosting.acquia.com/aljbalkanmr/trunk --new=https://svn-777.prod.hosting.acquia.com/aljbalkanmr/tags/2012-04-10/ > ~/Desktop/balkans_diff.txt

My first post

Yes, finally I have finished my personal website, this is not my first personal web site but it’s like it’s, I hope to enjoy this one and write about everything i will find it useful for people like 🙂