def overview(repository, tree): repo = GitRepository(repository=get_repository_path(repository)) return dict( repository=repo, treeid=tree )
def commit(repository, tree): repo = GitRepository(repository=get_repository_path(repository)) return dict( repository=repo, treeid=tree, )
def blame(repository, tree, path): repo = GitRepository(repository=get_repository_path(repository)) return dict( repository=repo, treeid=tree, breadcrumbs=path.split("/") )
def browse(repository, tree): repo = GitRepository(repository=get_repository_path(repository)) return dict( repository=repo, treeid=tree, browse=True )
def raw(repository, tree, path): repo = GitRepository(repository=get_repository_path(repository)) blob = repo.blob('/'.join([tree, path])) # create a response with the correct mime type from flask import make_response response = make_response(blob.data) response.mimetype = blob.mime_type return response
def browse_sub(repository, tree, path): repo = GitRepository(repository=get_repository_path(repository)) return dict( repository=repo, treeid=tree, breadcrumbs=path.split("/"), browse=True )
def empty(repository): repo = GitRepository(repository=get_repository_path(repository), force=True) # if not really empty, then redirect to overview if not repo.is_empty: return redirect(url_for('.overview', repository=repository, tree=repo.active_branch)) return dict( repository=repo )
def test(*args, **kwargs): id = GitRepository.resolve_ref(get_repository_path(kwargs['repository']), kwargs['tree']) path = "" for field in additional_fields: path = path + "-" + kwargs[field] if id is not None: return prefix + "-" + kwargs['repository'] + "-" + id + path return None
def download(repository, tree): repo = GitRepository(repository=get_repository_path(repository)) data = repo.archive(tree) # create a response with the correct mime type # and a better filename from flask import make_response response = make_response(data) response.mimetype = 'application/x-tar' response.headers['Content-Disposition'] = "attachment; filename=%s-%s.tar" % (repository, tree[:8]) return response
def index(): # compute the names of repositories try: dirnames = os.walk(get_repository_base()).next()[1] except StopIteration: logging.warning("repository base %s does not exist", dirnames) return dict(repositories=[]) paths = (get_repository_path(name) for name in dirnames) paths = (path for path in paths if GitRepository.isRepository(path)) return dict( repositories=[ GitRepository(repository=path, force=True) for path in paths ] )
def shortlog(repository, tree): repo = GitRepository(repository=get_repository_path(repository)) count = repo.commit_count(tree) page = get_page() # lower limit if page < 0: page = 0 # upper limit if page*10 > count: page = count / 10 return dict( repository=repo, treeid=tree, page = page, max_pages = count / 10 )
def get_ref(self, repository, tree): from pyggi.lib.utils import get_repository_path from pyggi.lib.repository.gitr import GitRepository return GitRepository.resolve_ref(get_repository_path(repository), tree)
def get_repository(self, name): from pyggi.lib.utils import get_repository_path from pyggi.lib.repository.gitr import GitRepository return GitRepository(repository=get_repository_path(name))
def repository(repository): repo = GitRepository(repository=get_repository_path(repository)) return dict( repository=repo )