Symfony World blog is not maintained anymore. Check new sys.exit() programming blog.

svn blame: who made the bug?

Scene from "12 Angry Men" by Sidney Lumet (1957)

In bigger projects it happens quite often that an unknown team member has made a modification that caused a lot of trouble. And no one wants to confess... It is quite uncomfortable to analyse distinct revisions and changes of a file to find who caused the problem, as it is time consuming. This is where svn blame is the perfect tool - you execute it upon a chosen target to display revision number, team member and content line by line. You can easily find who is the author of a bug and when he committed it. It's intereting, that despite being very useful, this tool is not very known.

blame me if you can find me quickly!

The usage is very simple:

tducin@workshop:/var/www/admin/config/doctrine$ svn blame schema.yml
and you have the entire file analysed:
   367     dennis connection: master
   362     tducin
   362     tducin options:
   362     tducin   charset: utf8
   362     tducin   collate: utf8_general_ci
   362     tducin
  3755     george Status:
  3755     george   comment: "Statusy"
   491     dennis   actAs:
  1980     dennis     SoftDelete: ~
  1793     harold     Timestampable: ~
  1793     harold     Signable: ~
   492     tducin   columns:
   492     tducin     name:
  3755     george       type: string(64)
   492     tducin       notnull: true
  2628     tducin       comment: "nazwa"
  3755     george     notify_mail:
  3755     george       type: boolean
  3755     george       notnull: true
  3755     george       default: false
  3755     george       comment: "klient ma być powiadamiany mailowo"
  1541     dennis     stock_mode:
  1541     dennis       type: enum
  1541     dennis       values: [ reserved, sent, cancelled ]
  1541     dennis       default: reserved
  2628     dennis       comment: "tryb magazynowy: reserved, sent, cancelled"
  3755     george     force_reminder:
   892     tducin       type: boolean
   878     tducin       notnull: true
  3755     george       comment: "Wymuszenie dodania wpisu w kalendarzu"
  3755     george     block_update:
  3755     george       type: boolean
  3755     george       notnull: true
  3755     george       comment: "Blokada zmiany statusu"
  4078     harold   indexes:
  4078     harold     softdelete_idx:
  4078     harold       fields: [ deleted_at ]

2 comments:

  1. There's also a more positive version of this command called "svn praise".

    You should use it in those rare cases when you find an awesome piece of code and want to check who wrote it ;)

    ReplyDelete
    Replies
    1. It never happened in my team... I guess I know why "blame" is the default one ;)

      Delete