On Thu, Apr 26, 2012 at 09:09:49AM +0100, Gary wrote: > > From: Stefan Sperling > > > > On Thu, Apr 26, 2012 at 09:02:17AM +0100, Gary wrote: > > > I'm just wondernig if it's possible to pipe or otherwise use the output > > > from "svn st" into the "svn cl XYZ" command (for the file paths / names, > > > obviously). I can't even see any > > > option to "svn st" that gives *only* file names/paths :( The -q option > > > seems to give the same output as "svn st" without it. > > > > > > > Which operating system are you using? > > Let's assume it's something *n*x like :) >
Great, that makes it easier for me to answer :) So you definitely have 'sed' available and could do something like: $ svn status M alpha M epsilon/zeta $ svn status | grep '^[A-Z]' | sed 's/^. \(.*\)$/\1/' alpha epsilon/zeta $ (I bet there are people on this list who can suggest a better regex to use). The 'grep' bit ensures that no unrelated lines printed by svn status are considered (e.g. the lines saying "--- Changelist 'foo'" if you already have changelists defined). The 'sed' part trims the status letter and leading whitespace from the line, leaving the filename. You can write this output to a file and then use svn changelist with the --targets option: $ tempfile="`mktemp`" $ svn status | grep '^[A-Z]' | sed 's/^. \(.*\)$/\1/' >> "$tempfile" $ svn changelist --targets "$tempfile" new-changelist A [new-changelist] alpha A [new-changelist] epsilon/zeta $ rm "$tempfile" You can put these commands into a shell script to automate the task. Of course, it would be nicer if 'svn' had its own way of adding a select subset of files in the working copy to a changelist based on some criteria. But no such feature currently exists as far as I know.