Colin Watson has proposed merging lp:~cjwatson/turnip/auto-create-repository
into lp:turnip.
Commit message:
Attempt to automatically create non-existent repositories on push.
Requested reviews:
Canonical Launchpad Branches (canonical-launchpad-branches)
For more details, see:
https://code.launchpad.net/~cjwatson/turnip/auto-create-repository/+merge/249058
Attempt to automatically create non-existent repositories on push.
This relies on a new createRepository XML-RPC call. I haven't planned to
implement this in turnipcake, but I have a working (though not yet pushed
anywhere) implementation in Launchpad.
--
Your team Launchpad code reviewers is subscribed to branch lp:turnip.
=== modified file 'turnip/pack/git.py'
--- turnip/pack/git.py 2015-02-09 10:23:55 +0000
+++ turnip/pack/git.py 2015-02-09 11:41:25 +0000
@@ -318,13 +318,21 @@
def requestReceived(self, command, pathname, params):
permission = b'read' if command == b'git-upload-pack' else b'write'
proxy = xmlrpc.Proxy(self.factory.virtinfo_endpoint, allowNone=True)
+ uid = int(params.get(b'turnip-authenticated-uid'))
try:
- can_authenticate = (
- params.get(b'turnip-can-authenticate') == b'yes')
- translated = yield proxy.callRemote(
- b'translatePath', pathname, permission,
- int(params.get(b'turnip-authenticated-uid')), can_authenticate)
- pathname = translated['path']
+ try:
+ can_authenticate = (
+ params.get(b'turnip-can-authenticate') == b'yes')
+ translated = yield proxy.callRemote(
+ b'translatePath', pathname, permission, uid,
+ can_authenticate)
+ pathname = translated['path']
+ except xmlrpc.Fault as e:
+ if e.faultCode in (1, 290) and permission == b'write':
+ pathname = yield proxy.callRemote(
+ b'createRepository', uid, pathname)
+ else:
+ raise
except xmlrpc.Fault as e:
if e.faultCode in (1, 290):
fault_type = b'NOT_FOUND'
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp