Lovely Nix Commands

I’m going to put here Linux/Unix/Mac OS X commands that I’ve had to dig around to construct.  They may be useful to you or me in the future.

  • Copy all modified files in a subversion working copy to another working copy.  (I needed to do this after doing an export and import to a new server, since svn switch does not work with repositories moved in this way).

To preview what will happen

svn status | grep "^M" | awk '{print $2}' | xargs -I {} echo 'cp {} [other-wc]{}'

To do it

svn status | grep "^M" | awk '{print $2}' | xargs -I {} cp {} [other-wc]{}

Run this command from the root of one working copy. other-wc is the same location in the other working copy, relative to the current path.

If you want to include files that aren’t in the repository (new files), change “^M” to “^(M|\?)”. Note that svn:ignored files will still be ignored.