How can you only check files that have changed in a number of SVN versions?
My proposal is in the same spirit as Frau. But, it takes a range. You can use the following shell function.
function checkout_files_in_revrange()
{
svn_url=$1;
start_rev=$2;
end_rev=$3;
for theCheckoutCanditate in `svn log -r $start_rev:$end_rev --verbose --incremental | grep " M " | cut -f5 -d' ' | cut -f3- -d/`
do
svn co $svn_url/$theCheckoutCandidate -q;
done
}
source to share
Now afaik has a direct way to get only changed files and not all.
My idea is to use the verbose list output (which shows the last modified version), filter it through awk and check the rest. For example. to find files that were changed in version 42, I would use this
VERSION=42
svn list -v -R -r $VERSION svn://... | awk "/^[ ]*$VERSION/ {print \$7}" > files_to_checkout
And later do svn update -r $VERSION 'cat files_to_checkout'
(or co on url, whichever is where you run the command).
EDIT: additionally even shorter: use svn diff command and replace with -x and -diff-cmd with diff command using svn co. This requires some hacking modifying argument (which I won't go into in detail here), but it only needs one line and an intermediate file (which you can also save above, but that will be readable)
source to share
If you are using svn log with the -v (verbose) option:
svn log -r <revision> -v <path>
You will get output containing the modified files:
r3 | ciaran | 2008-11-16 12:24:30 +0000 (Sun, 16 Nov 2008) | 1 line
Changed paths:
A /trunk/apache/apache.conf
A /trunk/application/controllers
Commit message goes here
You should be able to manipulate this with some grepping etc. to create a sequence of svn co commands.
source to share
We do this in an MSBuild script:
Step 1: - Use diff command to get the list of changed files, redirect the output to a temporary file in the target directory Step 2: - Read the temporary file into itemGroup
<Exec command="$(svnExecutable) diff -r $(StartRevision):$(EndRevision) $(DOUBLE_QUOTES)$(SvnRepositoryPath)/$(DOUBLE_QUOTES) --no-diff-deleted --summarize > $(TempFilePath)" WorkingDirectory="$(WorkDirectory)" />
source to share
Another answer to your question:
Assuming you have an existing working copy, you should simply use "svn update" at the root of the directory where the files you are looking at are located, as this exactly returns what was changed between the current version and the HEAD version, with the smallest data available.
Older source control systems such as CVS and VSS asked that the server changed this file for each file ?, while subversion just dispatches the tree changes as one action. When you pass a list of files to svn update, you don't have this advantage.
Therefore, the most efficient way to communicate what has been changed is simply to update. This only transfers a binary diff of the changes in HEAD from the baseline of your working copy.
If the problem you are trying to solve is that svn update is slowing down, then we are trying to solve that for Subversion 1.7.
This release will introduce a new working copy data storage format that will perform simple operations that should lock an entire working copy (like an update) much faster.
source to share