localrepo: Add WriteTree and WriteCommit methods
Add a WriteTree method to write trees into a localrepo.Repo, and a WriteCommit to write commits into a localrepo.Repo. These will come in handy when we need to do manual writing of commits and trees, especially in replacing a lot of the operations RPCs to not use libgit2.