Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

How can a get a list of files in an SVN changelist with NO information except the file list?

I want a listing of files in a changelist in a format that I can use in Bash's $(). I start with svn st --cl 3011, which lists the files but with a lot of extra junk:

Performing status on external item at 'foo'

? foo/bar

Performating status on external item at 'foo/bar'

--- Changelist '3011':

M src/math/math.cc

A src/math/determinant.cc

A src/math/determinant.h

M src/math/matrix.h

That's a lot of info to try and get sed or awk to parse through, and I'm worried I'll mess it up and end up missing a file in the changelist or adding stuff that's not in the changelist. -q doesn't help much.

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

Thanks, Ian

like image 329
Ian Barkley-Yeung Avatar asked Feb 08 '11 20:02

Ian Barkley-Yeung


People also ask

How do I view svn files?

svn list is most useful if you want to see what files a repository has without downloading a working copy: $ svn list http://svn.red-bean.com/repos/test/support README. txt INSTALL examples/ … For further details, see the earlier section the section called “Listing versioned directories”.

What is svn Changelist?

Description. Used for dividing files in a working copy into a changelist (logical named grouping) in order to allow users to easily work on multiple file collections within a single working copy.

Which is the svn command to see the list of changes made in a working copy before committing to the repository?

The svn log command is used to display all the commits made on the repository or file. The svn log command is executed as follows: svn log Path.

How do I view a specific revision in svn?

If you want to see what changed in that revision, try pointing svn log directly at the topmost URL of your repository, as in svn log -r 2 ^/ .


2 Answers

This will do:

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

svn st --changelist will print the name of the changelist plus the status of the files and the file names:

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

Now you edit this by first deleting the first line with a "grep -v Changelist", which deletes the line with the word Changelist. Then do a "cut -b 3-" to delete the first few characters of each line.

With the full command, you get:

 file1
 file2
like image 151
user1633977 Avatar answered Sep 28 '22 07:09

user1633977


Use --ignore-externals and --cl!

You don't need to use any external tools like grep or awk. This is actually pretty simple!

The command --ignore-externals removes all the extra junk from the svn status call, and you can easily merge that with --cl parameter too:

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

That will ignore all externals, and then give you just the files in the changelist you ask for.

like image 24
Jimbo Avatar answered Sep 28 '22 06:09

Jimbo