2

So we have a SVN repository which houses a rather large project that takes about an hour to pull down for the first time. We've setup continuous integration with CruiseControl and we have it triggered on commits. Because of the long pull time we don't delete the build directory on the build machine and instead just issue a svn update command to get the latest version.

The works fine on adding, updating, and removing files which have been checked into SVN, but the issue we have is that during the build process files are generated. Those generated files should never be checked in but I would like to clean them out between builds.

Essentially, I'd like a svn update command that:

  1. Updated the directory to the current version.
  2. Removes all files not under source control.

Am I just missing something or is there no SVN command for this?

Update: I am on a windows machine. I'm aware that I could do this with cygwin or other methods, but I'm curious if there is a SVN or CC.Net feature for this.

Corith Malin
  • 1,505
  • 10
  • 18
  • 3
    You'd be better off making use of a "clean" target in your build script and setting svn:ignore properties on your directories that contain output from your build system. – whaley Jan 06 '11 at 18:47
  • I agree, however it would be left up to the other developers to ensure they correctly write/update the clean target whenever they check things in which write to the build directories. – Corith Malin Jan 06 '11 at 19:12
  • I'd also create a **clean** target before messing around with SVN (in Git, this would simply be `git clean -d -f`: `-f` forces deletion, `-d` cleans directories too: http://www.kernel.org/pub/software/scm/git/docs/git-clean.html). – eckes Jan 06 '11 at 22:31

2 Answers2

1

Check out this blog post (and comment thread) on how to Remove files that are not in subversion for several methods. If you're comfortable using git, I think switching to git-svn as your client might also allow you to handle the cleanup.

Matt V.
  • 9,703
  • 10
  • 35
  • 56
0

You can run the svn update command and subsequently removed the unversioned files as mentioned here.

svn status | grep '^\?' | cut -c8- | xargs rm
svn status | grep '^?' | awk '{print $2}' | xargs rm -rf

either one would work. Oh maybe you are on a windows box? Could you clarify?

Community
  • 1
  • 1
ojblass
  • 21,146
  • 22
  • 83
  • 132