3

Is there a way to perform an svn add command that will add only unversioned files?

Currently if I try to do svn add on a direcotry that contains a mix of versioned and unversioned files I receive the mydir/ is already under version control message.

Camsoft
  • 911
  • 4
  • 12
  • 21

2 Answers2

6

If you're on a Linux/UNIX commandline:

svn status | grep '\?' | awk '{print $2;}' | xargs svn add
James
  • 1,001
  • 1
  • 6
  • 4
  • 1
    Just to be slightly more explicit: grep '^\?' – andol Jul 19 '10 at 16:37
  • Absolutely fantastic! One wonders why svn does not support this natively though. – Camsoft Jul 19 '10 at 17:50
  • Camsoft, you can modify that line to do removes, moves, deletes, etc, just change out the ? mark and the svn add command to do a different function. For example, to remove all missing files: svn status | grep '^\!' | awk '{print $2;}' | xargs svn rm – James Jul 19 '10 at 18:03
  • Yup. If you're anything like me, you'll end up with a small collection of one-liner shell scripts for doing common batch svn stuff. @Camsoft: One wonders why svn does not support a lot of things natively ;) – jdd Jul 22 '10 at 00:53
1

Try svn add * --force to force it into the already version controlled directory.

Michael Burns
  • 288
  • 1
  • 5