|
a/Allura/allura/controllers/repository.py |
|
b/Allura/allura/controllers/repository.py |
|
... |
|
... |
18 |
import os
|
18 |
import os
|
19 |
import json
|
19 |
import json
|
20 |
import logging
|
20 |
import logging
|
21 |
import re
|
21 |
import re
|
22 |
import difflib
|
22 |
import difflib
|
23 |
from urllib import quote, unquote
|
23 |
from urllib import quote, unquote, quote_plus
|
24 |
from collections import defaultdict
|
24 |
from collections import defaultdict
|
25 |
from itertools import islice
|
25 |
from itertools import islice
|
26 |
|
26 |
|
27 |
from pylons import tmpl_context as c, app_globals as g
|
27 |
from pylons import tmpl_context as c, app_globals as g
|
28 |
from pylons import request, response
|
28 |
from pylons import request, response
|
|
... |
|
... |
457 |
result = dict(commit=self._commit)
|
457 |
result = dict(commit=self._commit)
|
458 |
if self._commit:
|
458 |
if self._commit:
|
459 |
result.update(self._commit.context())
|
459 |
result.update(self._commit.context())
|
460 |
return result
|
460 |
return result
|
461 |
|
461 |
|
462 |
@require_post()
|
|
|
463 |
@expose('jinja:allura:templates/repo/tarball.html')
|
462 |
@expose('jinja:allura:templates/repo/tarball.html')
|
464 |
def tarball(self, **kw):
|
463 |
def tarball(self, **kw):
|
465 |
path = kw.pop('path', None)
|
464 |
path = request.params.get('path')
|
466 |
if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
|
465 |
if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
|
467 |
raise exc.HTTPNotFound()
|
466 |
raise exc.HTTPNotFound()
|
468 |
rev = self._commit.url().split('/')[-2]
|
467 |
rev = self._commit.url().split('/')[-2]
|
469 |
status = c.app.repo.get_tarball_status(rev, path)
|
468 |
status = c.app.repo.get_tarball_status(rev, path)
|
470 |
if status is None:
|
469 |
if status is None and request.method == 'POST':
|
471 |
allura.tasks.repo_tasks.tarball.post(revision=rev, path=path)
|
470 |
allura.tasks.repo_tasks.tarball.post(revision=rev, path=path)
|
|
|
471 |
redirect('tarball' + '?path={0}'.format(path) if path else '')
|
472 |
return dict(commit=self._commit, revision=rev, status=status)
|
472 |
return dict(commit=self._commit, revision=rev, status=status or 'na')
|
473 |
|
473 |
|
474 |
@expose('json:')
|
474 |
@expose('json:')
|
475 |
def tarball_status(self, path=None, **kw):
|
475 |
def tarball_status(self, path=None, **kw):
|
476 |
if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
|
476 |
if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
|
477 |
raise exc.HTTPNotFound()
|
477 |
raise exc.HTTPNotFound()
|
478 |
rev = self._commit.url().split('/')[-2]
|
478 |
rev = self._commit.url().split('/')[-2]
|
479 |
return dict(status=c.app.repo.get_tarball_status(rev, path))
|
479 |
return dict(status=c.app.repo.get_tarball_status(rev, path) or 'na')
|
480 |
|
480 |
|
481 |
|
481 |
|
482 |
@expose('jinja:allura:templates/repo/log.html')
|
482 |
@expose('jinja:allura:templates/repo/log.html')
|
483 |
@with_trailing_slash
|
483 |
@with_trailing_slash
|
484 |
@validate(dict(page=validators.Int(if_empty=0),
|
484 |
@validate(dict(page=validators.Int(if_empty=0),
|