#25 Support for MultiDir/svn:externals


Projects with linked in directories are not supported at this moment. It just skips this dirs. The information is normally not included with the normal svn commandline.

to gather this information one should make a batch in this form:

del x:\svn.log
svn log --incremental --xml directoryA >> x:\svn.log
svn log --incremental --xml directoryB >> x:\svn.log
svn log --incremental --xml directoryC >> x:\svn.log

Now one should supply this directories to the stat software. In the current situation you can only supply 1 directory.

When this is ready you have this features:

*support for multiple projects
*support for projects using svn:external


  • Heiko Stoermer
    Heiko Stoermer

    Would be great to have support for the analysis of projects that include sub-projects via svn:externals.

  • Heiko Stoermer
    Heiko Stoermer

    Btw, Allard's example has the flaw that seemingly in svn the combination of "--xml" and "--incremental" does NOT result in a well-formed XML document (at least on the machine with svn 1.4 I have available here right now, see [1]), so you'll have to do some fixing first.

    [1] http://osdir.com/ml/version-control.subversion.devel/2002-10/msg00253.html

  • Jason Kealey
    Jason Kealey

    What is StatSVN's current behavior concerning svn:externals?

    What does the svn log show when you point to an external folder? A modification to the directory (to add the svn:externals metadata)? Afterwards, no modifications are shown in the directories that include it, even when the files are modified (as these changes are elsewhere in the repository)?

    What would you do if you had a repository that had an svn:externals to itself. If you checked out the trunk, would you expect the change to the included directory to be seen as a modification in all the places that use it?

  • Heiko Stoermer
    Heiko Stoermer

    My layout is roughly the following: I have 4 projects A, B, C, D.

    A has the layout

    where /src/ has A's source, and /components/* are the projects B,C,D pulled in via svn:externals.
    So after a checkout including the externals I get something like

    /A/components/X/src/ (from B)
    /A/components/Y/src/ (from C)
    /A/components/Z/src/ (from D)

    I can create the complete log of everything following Allard's proposal and fixing the resulting non-well-formed XML file that svn produces by hand.

    When I run statsvn on the resulting log file giving /A/ as path, i get tons of "problems getting diff" messages and "no such revision". All subfolders in the resulting report do appear, but e.g. LOC calculations seem very much off.

  • Wrote a powershell script to make a full log including externals set on the project directory. But this doesn't solve the issue. I guess stats do not show info for directories outside project directory in repository. Any way here is the script:

    $path = $args[0];
    $logOutput = $args[1];
    $statOuputDir = $args[2];
    $statSvnJarPath = $args[3];

    $svn = "svn"
    $getExternalsParameters = "propget svn:externals '$path'"
    $getLogParameters = "log --incremental --xml -v '$path'"

    $externals = Invoke-Expression -Command ("$svn $getExternalsParameters");

    '<?xml version="1.0"?>' | Out-File $logOutput;
    '<log>' | Out-File $logOutput -append;

    "Resolving changes for '$path'"
    Invoke-Expression -Command ("$svn $getLogParameters") | Out-File $logOutput -append;

    foreach($external in $externals)
    if($external -ne "")
    $dir = Join-Path $path $external.Split(" ")[1]
    $getExternalsLogParameters = "log --incremental --xml -v '$dir'"
    "Resolving changes for '$dir'"
    Invoke-Expression -Command ("$svn $getExternalsLogParameters") | Out-File $logOutput -append;
    '</log>' | Out-File $logOutput -append;

    if ((Test-Path -path $statOuputDir) -ne $True)
    New-Item $statOuputDir -type directory;

    $currentLocation = Get-Location

    Set-Location $statOuputDir

    Invoke-Expression -Command ("java -jar '$statSvnJarPath' '$logOutput' '$path'") | ;

    Set-Location $currentLocation

  • Jason Kealey
    Jason Kealey

    Sounds interesting!

    Thinking back to the original StatSVN implementation, I think the limitations are as follows:
    - I think we assume a sequential log file. Out of order files might be problematic.
    - More importantly, we assume a single RepositoryGUID/URL throughout the application. With svn:externals, we could potentially be querying other SVN repositories which would require us to pass in extra parameters for usernames, passwords, etc. Since we fetch the Repository information using svn info on the root of the checked out directory, we would need to do this for all external folders.
    - Assuming we did manage to treat these sub-repositories as completely independent in the parsing/setup phases, I am not sure how the svn diff + reporting phases would handle this. Not all files would start off with the same repository URL.

    At a high level, because of design limitations, this looks like a large job.