views:

93

answers:

3

I'm trying to use xargs on a Cygwin Windows system to remove SVN files deleted locally.

I run the following command that generates the following output:

svn status | grep '^\!' | sed 's/! *//'

weblings-webplatform\vendor\jetty-7.0.0.pre5\contexts-available\test-annotations.d\META-INF\MANIFEST.MF weblings-webplatform\vendor\jetty-7.0.0.pre5\contexts-available\test-annotations.d\WEB-INF\jetty-env.xml

Then when I run the following command I get the following errors:

 svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %


svn: 'weblings-webplatformvendorjetty-7.0.0.pre5contexts-availabletest-annotations.dMETA-INFMANIFEST.MF' does not exist

I've tried using cygpath to convert the svn status paths but it doesn't appear to do anything.

+1  A: 

Using cygpath to change the paths to unix format should work I think.. '\' is an escape character in the linux world, looks like xargs handles it like one. Something like:

svn status | grep '^\!' | sed 's/! *//' | cygpath -m | xargs -I% svn rm %
Sander Rijken
A: 

Specify the cygwin svn (installing it if needed) as /usr/bin/svn so that you get /'s in the output from svn status. But be careful! You don't want to mix different svn versions like 1.4, 1.5, 1.6, or you'll be in for even more fun.

retracile
A: 

Use sed to change the \ into /. (Forward slashes work with the Windows API and almost all Windows programs, they have to be specifically rejected to not work.) You want to keep using the same version of svn (as you might be using elsewhere, say with a GUI) so you don't have to worry about corrupting your data.

Or change everything over to using cygwin's version of svn.

The root problem is xargs is re-interpreting the data, whether because that's how it works on cygwin or it has to pass everything through a shell (which then does it), I'm not sure (and can't test until tomorrow).

Roger Pate