You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Gary <li...@yahoo.co.uk> on 2012/04/26 10:02:17 UTC

"svn cl" input from "svn st"

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.


Re: "svn cl" input from "svn st"

Posted by Andreas Krey <a....@gmx.de>.
On Thu, 26 Apr 2012 11:25:55 +0000, Andreas Krey wrote:
...
> > $ svn status | grep '^[A-Z]' | sed 's/^.       \(.*\)$/\1/'
> 
> $ svn status | sed -n 's/^[A-Z]       \(.*\)$/\1/p' # From memory, untested

Oops (still from memory):

$ svn status | sed -n -e 's/^[A-Z]       \(.*\)$/\1/p'

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

RE: "svn cl" input from "svn st"

Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: Andreas Krey [mailto:a.krey@gmx.de]
> Sent: donderdag 26 april 2012 11:26
> To: Gary; svn-list
> Subject: Re: "svn cl" input from "svn st"
> 
> On Thu, 26 Apr 2012 10:39:23 +0000, Stefan Sperling wrote:
> ...
> > M       alpha
> > M       epsilon/zeta
> > $ svn status | grep '^[A-Z]' | sed 's/^.       \(.*\)$/\1/'
> 
> $ svn status | sed -n 's/^[A-Z]       \(.*\)$/\1/p' # From memory,
untested

This filters property changes and tree conflicts (column 2 and 3 set to
something).

	Bert
> 
> Andreas
> 
> --
> "Totally trivial. Famous last words."
> From: Linus Torvalds <torvalds@*.org>
> Date: Fri, 22 Jan 2010 07:29:21 -0800


Re: "svn cl" input from "svn st"

Posted by Andreas Krey <a....@gmx.de>.
On Thu, 26 Apr 2012 10:39:23 +0000, Stefan Sperling wrote:
...
> M       alpha
> M       epsilon/zeta
> $ svn status | grep '^[A-Z]' | sed 's/^.       \(.*\)$/\1/'

$ svn status | sed -n 's/^[A-Z]       \(.*\)$/\1/p' # From memory, untested

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

Re: "svn cl" input from "svn st"

Posted by Gary <li...@yahoo.co.uk>.
----- Original Message -----

From: Stefan Sperling 
...
> 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.

Yeah, that's what I was wondering.

Thanks for the suggestion regarding sed or some such similar tool though!


Re: "svn cl" input from "svn st"

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Stefan Sperling wrote on Thu, Apr 26, 2012 at 10:39:23 +0200:
> $ svn status | grep '^[A-Z]' | sed 's/^.       \(.*\)$/\1/'

The exact format of this output is subject to change with minor versions
(1.7 to 1.8, etc).  For example the 7th column (for tree conflicts)
didn't exist in 1.4.  The release notes document such changes.

There is --xml, though it's less sed-friendly.

Re: "svn cl" input from "svn st"

Posted by Stefan Sperling <st...@elego.de>.
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.

Re: "svn cl" input from "svn st"

Posted by Gary <li...@yahoo.co.uk>.
> 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 :)


Re: "svn cl" input from "svn st"

Posted by Stefan Sperling <st...@elego.de>.
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?

Re: "svn cl" input from "svn st"

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
-q hides '?' (unversioned) files from the output.

Gary wrote on Thu, Apr 26, 2012 at 09:02:17 +0100:
> 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.
>