From 91a7c0366b225e0ec77207163140e42511467931 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 18 2014 16:15:15 +0000 Subject: Revert the change to put the project under the username namespace Project will be at the top level namespace and only forks will be under the username's namespace --- diff --git a/progit/app.py b/progit/app.py index b2731c5..fa87d23 100644 --- a/progit/app.py +++ b/progit/app.py @@ -37,22 +37,22 @@ def index(): limit = APP.config['ITEM_PER_PAGE'] start = limit * (page - 1) end = limit * page - users = sorted(os.listdir(APP.config['GIT_FOLDER'])) - users_length = len(users) + repos = sorted(os.listdir(APP.config['GIT_FOLDER'])) + repos_length = len(repos) - total_page = int(ceil(users_length / float(limit))) + total_page = int(ceil(repos_length / float(limit))) - users = users[start:end] + repos = repos[start:end] return flask.render_template( 'index.html', - users=users, + repos=repos, total_page=total_page, page=page, ) -@APP.route('/') +@APP.route('/user/') def view_user(username): """ Front page of a specific user. """ @@ -89,11 +89,11 @@ def view_user(username): ) -@APP.route('//') -def view_repo(username, repo): +@APP.route('/') +def view_repo(repo): """ Front page of a specific repo. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -109,7 +109,6 @@ def view_repo(username, repo): return flask.render_template( 'repo_info.html', repo=repo, - username=username, branches=sorted(repo_obj.listall_branches()), branchname='master', last_commits=last_commits, @@ -117,11 +116,11 @@ def view_repo(username, repo): ) -@APP.route('///branch/') -def view_repo_branch(username, repo, branchname): +@APP.route('//branch/') +def view_repo_branch(repo, branchname): """ Displays the information about a specific branch. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -142,7 +141,6 @@ def view_repo_branch(username, repo, branchname): return flask.render_template( 'repo_info.html', repo=repo, - username=username, branches=sorted(repo_obj.listall_branches()), branchname=branchname, last_commits=last_commits, @@ -150,12 +148,12 @@ def view_repo_branch(username, repo, branchname): ) -@APP.route('///log') -@APP.route('///log/') -def view_log(username, repo, branchname=None): +@APP.route('//log') +@APP.route('//log/') +def view_log(repo, branchname=None): """ Displays the logs of the specified repo. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -191,7 +189,6 @@ def view_log(username, repo, branchname=None): 'repo_info.html', origin='view_log', repo=repo, - username=username, branches=sorted(repo_obj.listall_branches()), branchname=branchname, last_commits=last_commits, @@ -200,12 +197,12 @@ def view_log(username, repo, branchname=None): ) -@APP.route('///blob//') -@APP.route('///blob//') -def view_file(username, repo, identifier, filename): +@APP.route('//blob//') +@APP.route('//blob//') +def view_file(repo, identifier, filename): """ Displays the content of a file or a tree for the specified repo. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -258,7 +255,6 @@ def view_file(username, repo, identifier, filename): return flask.render_template( 'file.html', repo=repo, - username=username, branchname=branchname, filename=filename, content=content, @@ -266,11 +262,11 @@ def view_file(username, repo, identifier, filename): ) -@APP.route('///') -def view_commit(username, repo, commitid): +@APP.route('//') +def view_commit(repo, commitid): """ Render a commit in a repo """ - reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -300,7 +296,6 @@ def view_commit(username, repo, commitid): return flask.render_template( 'commit.html', repo=repo, - username=username, commitid=commitid, commit=commit, diff=diff, @@ -308,12 +303,12 @@ def view_commit(username, repo, commitid): ) -@APP.route('///tree/') -@APP.route('///tree/') -def view_tree(username, repo, identifier=None): +@APP.route('//tree/') +@APP.route('//tree/') +def view_tree(repo, identifier=None): """ Render the tree of the repo """ - reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -337,7 +332,6 @@ def view_tree(username, repo, identifier=None): return flask.render_template( 'file.html', repo=repo, - username=username, branchname=branchname, filename='', content=content, diff --git a/progit/templates/commit.html b/progit/templates/commit.html index bedbc99..aad4ae5 100644 --- a/progit/templates/commit.html +++ b/progit/templates/commit.html @@ -7,12 +7,12 @@ {% block content %}

- + {{ repo.split('.git')[0] }} (tree)

@@ -38,7 +38,7 @@ {% for parent in commit.parents %} + repo=repo, commitid=parent.oid.hex) }}"> {{ parent.oid.hex }}
{% endfor %} diff --git a/progit/templates/file.html b/progit/templates/file.html index 6de946d..94017d0 100644 --- a/progit/templates/file.html +++ b/progit/templates/file.html @@ -8,11 +8,11 @@

+ repo=repo)}}"> {{ repo.split('.git')[0] }} : + repo=repo, identifier=branchname) }}"> {{ branchname }}/{% for file in filename.split('/') %} {% if loop.first %} @@ -22,7 +22,7 @@ {% endif %} {% if loop.index != loop.length %} {{ file }}/{% else %} @@ -45,7 +45,6 @@ [ ] {% endif %} diff --git a/progit/templates/index.html b/progit/templates/index.html index 5a56a56..eaa1353 100644 --- a/progit/templates/index.html +++ b/progit/templates/index.html @@ -6,7 +6,7 @@ {% block content %} -

...

+

Projects

{% if total_page %} @@ -34,12 +34,12 @@
{% endif %} -
+