← Back to team overview

launchpad-dev team mailing list archive

bzr-damage: tools to help track lines of code inflicted

 

Hello all,

I just (mostly) finished up some work on Launchpad on behalf of the
team at Canonical who work on the Ubuntu Software Center.

While doing that work, I got really interested in how many lines of
code were being added or removed by a particular branch or commit as I
didn't want to go against LP's lines-of-code neutrality policy.

Thus, I wrote a simple little Bazaar plugin that can give you quick
answers. I've mentioned it on IRC to a few of you, but Rob suggested I
send an email.

Get the plugin from lp:bzr-damage in the usual way.

In one branch,::

  $ bzr damage
  Damage: 28 lines of code

In another,::

  $ bzr damage
  Healing: 39 lines of code

That will show you how many lines of code you are inflicting if you
land that branch.

There's also a command, 'bzr loc', that takes mostly the same
arguments as 'bzr log', but shows the lines of code in each revision,
and shows the actual author rather than PQM. e.g.::

  $ bzr loc --limit 10
  15429: Jonathan Lange            2012-06-15   -48 [merge]
[r=stub][bug=1006295] Remove support code to handle two different
  15428: William Grant             2012-06-15    +9 [merge]
[r=wgrant][no-qa] Merge db-stable r11680.
  15427: William Grant             2012-06-15  -298 [merge]
[r=wgrant][bug=1009370][no-qa] Drop unused
  15426: Ian Booth                 2012-06-15   -13 [merge]
[r=wgrant][bug=1009358,
  15425: Brian Murray              2012-06-15   +35 [merge]
[r=wallyworld][bug=826854] [r=wallyworld][bug=826854] add a
  15424: Ian Booth                 2012-06-15   +14 [merge]
[r=wallyworld][bug=1012912] The filebug page safely ignores missing
  15423: Ian Booth                 2012-06-15  -229 [merge]
[r=wgrant][no-qa] Delete RemoveGranteeSubscriptionJob since it's now
  15422: Curtis Hovey              2012-06-14   +87 [merge]
[r=jcsackett][bug=1012808] Register the commercial email job sources
  15421: Graham Binns              2012-06-14    +1 [merge]
[r=jcsackett][bug=682771][no-qa] Launchpad now depends on
  15420: Ivo Kracht                2012-06-14    -5 [merge]
[r=jcsackett][bug=999662] [r=jelmer][bug=999662] Package information
  Total damage: -447.

Finally, there's 'bzr high-scores', which shows each author over the
given revision range, ranked by how many lines of code they've
removed. <http://paste.ubuntu.com/1039164/> is a slightly stale run of
the rankings since the policy was introduced.
<http://paste.ubuntu.com/1040992/> are the rankings for the same time
period before the policy. For the link shy, here are the top 5::

  1. Aaron Bentley <aaron@xxxxxxxxxxxxx>                           -6410
  2. Colin Watson <cjwatson@xxxxxxxxxxxxx>                         -2330
  3. William Grant <william.grant@xxxxxxxxxxxxx>                   -1984
  4. Curtis Hovey <curtis.hovey@xxxxxxxxxxxxx>                     -1743
  5. Robert Collins <robertc@xxxxxxxxxxxxxxxxx>                    -1395

I would also draw everyone's attention to cjwatson's loc-contributions
in lp:lp-dev-utils, which will tell you the score for an individual
contributor.

The code lives at lp:bzr-damage. Everyone in ~canonical has commit
access but please, file MPs. I haven't yet filed bugs but there are
XXX comments in the code that highlight known problems and potential
areas for improvement. I've also had a chat with the bzr-stats guys
(Hi Jelmer, John!) and am seeking ways to consolidate that code.

cheers,
jml