<nowiki>A file activity analysis tool</nowiki>{{ Project | Overlaps |
curator = Matt Attaway |
path = //guest/matt_attaway/scripts/overlaps.rb |
download = //guest/matt_attaway/scripts/overlaps.rb |
language = Ruby |
license = BSD }}
=== About This Project ===
This tool identifies files that are changed multiple times a day by more than one user. Files that frequently have overlaps may be candidates for refactoring.
=== Usage ===
overlaps [ -p port ] [ -u user ] ( [ -s date ] | [ -w weeks ] | [ -d date ] ) [ -e date ] [ -v ] [ -m minimum ] <Perforce path>
: '''-s''' Start date. Incompatible with -w. One week before end date by default.
: '''-e''' End date. Today by default.
: '''-w''' Number of weeks before end date to examine.
: '''-v''' Show detailed list of overlapping files.
: '''-d''' Date. Gives overlaps for a single day. Overrides all other date related flags.
: '''-m''' Minimum number of overlaps required to be flagged. 2 by default.
=== Example ===
Here's an example showing the last four weeks of development. Each number in the output represents the number of users who submitted changes to one overlap file.
<pre>
ruby overlaps.rb - w 4
2009/06/23 22222222222222
2009/06/24 2222
2009/06/25 2222222
2009/06/26 4222222
2009/06/27
2009/06/28
2009/06/29 22222
2009/06/30 2
2009/07/01 222222222
2009/07/02 22
2009/07/03
2009/07/04
2009/07/05
2009/07/06 22
2009/07/07 222222222
2009/07/08 222222222
2009/07/09 3222
2009/07/10 2
2009/07/11
2009/07/12
2009/07/13 322
2009/07/14 32
2009/07/15 222
2009/07/16 2222
2009/07/17 3222222
2009/07/18
2009/07/19
2009/07/20 4222
2009/07/21 3
</pre>
We can see a few small overlaps per day with an occasional "spike" to 3 or 4. Let's look at the day with four overlaps in more detail.
<pre>ruby overlaps -d 2009/06/26 -v
2009/06/26 4222222
2 //depot/main/doc/guinotes.txt
2 //depot/main/doc/apinotes.txt
2 //depot/main/src/msgs/help.cc
2 //depot/main/src/net/tcpip.cc
2 //depot/rel2.0/doc/xmlnotes.txt
4 //depot/rel2.0/doc/guinotes.txt
2 //depot/rel2.0/doc/usage.txt
</pre>
Most of the overlaps were thankfully just release notes. Maybe a release is coming up soon?
Let's take a look at our src path for the last week to see how many overlaps are in our source code
<pre>ruby overlaps -v //depot/main/src/...
2009/07/15 222
2 //depot/main/src/lib/rlib.cc
2 //depot/main/src/net/tcpip.cc
2 //depot/main/src/net/udp.cc
2009/07/16 2
2 //depot/main/src/net/tcpip.cc
2009/07/17 3222222
2 //depot/main/src/conf/local.cc
2 //depot/main/src/conf/remote.cc
2 //depot/main/src/lang/eng.cc
2 //depot/main/src/lang/frn.cc
2 //depot/main/src/lang/ger.cc
2 //depot/main/src/lang/rus.cc
3 //depot/main/src/net/tcpip.cc
2 //depot/main/src/msgs/help.cc
2009/07/18
2009/07/19
2009/07/20 4222
2 //depot/main/src/db/tables.cc
2 //depot/main/src/msgs/usage.cc
2 //depot/main/src/msgs/help.cc
4 //depot/main/src/net/tcpip.cc
2009/07/21 3
3 //depot/main/src/net/tcpip.cc
</pre>
tcpip.cc appears to be a popular file. It may be worth looking into why so many people have been touching it recently.
{{ License | BSD | 2009 | Matt Attaway }}
{{ RecentChanges | //guest/matt_attaway/scripts/overlaps.rb }}
[[Category:Perforce]] [[Category:Ruby]]