Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Decrease the size of the repository, or the checked out version? The latter would be fairly easy, the former could cause consistency problems. –  Scott Pack Jul 29 '09 at 15:49
    
Yes I love it when someone checks in Eclipse! And yes, dump/filter/load is the way it's (un)done. –  gbarry Jul 29 '09 at 16:36

4 Answers 4

up vote 8 down vote accepted

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:

  1. run the dump of repository
  2. manually remove unwanted files/changes to those files from the dump
  3. recreate repository

in this way you'll preserve history and all meta-data yet you'll get rid of unwanted files [ eg binaries ].

share|improve this answer
    
check also this: stackoverflow.com/questions/560684/svn-obliterate –  pQd Jul 29 '09 at 15:55

Unfortunately, no.

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.

share|improve this answer
    
Mercurial or git capable of this? –  Kyle Brandt Jul 29 '09 at 17:32
    
Mercurial not, apparently: selenic.com/pipermail/mercurial/2008-March/017803.html . Git can do it, it seems: wincent.com/wiki/Obliterating_a_Git_commit –  sleske Jul 30 '09 at 7:52

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$
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.