Menu

#91 problem with generated stat when folder is moved into parent

open
nobody
5
2008-11-25
2008-11-25
Alex
No

I am trying to use StatSVN on a repository containing a moved
directory directory. The directory was moved from a sub directory its parent directory (in my case it is the repository root directory). I am seeing the following behavior:
- Files that have not been modified after the directory move operation do not appear on the directories statistics main page (index.html) and they are also not included in the current LOC count.

The local copy of the repository is the same version, the svn log was created from and the svn log correctly includes the move operation:

<logentry
revision="1234">
<author>abc</author>
<date>2008-11-13T08:54:25.978873Z</date>
<paths>
<path
action="D">/trunk/sub/movedDir/src</path>
<path
copyfrom-path="/trunk/sub/movedDir/include"
copyfrom-rev="1233"
action="A">/trunk/movedDir/include</path>
<path
copyfrom-path="/trunk/sub/movedDir/src"
copyfrom-rev="1233"
action="A">/trunk/movedDir/src</path>
<path
action="D">/trunk/sub/movedDir/include</path>
</paths>
<msg>Move the movedDir directory</msg>
</logentry>

I am able to reproduce the problem with a minimal repository.

- Create a new svn repository
- Add the directories sub/dir and a file sub/dir/main.cpp containing 2 lines and commit the added files
- if I generate the statistics on the repository now by calling the
following commands, I get the empty log error (maybe this is a fringe case -
head revision 0):
svn.exe log "%SVNREPOSITORY%" --xml -v > \Temp\svn.log
svn.exe co "%SVNREPOSITORY%" "\Temp\LocalSVNRepoCopy"
java -jar statsvn.jar -include "**\*.cpp" "\Temp\svn.log"
"\Temp\LocalSVNRepoCopy"

- Now I add a third line to the main.cpp file and commit the change - the statsvn statistics now does not output any warnings and correctly identifies the three LOC of the project.
index.html shows the following information now:
Generated: 2008-11-25 11:21
Head revision: 1
Report Period: 2008-11-25 to 2008-11-25
Total Files: 1
Total Lines of Code: 3
Developers: 1
Directories
[root] (0 files, 0 lines)
sub (0 files, 0 lines)
dir (1 files, 3 lines)

- Now I move the directory dir directory out of the sub directory into the root directory of the repository and commit the change.

- statSVN now does not report any warnings but outputs the current LOC to be 0!

index.html shows the following information:
Generated: 2008-11-25 11:43
Head revision: 2
Report Period: 2008-11-25 to 2008-11-25
Total Files: 0
Total Lines of Code: 0
Developers: 1
Directories
[root] (0 files, 0 lines)
sub (0 files, 0 lines)
dir (0 files, 0 lines)

Discussion

  • Antti Maula

    Antti Maula - 2010-07-06

    The issue seems to exists on all directory moves. Moving a directory will delete that amount of code from all calculations. The directory which was moved is marked in the report as deleted, but the new directory in which the files were moved is not included in the report at all. So, as a arranged my repository a bit, statsvn now reports 50% less code in the whole repository.

    This is probably related to the directory tracking problem listed on limitations?

    Tested with version 0.7.0.

     
  • Jason Kealey

    Jason Kealey - 2010-07-06

    That is corrected. StatSVN does not support SVN moves properly at this point.

     
  • Antti Maula

    Antti Maula - 2010-07-06

    Is there a known workaround? Modifying all files in the move target subtree would do the trick, but is probably not the best solution :)

     
  • Jason Kealey

    Jason Kealey - 2010-07-06

    The recommended workaround is to spend a few days implementing the feature in StatSVN to benefit the whole community :)

     
  • Antti Maula

    Antti Maula - 2010-07-06

    True :)

    Unfortunately it would probably take more than a few days - first to comprehend what is happening inside statsvn during execution - then what is going wrong with the svn.

    As the limitation is already known, is there a certain reason why this is not working? I mean, does it require some very special processing to handle?

    If I can find some time, I could take a look at it at some point.

     
  • Jason Kealey

    Jason Kealey - 2010-07-06

    StatSVN is based on StatCVS. CVS did not support moves, so we interpret them as Add + Remove.

    SVN supports directory moves. Depending on the tool you use to make the move, the log file can either show:
    a) a single: moved directory a to directory b.
    b) for each file: moved a\file1.txt to b\file1.txt

    In the latter case, our statistics are more accurate. In the former, the tool doesn't necessarily know all the files that were present in the folder at the time of the move - it has to infer them from other knowledge extracted from the log file.

    I believe I created a prototype a while back for this, but it was many years ago and I remember it was very slow.

     

Log in to post a comment.

MongoDB Logo MongoDB