How can you only check files that have changed in a number of SVN versions?

Is it possible to check only files from the SVN repository that have changed in a revision or version range, without checking out any files that have not changed?

0


source to share


8 answers


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
}

      

+2


source


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)

+2


source


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.

+1


source


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 &gt; $(TempFilePath)" WorkingDirectory="$(WorkDirectory)" />

      

                 

+1


source


I'm not sure if this is possible, but you can also do something like this:

svn checkout --revision <revisionNumber> 

      

to get a specific revision and

svn log --revision <revisionNumber> 

      

to see all files changed in version

0


source


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.

0


source


In almost the same lines as most people suggested (but only on a system with grep and awk), you can get the list by doing

svn log -v --revision <revision_number> | grep "^ " | awk '{print $2}'

...

0


source


svn diff -r start_revision: end_revision_or_HEAD --summarize

0


source







All Articles