We would like to decrease the size of a repository by purging all binary files usually zip files that are not development oriented. Any easy way to remove them?
i assume you wnat to decrease size of repository [ on the server ], not just content checked out.
as far as i know only way to remove something permanently from svn is to:
- run the dump of repository
- manually remove unwanted files/changes to those files from the dump
- recreate repository
in this way you'll preserve history and all meta-data yet you'll get rid of unwanted files [ eg binaries ].
There is currently no simple way to completely remove files from a SVN repository. This feature (usually called obliterate), has been requested since 2001, but it is not yet implemented. See the bug report for all the details.
The workaround for the moment is to dump the repository, filter the dump, then reimport. This is explained in the standard book, Version Control with Subversion.
The best way to prevent people checking in files you don't want is to use the pre-commit hook. Reject (ie return a non 0 value) if any of the files in the commit match a pattern. The user will receive the message when they try to commit. You can set the global-ignores, but that only applies to the client, if a client is installed without setting the ignores, they will happily attempt to checkin whatever they like.
eg. (using windows batch files, you'll be better off with perl) to restrict specific file extensions, and return the bad files with a message to the user:
@echo off svnlook log -t "%2" "%1" | d:\tools\grep -c "[a-zA-z0-9]" > nul if %ERRORLEVEL% NEQ 1 goto DISALLOWED echo Please enter a check-in comment 1>&2 exit 1 :DISALLOWED svnlook changed -t %2 %1 > c:\temp\pre-commit.txt rem ** remember to set the TruncatedExtensions registry setting to 0 ** rem ** or .resx will be matched as if it was .res ** findstr /G:"%1\hooks\ignore-matches.txt" c:\temp\pre-commit.txt > c:\temp\precommit-bad.txt if %ERRORLEVEL% NEQ 0 exit /b 0 echo disallowed file extension >> c:\temp\precommit-bad.txt type c:\temp\precommit-bad.txt 1>&2 exit 1
Where ignore-matches.txt is:
^[^D].*\.aps$ ^[^D].*\.vbw$ ^[^D].*\.obj$ ^[^D].*\.ncb$ ^[^D].*\.plg$ ^[^D].*\.bsc$ ^[^D].*\.ilk$ ^[^D].*\.exp$ ^[^D].*\.sbr$ ^[^D].*\.opt$ ^[^D].*\.pdb$ ^[^D].*\.idb$ ^[^D].*\.pch$ ^[^D].*\.res$ ^[^D].*\.suo$ ^[^D].*\..*scc$ ^[^D].*\\Debug ^[^D].*\.user$
You can also prevent users from adding binary files by ignoring them you have to edit ~/.subversion/config and look for global-ignores. If the line is commented, remove the pound character.
global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store ._* *.log *.bak
so you can add what you want i used it to keep my repository clean from mac os temporary files.
Hope that will help you.