Subversion: Check out only those files affected du

2019-02-02 00:52发布

In Subversion, is it possible to check out only those files affected during a specific commit, provided you know the specific revision number?

13条回答
唯我独甜
2楼-- · 2019-02-02 01:24

you can get a list of files modified since a specific revision like this:

svn diff -r [REVNUM]:HEAD --summarize > fileschanged.txt

then create a script to checkout each file in the fileschanged.txt

查看更多
Summer. ? 凉城
3楼-- · 2019-02-02 01:24

svn mergeinfo --show-revs eligible http://base.com.rev1 http://base.com.rev2

This will give a lot of revisions

Now you would like to see the list of files in each revision. So take the list of revision and copy into note pad or editplus and modify so that they fit into one line

svn log -r r33521 -r33762 -3456 -r5623 -q -v >> missedFiles.txt

Note : I had 118 revisions and I was not able to get the list of files correctly. So i ran the above command by breaking into subsets of revision

查看更多
一夜七次
4楼-- · 2019-02-02 01:30

I think it's possible that you're using the term "check out" here in its CVS sense, that is, an "svn update". Is that right?

If so, then you can update to the particular revision that you want:

svn update -r12345

or even just those files to that revision:

svn update -r12345 file1 file2 file3

though you'll have to get the list of files from svn using some of the other suggestions.

查看更多
爷、活的狠高调
5楼-- · 2019-02-02 01:34

I needed a dump of all the files that had changed within a range of a dozen revisions. I did it like so (these commands may not be perfect, this is just a general explanation):

Create a diff that will show the files you need and write the list to a text file

svn diff --summarize -r219:232 > r219-232_Summary.txt

This will give you a text file with lines like

M      path/to/file.php

Massage the file format to replace the beginning of each line with an 'svn up' command, instead of 'A ' or 'M ' or whatever.

 sed -i 's/A      /svn up /g' ./r219-232_Summary.txt

... which will give you lines like

svn up path/to/file.php

Create a new directory and check out your project to it

svn co http://www.repo.net/whatever

Remove everything in the directory except the .svn file (I'm using a relatively recent svn client so if you're on an old svn client that has a .svn in every directory, not sure how that will work)

rm -rf ./*

Copy in your text file, make it executable, and run it as a script.

cp /path/to/wherever/r219-232_Summary.txt ./r219-232_Summary.sh
chmod 777 ./r219-232_Summary.sh
./r219-232_Summary.sh

If all goes as planned, then shell should parse each 'svn up' command in your text file and populate the directory with only the files that you're interested in.

查看更多
The star\"
6楼-- · 2019-02-02 01:35

I think that a Subversion check out can only check out a specific folder and not individual files. That said, the command:

svn log -r *revision* -q -v

will list the changes associated with the specified revision so you could process the output of this command to help copy the desired files to somewhere after checking out a working folder for the full directory.

查看更多
The star\"
7楼-- · 2019-02-02 01:40

svn checkout only works at the directory level, not the file level. Of course, if all the changes in a specific changeset were from the same directory, then you can perform the svn checkout <url> <path> -r<revid>.

查看更多
登录 后发表回答