Fix GitRepositorySet.new, and export it on the webservice.
This was previously untested, and had been broken since r18222.
Now that namespace.createRepository can create the repository on the hosting
service, we can safely export this to create a bare repository via the API.
For example, this allows snapcraft to create a temporary repository, issue
an access token to it, and push code to it, all without needing to configure
an SSH key.
Push Git hosting creation down from XML-RPC endpoint to model.
Having the creation of the actual repository on disk be done by the XML-RPC
endpoint makes it difficult to expose other methods of creating
repositories.
I rearranged how target and owner defaults are set. We have to create the
repository on the hosting service as the last step to avoid problems with
rolling back transactions, so pushing this part down to the model also
requires pushing down target/owner default handling, and the callback
mechanism previously in place wasn't very suited to that.
I had to adjust the permission check in
GitRepositorySet.setDefaultRepository slightly, because pushing down
target/owner default handling is easier if the Unauthorized exception
message is more accurate. setDefaultRepositoryForOwner already raised
exceptions with accurate messages.
[r=bloodearnest][no-qa] Set "Content-Security-Policy: frame-ancestors
'self';
" as well as "X-Frame-Options: SAMEORIGIN", for improved browser
compatibility.
Remove parts of lp.code.mail.patches that are unmodified from bzrlib.
lp.code.mail.patches was cloned-and-hacked from bzrlib.patches in order to
support git diffs, but at the time we were in a rush and ended up copying
the whole module rather than just the parts we needed to change. This
removes all the parts that were identical except for trivial details like
whitespace.