Fetch support.

This supersedes #203.

It looks mostly ready so I'm open to suggestions. It misses tests (again :-S) and documentation.
Well, since branches are usually backed by references, it made sense to have a quick way to grab that underlying reference... I'm just thinking that this will cause duplication in client code for that separate lookup, but I'm not sure how to actually fix both that and the "new object each time" at the same time, so I'll drop it.