Split the patch stats code into separate functions

That will help to add support for GBM branches on a next patch.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Add support for GBM branches

It is easier to handle GBM as branches. Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>