Getting stats with the query system
The query system is one of the new features we released with Plastic 1.5. It opens up new possibilities to create customized statistics and know what is going on in your development.
We wanted to make the query system as simple as possible (you can always argue here if you don't like it) and that’s why we decided to create a SQL-like syntax. This way, taking into account that our users are actually developers, we provide a familiar interface.
Well, suppose you want to list the revisions you created since yesterday. In my case I would type:
$ cm find revs where date “>” ‘2007/08/9’ and owner = ‘pablo’
Ok, but what about giving all this output a bit of format? You can use the –format modifier and type something like:
$ cm find revs where date “>” ‘2007/08/9’ and owner=’pablo’ –format=”{date} {type} {owner} {item}#{branch}”
You can see I just modified elements in a couple of branches. I could also list the revs modified on a given branch adding the condition:
and branch=’br:/main/FixBL063/SCM2199’ to the previous query, as you can see in the screenshot.
You can learn more about the available objects to search typing: cm showfindobjects. Currently you can search revisions, branches, changesets, links, revisions and users.
For example, typing “cm find user” you will retrieve a list of the users with objects inside the system.
A list of changesets can also be easily retrieved with:
$ cm find changeset where owner='pablo' and date ">" '2007/08/01'
Now imagine you want to know all the branches you’ve created so far: it can be done with
We wanted to make the query system as simple as possible (you can always argue here if you don't like it) and that’s why we decided to create a SQL-like syntax. This way, taking into account that our users are actually developers, we provide a familiar interface.
Well, suppose you want to list the revisions you created since yesterday. In my case I would type:
$ cm find revs where date “>” ‘2007/08/9’ and owner = ‘pablo’
Ok, but what about giving all this output a bit of format? You can use the –format modifier and type something like:
$ cm find revs where date “>” ‘2007/08/9’ and owner=’pablo’ –format=”{date} {type} {owner} {item}#{branch}”
You can see I just modified elements in a couple of branches. I could also list the revs modified on a given branch adding the condition:
and branch=’br:/main/FixBL063/SCM2199’ to the previous query, as you can see in the screenshot.
You can learn more about the available objects to search typing: cm showfindobjects. Currently you can search revisions, branches, changesets, links, revisions and users.
For example, typing “cm find user” you will retrieve a list of the users with objects inside the system.
A list of changesets can also be easily retrieved with:
$ cm find changeset where owner='pablo' and date ">" '2007/08/01'
Now imagine you want to know all the branches you’ve created so far: it can be done with
$ cm find branch where owner=’pablo’, in my case.
Ok, this looks good to monitor somehow what’s going on in the project, which changes someone has done, and so on. But, what about retrieving some statistics?
One of the nice things about cm find is that you can create output in XML format. Try something like:
$ cm find revs where date ">" '2007/08/1' --xml --file=statsAgo.xml
to create a file with all the information about revisions created since a given date. Once you have the XML file you can start playing around with it with your favorite tool.
I imported the data generated by cm find into Excel 2007 and then I started playing with the pivot tables. In the new 2007 release this feature is a little bit hidden: now it is under the insert menu instead of the data menu.
Well, once you create a pivot table out of the imported data you can start grouping it. Then you can show the revisions grouped by branch, including cool graphics.
Show the revisions grouped by user.
Or even calculate the how the revision creation is distributed hourly (you can discover interesting things doing that).
Or weekly:
We’re working on extending the query system to provide an easy (and powerful) way to locate merges, for instance. Also a subsystem we call “advanced query system” is already out (although not officially, it will be in the upcoming BL63.3) which allows directly looking into the relational schema.
Taking the query system as the starting point a new Plastic module will be implemented (this is not yet started) to provide this kind of graphics I showed you but being directly calculated by the GUI tool.
Hope you liked it!
Ok, this looks good to monitor somehow what’s going on in the project, which changes someone has done, and so on. But, what about retrieving some statistics?
One of the nice things about cm find is that you can create output in XML format. Try something like:
$ cm find revs where date ">" '2007/08/1' --xml --file=statsAgo.xml
to create a file with all the information about revisions created since a given date. Once you have the XML file you can start playing around with it with your favorite tool.
I imported the data generated by cm find into Excel 2007 and then I started playing with the pivot tables. In the new 2007 release this feature is a little bit hidden: now it is under the insert menu instead of the data menu.
Well, once you create a pivot table out of the imported data you can start grouping it. Then you can show the revisions grouped by branch, including cool graphics.
Show the revisions grouped by user.
Or even calculate the how the revision creation is distributed hourly (you can discover interesting things doing that).
Or weekly:
We’re working on extending the query system to provide an easy (and powerful) way to locate merges, for instance. Also a subsystem we call “advanced query system” is already out (although not officially, it will be in the upcoming BL63.3) which allows directly looking into the relational schema.
Taking the query system as the starting point a new Plastic module will be implemented (this is not yet started) to provide this kind of graphics I showed you but being directly calculated by the GUI tool.
Hope you liked it!
0 comentarios: