Blob Blame Raw
{% extends "repo_master.html" %}

{% block title %}{{ repo.name }}{% endblock %}
{%block tag %}home{% endblock %}


{% block repo %}

{% if repo_obj and repo_obj.is_empty %}

  <section class="repo_info">
    <p>This repo is brand new!</p>

    <p>If you already have a git repo:</p>
    <pre>
      git remote add origin https://githosted.org/{{ repo.name }}.git
      git push -u origin master
    </pre>

    <p>If you have no create your git repo yet:</p>
    <pre>
      touch README.rst
      git init
      git add README.rst
      git commit -m "Add README file"
      git remote add origin https://githosted.org/{{ repo.name }}.git
      git push -u origin master
    </pre>

    </section>

{% else %}
  <section class="branch_list">
    <h3>Branches</h3>
    <ul>
      {% for branch in branches %}
      <li>
        {% if '/fork/' in request.url %}
          <a href="{{ url_for('view_fork_repo_branch',
                    username=username, repo=repo.name, branchname=branch) }}">
        {% else %}
        <a href="{{ url_for('view_repo_branch',
                    repo=repo.name, branchname=branch) }}">
        {% endif %}
          {{ branch }}
        </a>
        {% if '/fork/' in request.url %}
          (<a href="{{ url_for('view_fork_log', username=username,
                     repo=repo.name, branchname=branch) }}">logs</a>)
        {% else %}
          (<a href="{{ url_for('view_log',
                     repo=repo.name, branchname=branch) }}">logs</a>)
        {% endif %}

      </li>
      {% endfor %}
    </ul>
  </section>

  {% if total_page %}
  <table>
    <tr>
      <td>
      {% if page > 1%}
        {% if '/fork/' in request.url %}
          <a href="{{ url_for('.%s' % origin, username=username,
                    repo=repo.name) }}?page={{page - 1}}">
        {% else %}
          <a href="{{ url_for('.%s' % origin,
                    repo=repo.name) }}?page={{page - 1}}">
        {% endif %}
            &lt; Previous
        </a>
      {% else %}
          &lt; Previous
      {% endif %}
      </td>
      <td>{{ page }} / {{ total_page }}</td>
      <td>
        {% if page < total_page %}
        {% if '/fork/' in request.url %}
        <a href="{{ url_for('.%s' % origin, username=username,
                    repo=repo.name) }}?page={{page + 1}}">
        {% else %}
          <a href="{{ url_for('.%s' % origin,
                    repo=repo.name) }}?page={{page + 1}}">
        {% endif %}
            Next &gt;
        </a>
        {% else %}
        Next >
        {% endif %}
      </td>
    </tr>
  </table>
  {% endif %}

  <section class="commit_list">
    {% if origin == 'view_log' or origin == 'view_fork_log' %}
    <h3>Commits list</h3>
    {% else %}
    <h3>Last 10 commits</h3>
    {% endif %}
    {% if diff_commits %}
    <span id="request_pull">
        <a href="{{ url_for('request_pull',
                    username=username, repo=repo.name) }}">Request pull</a>
    </span>
    {% endif %}
    <ul>
      {% for commit in last_commits %}
      <li>
        {% if '/fork/' in request.url %}
          <a href="{{ url_for('view_fork_commit', username=username,
                  repo=repo.name, commitid=commit.hex) }}">
        {% else %}
          <a href="{{ url_for('view_commit',
                  repo=repo.name, commitid=commit.hex) }}">
        {% endif %}

        {{ commit.hex[:6] }}
        </a>
        {{ commit.message.split('\n')[0] }}
        {% if diff_commits and commit.oid.hex in diff_commits %}
        <span class="error" title="Commit not in the main repo">*</span>
        (<a href="{{ url_for('request_pull',
                    username=username, repo=repo.name, commitid=commit.oid.hex) }}"
                >Request pull</a>)
        {% endif %}
      </li>
      {% endfor %}
    </ul>
  </section>

  {% if tree %}
    <section class="tree_list">
      <h3>Current tree</h3>
      <ul>
        {% for entry in tree %}
        <li>
          {% if entry.filemode == 16384 %}
          [ ]
          {% endif %}
          {% if '/fork/' in request.url %}
            <a href="{{ url_for('view_fork_file', username=username,
                      repo=repo.name, identifier=branchname, filename=entry.name) }}">
          {% else %}
            <a href="{{ url_for('view_file',
                      repo=repo.name, identifier=branchname, filename=entry.name) }}">
          {% endif %}
            {{ entry.name }}
          </a>
          {{ entry.hex }}
          {{ entry.id }}
        </li>
        {% endfor %}
      </ul>
    </section>
  {% endif %}

{% endif %}

{% endblock %}