WIP: Threaded segments

Adds threaded segments as requested in #168.

TODO:

[ ] Fix documentation issues: `ThreadedSegment` class instances are not documented as functions. The question is [here](http://stackoverflow.com/questions/15454551/documenting-class-instance-as-a-function), but I guess I already knew the answer: I will have to write sphinx extension.
[ ] Fix problems with `pygit2`/`mercurial`/`bzr` colored branch segments on large repositories. Ref #331.
[ ] Finally add tests that are currently marked as TODO.

WIP, do not merge.