Provide a method to write a tree to an archive

Add Repository.write_archive() to write a given tree to an archive. As
there are many customisation options, we only provide a method to write
to an archive which is created by the user.

Off of #358 this provides a standard way of writing some data into a tarfile, giving the user control over the interesting parts while doing the boring loop. I added the timestamp as a way to provide a timestamp from e.g. a commit when writing a subtree (and thus cannot pass the commit as the treeish), but I don't think we should add much more, since the point of this is to do whatever git does and provide a starting point if someone wants to write stuff in a custom way.

There may be a way to perform one less copy when reading from the object, as IIRC this was written before we had a memoryview into blobs, but this should be good enough for now.