Reputation: 63728
For doing builds, packaging files up, etc, it's needed to have a completely clean version from SVN. There can't be any non-versioned files which are floating around, e.g test.png might get packaged up if all PNG files are grabbed.
But, getting a totally new checkout is time and bandwidth consuming. So is there a way to take a working directory and get it to be exactly identical to a clean checkout, deleting non-versioned files as well as doing an svn update?
Upvotes: 0
Views: 1627
Reputation: 44215
Here is a command that lists all unversioned files in a subversion directory:
svn status --no-ignore | grep '^\?' | sed 's/^\? //'
Doing the update and deleting the files would look like this:
svn update && svn status --no-ignore | grep '^\?' | sed 's/^\? //' | xargs rm -rf
You might want to do a revert instead of the update if you want the exact same version. Still the best way would probably be to use svn export.
Upvotes: 2
Reputation: 401012
If you want to :
.svn
directoriesThen, the best solution is to use svn export
.
Yes, it will export all files from the SVN, which means it'll take some time and it'll consume a bit of bandwith ; but that's probably the best solution to avoid any trouble.
And, as a sidenote : it allows you to create your archive from your development machine, without having to revert your current work.
Else, you'll have to :
svn revert
, to cancel the modifications you made on your working copy and didn't commit..svn
directories are excluded from your archive.Upvotes: 2
Reputation: 100050
You can write a script that erases everything file that isn't in a .svn directory, and every directory that doesn't have a .svn subdir. Then run 'up', and all it will do is recopy the files out of the copies in the .svn directory.
However, all those .svn directories still have the potential to give you gas, so read Pascal's answer, even if it takes a long time.
Upvotes: 0