logo

Art Of Eclipse

« Home » « About » « Github »


svn merge and rolling back your changes.

To revert the changes you make to a project/files and reset the changes to a specific revision all what you have to do is the following :

svn merge -rHEAD:oldrev filename
svn commit -m "rolled back to oldrev"

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

MySQL size functions

Today I want to know my database size and after some research about the database size in mysql I found this script

Get Size of all database tables

SELECT TABLE_SCHEMA AS 'Database', TABLE_NAME AS 'Table',
CONCAT(ROUND(((DATA_LENGTH + INDEX_LENGTH - DATA_FREE) / 1024 / 1024),2)," Mb") AS Size FROM INFORMATION_SCHEMA.TABLES;

replace YOUR_DB_NAME with your database name in following 2 examples:
get size of specific database tables

SELECT TABLE_SCHEMA AS 'Database', TABLE_NAME AS 'Table',
CONCAT(ROUND(((DATA_LENGTH + INDEX_LENGTH - DATA_FREE) / 1024 / 1024),2)," MB") AS Size FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA like '%YOUR_DB_NAME%' ;

to get size of entire DB :

SELECT CONCAT(sum(ROUND(((DATA_LENGTH + INDEX_LENGTH - DATA_FREE) / 1024 / 1024),2))," MB") AS Size FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA like '%YOUR_DB_NAME%' ;