Rewrote rtgitlib.py