From eb4c1530c57b6ae200643b259e6ed95904951681 Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Fri, 20 Apr 2012 15:46:53 +0100 Subject: Add /trees which serves the contents of a git tree using ls-tree. /trees queries take repo URI, a SHA1 ref and an optional path parameter. The result is a JSON dictionary of the form { "repo": "", "ref": "", "tree": { "filename1": { "mode": "100644", "kind": "blob", "sha1": "FOOBARBAZ" }, ... } } --- morph-cache-server | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'morph-cache-server') diff --git a/morph-cache-server b/morph-cache-server index 7618f5b..86a1fe2 100755 --- a/morph-cache-server +++ b/morph-cache-server @@ -85,6 +85,22 @@ class MorphCacheServer(cliapp.Application): response.status = 404 logging.debug('%s' % e) + @app.get('/trees') + def tree(): + repo = self._unescape_parameter(request.query.repo) + ref = self._unescape_parameter(request.query.ref) + path = self._unescape_parameter(request.query.path) + try: + tree = repo_cache.ls_tree(repo, ref, path) + return { + 'repo': '%s' % repo, + 'ref': '%s' % ref, + 'tree': tree, + } + except Exception, e: + response.status = 404 + logging.debug('%s' % e) + @app.get('/bundles') def bundle(): repo = self._unescape_parameter(request.query.repo) -- cgit v1.2.1