Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get statistics, how line count changed over time? I use bazaar for my project and it would be really nice to know, if I am refactoring code correctly.

share|improve this question
You can get faster answers on Stack Overflow and Super User. And may be considered offtopic here since it has nothing to do with ubuntu specifically. – Mahesh May 26 '12 at 19:35
This isn't off topic at all. In fact, this is a great place to find bazaar users as the Ubuntu project is a heavy user. – andrewsomething May 27 '12 at 16:58

There is also bzr-diffstat:

$ bzr diffstat -r 55..57
 foo/ |  2 +-
 po/foo.pot | 56 ++++++++++++++++++---------
 2 files changed, 38 insertions(+), 20 deletions(-)
share|improve this answer

There is no built-in function for line count statistics.

But more importantly: to know if you're refactoring code correctly it is not count statistics you need but unit tests!

If you really want to know how line count changed over time, I think your best bet is write a simple Python program using bzrlib, iterate over the revisions, count the lines in each revision and print it out or save in a file or database.

If you still need this and need a code sample, please leave a comment.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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