gitweb: Allow to import from a remote repository

- Allow to enter either name or URL when creating repository

- Validate a repository URL, allow only http and https schemes

- Set autocomplete off on the name/URL field because URL may contain
  username:password

- Check whether the repository actually exists before cloning

- Show progress info while cloning

- Actions script: new subcommand check-repo-exists and new arguments
  for the create-repo: --url, --prepare-only and --skip-prepare

- Add test for invalid URLs

Closes #1670

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Fix validating repo name in edit form]
[sunil: Don't pipe stdin of clone process, it may lead to a hang]
[sunil: Always run clone process with 'C' locale since we are parsing output]
[sunil: Cosmetic changes]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa authored and Sunil Mohan Adapa committed 2019-11-04 21:16:30 -08:00
1 parent ca0c991562
commit c99b33b40e
6 files changed
+378 -88

No files matched your search

@@ -20,6 +20,7 @@
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block page_head %}
<style type="text/css">
@@ -33,6 +34,9 @@
.list-group-item .btn {
margin: -5px 2px;
}
.repo-cloning {
margin: 0px 10px;
}
</style>
{% endblock %}
@@ -58,13 +62,13 @@
{% for repo in repos %}
<div class="list-group-item clearfix">
<a href="{% url 'gitweb:delete' repo.name %}"
class="btn btn-default btn-sm pull-right"
class="btn btn-default btn-sm pull-right {% if 'clone_progress' in repo %} disabled {% endif %}"
role="button"
title="{% blocktrans %}Delete repository {{ repo.name }}{% endblocktrans %}">
<span class="fa fa-trash-o" aria-hidden="true"></span>
</a>
<a class="repo-edit btn btn-sm btn-default pull-right"
<a class="repo-edit btn btn-sm btn-default pull-right {% if 'clone_progress' in repo %} disabled {% endif %}"
href="{% url 'gitweb:edit' repo.name %}">
<span class="fa fa-pencil-square-o" aria-hidden="true"></span>
</a>
@@ -74,10 +78,17 @@
aria-label="private"></span>
{% endif %}
<a class="repo-label" href="/gitweb/{{ repo.name }}.git"
title="{% blocktrans %}Go to repository {{ repo.name }}{% endblocktrans %}">
{{ repo.name }}
</a>
{% if 'clone_progress' in repo %}
<span class="repo-cloning pull-right">
{% trans 'Cloning...' %} {{ repo.clone_progress }}%
</span>
<span class="repo-label">{{ repo.name }}<span>
{% else %}
<a class="repo-label" href="/gitweb/{{ repo.name }}.git"
title="{% blocktrans %}Go to repository {{ repo.name }}{% endblocktrans %}">
{{ repo.name }}
</a>
{% endif %}
</div>
{% endfor %}
</div>
@@ -86,3 +97,12 @@
</div>
{% endblock %}
{% block page_js %}
{% if cloning %}
<script type="text/javascript" src="{% static 'theme/js/refresh.js' %}"></script>
{% endif %}
{% endblock %}