We've found that there are quite a few defects introduced when files that need to be changed together are not. To address this, we're working on bringing the code together, so the change can be made in one place and unit-tested. We have a git repository, and we'd like to know which files change most often and which files are changed together so that we can be sure that we're collecting the right code together. It's no problem to rank the files by the number of changes made. It's not so easy to cluster the files into groups that are usually changed together.

Do you know of a tool for analyzing a git repository that would help identify the files that get changed together?

  • No, I don't, therefore a comment instead an answer. The more interesting question is what this tells you about your software, it's architecture and responsibility distribution Nov 12 '14 at 6:36
  • Exactly - this large legacy system needs remedial restructuring. As we work on establishing a more comprehensive architecture, we would like to see what legacy code has to be changed together to help us learn from our experience.
    – John
    Nov 12 '14 at 21:01
  • Still I don't know a tool for that ;-) If I was you (and wouldn't have a tool like that you asked for) I'd start with an analysis of the call hierarchy. Paired with a view of absolut changes per module then still might indicate such clusters. What language(s) is used? Nov 13 '14 at 7:03
  • The code that we're working with right now is javascript that is based on YUI. We also have a large body of Java code, which is relatively easy to analyze based on dependencies as you suggest.
    – John
    Nov 13 '14 at 18:59

CCVisu was designed to vizualize clustering in graphs, and in particular to detect files in a repository that tend to be modified together. It was applied to Mozilla's mail component; you can find an example graph in the manual and in the examples (mozilla-mailnews.log is the input, and I expect the most useful output is SVG).

CCVisu is a bit dated and only supports CVS and Subversion as version control systems. It also supports RSF, which is easy to generate.

git log --format=format: --name-only | tr -s '\n' |
awk '{if (/^$/) n++; else print "CCG\t" n "\t" $0}' >my-cochange.rsf
ccvisu.sh -inFormat RSF -i my-cochange.rsf -outFormat SVG -o my-cochange.svg
  • I'll be interested to try CCVisu with git. It will be a few weeks before I have time for that, so I'll accept the answer or add a comment next year.
    – John
    Dec 31 '15 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.