Mercurial > kallithea
view docs/usage/general.rst @ 8455:d727e81e0097 stable
vcs: fix cloning remote repository with HTTP authentication (Issue #379)
Using a remote clone URI of
http://user:pass@host/...
triggered an exception:
...
E File ".../kallithea/lib/utils.py", line 256, in is_valid_repo_uri
E GitRepository._check_url(url)
E File ".../kallithea/lib/vcs/backends/git/repository.py", line 183, in _check_url
E passmgr.add_password(*authinfo)
E File "/usr/lib/python3.7/urllib/request.py", line 848, in add_password
E self.reduce_uri(u, default_port) for u in uri)
E File "/usr/lib/python3.7/urllib/request.py", line 848, in <genexpr>
E self.reduce_uri(u, default_port) for u in uri)
E File "/usr/lib/python3.7/urllib/request.py", line 875, in reduce_uri
E host, port = splitport(authority)
E File "/usr/lib/python3.7/urllib/parse.py", line 1022, in splitport
E match = _portprog.fullmatch(host)
E TypeError: cannot use a string pattern on a bytes-like object
The authinfo tuple is obtained via mercurial.util.url, which unfortunately
returns a tuple of bytes whereas urllib expects strings.
It seems that mercurial internally has some more hacking around urllib as
urllibcompat.py, which we don't use.
Therefore, transform the bytes into strings before passing authinfo to
urllib. As the realm can be None, we need to check it specifically otherwise
safe_str would return a string 'None'.
A basic test that catches the mentioned problem is added, even though it
does not actually test that cloning with auth info will actually work (it
only tests that it fails cleanly if the URI is not reachable).
Additionally, one use of 'test_uri' in hg/repository.py still needed to be
transformed from bytes to string. For git this was already ok.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Wed, 22 Jul 2020 21:55:57 +0200 |
parents | 977e7aca38b1 |
children | a3f649baa016 |
line wrap: on
line source
.. _general: ======================= General Kallithea usage ======================= Repository deletion ------------------- When an admin or owner deletes a repository, Kallithea does not physically delete said repository from the filesystem, but instead renames it in a special way so that it is not possible to push, clone or access the repository. There is a special command for cleaning up such archived repositories:: kallithea-cli repo-purge-deleted -c my.ini --older-than=30d This command scans for archived repositories that are older than 30 days, displays them, and asks if you want to delete them (unless given the ``--no-ask`` flag). If you host a large amount of repositories with forks that are constantly being deleted, it is recommended that you run this command via crontab. It is worth noting that even if someone is given administrative access to Kallithea and deletes a repository, you can easily restore such an action by renaming the repository directory, removing the ``rm__<date>`` prefix. File view: follow current branch -------------------------------- In the file view, left and right arrows allow to jump to the previous and next revision. Depending on the way revisions were created in the repository, this could jump to a different branch. When the checkbox ``Follow current branch`` is checked, these arrows will only jump to revisions on the same branch as the currently visible revision. So for example, if someone is viewing files in the ``beta`` branch and marks the `Follow current branch` checkbox, the < and > arrows will only show revisions on the ``beta`` branch. Changelog features ------------------ The core feature of a repository's ``changelog`` page is to show the revisions in a repository. However, there are several other features available from the changelog. Branch filter By default, the changelog shows revisions from all branches in the repository. Use the branch filter to restrict to a given branch. Viewing a changeset A particular changeset can be opened by clicking on either the changeset hash or the commit message, or by ticking the checkbox and clicking the ``Show selected changeset`` button at the top. Viewing all changes between two changesets To get a list of all changesets between two selected changesets, along with the changes in each one of them, tick the checkboxes of the first and last changeset in the desired range and click the ``Show selected changesets`` button at the top. You can only show the range between the first and last checkbox (no cherry-picking). From that page, you can proceed to viewing the overall delta between the selected changesets, by clicking the ``Compare revisions`` button. Creating a pull request You can create a new pull request for the changes of a particular changeset (and its ancestors) by selecting it and clicking the ``Open new pull request for selected changesets`` button. Permanent repository URLs ------------------------- Due to the complicated nature of repository grouping, URLs of repositories can often change. For example, a repository originally accessible from:: http://kallithea.example.com/repo_name would get a new URL after moving it to test_group:: http://kallithea.example.com/test_group/repo_name Such moving of a repository to a group can be an issue for build systems and other scripts where the repository paths are hardcoded. To mitigate this, Kallithea provides permanent URLs using the repository ID prefixed with an underscore. In all Kallithea URLs, for example those for the changelog and the file view, a repository name can be replaced by this ``_ID`` string. Since IDs are always the same, moving the repository to a different group will not affect such URLs. In the example, the repository could also be accessible as:: http://kallithea.example.com/_<ID> The ID of a given repository can be shown from the repository ``Summary`` page, by selecting the ``Show by ID`` button next to ``Clone URL``. Email notifications ------------------- With email settings properly configured in the Kallithea configuration file, Kallithea will send emails on user registration and when errors occur. Emails are also sent for comments on changesets. In this case, an email is sent to the committer of the changeset (if known to Kallithea), to all reviewers of the pull request (if applicable) and to all people mentioned in the comment using @mention notation. Trending source files --------------------- Trending source files are calculated based on a predefined dictionary of known types and extensions. If an extension is missing or you would like to scan custom files, it is possible to extend the ``LANGUAGES_EXTENSIONS_MAP`` dictionary located in ``kallithea/config/conf.py`` with new types. Cloning remote repositories --------------------------- Kallithea has the ability to clone repositories from given remote locations. Currently it supports the following options: - hg -> hg clone - svn -> hg clone - git -> git clone .. note:: svn -> hg cloning requires the ``hgsubversion`` library to be installed. If you need to clone repositories that are protected via basic authentication, you can pass the credentials in the URL, e.g. ``http://user:passw@remote.example.com/repo``. Kallithea will then try to login and clone using the given credentials. Please note that the given credentials will be stored as plaintext inside the database. However, the authentication information will not be shown in the clone URL on the summary page. Specific features configurable in the Admin settings ---------------------------------------------------- In general, the Admin settings should be self-explanatory and will not be described in more detail in this documentation. However, there are a few features that merit further explanation. Repository extra fields ^^^^^^^^^^^^^^^^^^^^^^^ In the *Visual* tab, there is an option "Use repository extra fields", which allows to set custom fields for each repository in the system. Once enabled site-wide, the custom fields can be edited per-repository under *Options* | *Settings* | *Extra Fields*. Example usage of such fields would be to define company-specific information into repositories, e.g., defining a ``repo_manager`` key that would give info about a manager of each repository. There's no limit for adding custom fields. Newly created fields are accessible via the API. Meta tagging ^^^^^^^^^^^^ In the *Visual* tab, option "Stylify recognised meta tags" will cause Kallithea to turn certain text fragments in repository and repository group descriptions into colored tags. Currently recognised tags are:: [featured] [stale] [dead] [lang => lang] [license => License] [requires => Repo] [recommends => Repo] [see => URI]