SVN: How can I list all the files in the change list in Subversion?

How to get a list of files in an SVN change list without information other than a list of files?

I need a list of files in the list of changes in a format that I can use in Bash $ (). I start with svn st --cl 3011 , which lists the files, but with a lot of extra garbage:

Executing the state of an external element in 'foo'

? Foo / bar

Execution of the status of an external element in the "foo / bar" field

--- Changelist '3011':

M src / math / math.cc

A src / math / Determinant.cc

A src / math / determinant .h

M src / math / matrix.h

This is a lot of information to try to deal with sed or awk, and I worry that I will corrupt it and end up not deleting the file in the change list or adding material that is not in the change list. -q doesn't help much.

Is there a way to get svn to just give me src/math/math.cc src/math/determinant.cc src/math/determinant.h src/math/matrix.h ?

Thanks Ian

+4
source share
4 answers

This will do:

 svn st --changelist 3011 | grep -v Changelist | cut -b 3- 

svn st --changelist prints the name of the change list, as well as file status and file names:

 --- Changelist 'cl_name': M file1 A file2 

Now you are editing this by first deleting the first line with "grep -v Changelist", which removes the line with the word "Changelist". Then execute "cut -b 3-" to remove the first few characters of each line.

With a complete team you will receive:

  file1 file2 
+3
source

If you do not mind that one directory at a time you can do for each directory:

svn status lib | awk '{print $2}'

Where do you change the lib for the directory in question.

+1
source

As I know, there is no direct way (only with svn arguments) to do what you want. However, you can rely on the output of svn stat -v , and along this path starts at 41 positions. The following tasks are performed only to resolve this problem:

 perl -e "@st=`svn stat -v -N`;foreach $l (@st){print substr($l,41);}" 

For a recursive state, just remove -N from the svn arguments.

In addition to listing the entire contents of the directive, you may want to separate modified files, non-svn files, by revision, etc. In this case, you can easily change my above script with substr (0,1) - the first char of each output. For example, the following single-line file lists only modified files:

 perl -e "@st=`svn stat -v -N`;foreach $l (@st){print substr($l,41) if substr($l,0,1) eq "M";}" 
0
source

Use --ignore-externals and -cl!

You do not need to use external tools like grep or awk . It is actually quite simple!

The --ignore-externals command removes all excess garbage from the svn status call, and you can easily merge it with the --cl :

 svn st --ignore-externals --cl "Changelist Name" 

This ignores all external components, and then gives you only the files in the list of changes that you request.

0
source

Source: https://habr.com/ru/post/1338928/


All Articles