Template:Gitorious url
Note The Gitorious open source infrastructure is locked in a read-only archived state. |
Goal
This template is for creating direct URLs for the content of the version control repositories of the Gitorious open source infrastructure. This is equivalent to the {{gitorious source}} template with the full parameter set to 1. It is a subtemplate of the master {{repo link}} template designed to be specific for the Gitorious repositories.
Usage
{{gitorious url | cmd = | opt = | type = | proj = | repo = | branch = | tag = | commit = | path = | line = | post = | view = }}
The proj parameter, as well as the repo parameter, must be supplied. All other parameters are optional.
Parameter | Description | Abbreviated parameter |
Numbered parameter |
Status |
---|---|---|---|---|
cmd | An optional command line tool name + options to prepend to the URL. For example git clone. | optional | ||
opt | Any additional options to show after cmd, but before the URL.
|
optional | ||
type | Choose between the web interface or a direct repository link. This can be one of git, git web. The default is git web. | optional | ||
proj | The name of the project, consisting of a grouping of repositories on the open source infrastructure. | p | 1 | mandatory |
repo | The name of the repository. A project registered on one of the open source infrastructures generally allows for multiple repositories under that project name. | r | 2 | mandatory |
branch | The branch name. This defaults to next. | b | 3 | optional |
tag | The repository tag name. | t | optional | |
commit | The commit identifier (git hash). This defaults to HEAD. | c | 5 | optional |
path | The file or directory path. | f | 4 | optional |
line | The line number(s) of the file to display. | l | optional | |
post | Text to append. This is forms a set with the parameter cmd and opt. For example it can represent any command line options that come after the URL. | optional | ||
view | View to display:
|
v | optional |
Design
In this section, the following notation will be used:
- Angular brackets + lower case text
<xyz>
- Template parameters.
- Angular brackets + upper case text
<XYZ>
- Template constructed text.
- Square brackets
[xyz]
- Optional text, only added if the parameter is set.
- Or symbol
|
- The value on the left, if present, otherwise the value on the right of the symbol.
Overview
The general design is:
<cmd> <opt> <URL> <post>
Site: Gitorious
The Gitorious URLs are predominantly query rather than path based. And only the https://
protocol is supported. The base URL constructed by this template is:
<protocol>://gitorious.org/<proj>/<repo>
Gitorious <URL> for 'type=git'
For this parameter value, the complete <URL>
value will be:
<protocol>://gitorious.org/<proj>/<repo>.git
Gitorious <URL> for 'type=git web'
As the current archival system is based on queries — the text after the ?
character — absolutely any random path after the gitorious.org/
domain name can be used. But, for aesthetics, the project and repository name will be appended by this template. The <URL>
will be:
<protocol>://gitorious.org/<proj>/<repo>?<QUERY>[#l<line>]
The <QUERY>
string consists of parts for the project and repository (p=
), the type of view (a=
), the path (f=
), and the commit, branch or tag (h=
or hb=
, depending on the view).
The <URL>
fragment for the project and repository is constructed as:
<protocol>://gitorious.org/<proj>/<repo>?p=<proj>:<repo>.git
The <URL>
fragment for the view is constructed as:
<protocol>://gitorious.org/<proj>/<repo>?a=<VIEW>
Where <VIEW>
is the value of the view parameter, if supplied, with the value of raw translated to blob_plain
. If not supplied, the value of blob
is used if path is given, commit
if commit is given, or summary
otherwise.
The <URL>
fragment for the path is constructed as:
<protocol>://gitorious.org/<proj>/<repo>?f=<path>
If the view parameter is set to one of blob, raw, or tree, the <URL>
fragment for the commit, branch or tag is constructed as:
<protocol>://gitorious.org/<proj>/<repo>[?hb=refs/merge-requests/<mr>|<commit>|refs/heads/<branch>]
Otherwise it will be:
<protocol>://gitorious.org/<proj>/<repo>[?h=refs/merge-requests/<mr>|<commit>|refs/heads/<branch>]
In summary, the full web URL will be:
<protocol>://gitorious.org/<proj>/<repo>?p=<proj>:<repo>.git;a=<VIEW>[;f=<path>][;<h|hb>=refs/merge-requests/<mr>|<commit>|refs/heads/<branch>][#l<line>]
Gitorious URL <TEXT>
The link text <TEXT>
, if the full parameter is not set, will be:
<proj>/<repo>/<commit|branch|HEAD>[/<path>][#l<line>]
If the simplepath parameter is set, this changes to:
[/<path>][#l<line>]
If the pre parameter is supplied, this changes to:
<pre>[/<path>][#l<line>]
The text parameter trumps all, and <TEXT>
is simply:
<text>
Plain text
To create a URL or link as plain text and avoid external links, simply use the {{#tag:tagname|content}}
magic word construct:
{{#tag:nowiki| {{repo link | full = 1 }} }}
https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/
To use the <code> tags:
{{#tag:code|{{#tag:nowiki| {{repo link | full = 1 }} }}}}
https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/
Examples
No parameters
This is for the Gitorious website.
{{gitorious url}}.
The old FlightGear source repository
This is for the archived flightgear repository at https://gitorious.org/fg/flightgear.git. The automatically created URL, which is equivalent, should be https://gitorious.org/fg/flightgear?p=fg:flightgear.git;a=summary.
{{gitorious url | proj = fg | repo = flightgear }}.
https://gitorious.org/fg/flightgear?p=fg:flightgear.git;a=summary.
The historic fgdata repository
This is for the historic repository https://gitorious.org/fg/fgdata.git. The automatically created URL, which is equivalent, should be https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=summary.
{{gitorious url | proj = fg | repo = fgdata }}.
https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=summary.
Git clone
This is for cloning the historic fgdata repository with git clone https://gitorious.org/fg/fgdata.git
.
{{#tag:code | {{#tag:nowiki | {{gitorious url | cmd = git clone | proj = fg | repo = fgdata | type = git }}}}}}.
git clone https://gitorious.org/fg/fgdata.git
.
File with line number
{{gitorious url | proj = fg | repo = hoorays-fgdata | view = blob | branch = topics/scriptable-ai-submodule | path = Nasal/ai/ai.nas | line = 1 }}.
Raw view
{{repo link | site = gito | proj = fg | repo = hoorays-fgdata | view = raw | branch = topics/scriptable-ai-submodule | path = Nasal/ai/ai.nas }}.
gitorious/fg/hoorays-fgdata/topics/scriptable-ai-submodule/Nasal/ai/ai.nas.
Commit
{{gitorious url | proj = nasal-standalone | repo = nasal-experiments | view = commit | commit = 9b2d59c316d03b83cfb4352a38b865aa29f4c280 }}.
Commitdiff
{{gitorious url | proj = nasal-standalone | repo = nasal-experiments | view = commitdiff | commit = 9b2d59c316d03b83cfb4352a38b865aa29f4c280 }}.
Main views
Summary view
This is for https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=summary.
{{gitorious url | proj = fg | repo = fgdata | view = summary }}.
https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=summary.
Shortlog view
This is for https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=shortlog.
{{gitorious url | proj = fg | repo = fgdata | view = shortlog }}.
https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=shortlog.
Log view
This is for https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=log;h=4c03a4968d2844c9c8ba734116da3478a1bebb38.
{{gitorious url | proj = fg | repo = fgdata | view = log | commit = 4c03a4968d2844c9c8ba734116da3478a1bebb38 }}.
https://gitorious.org/fg/fgdata?p=fg:fgdata.git;a=log;h=4c03a4968d2844c9c8ba734116da3478a1bebb38.
Abbreviated parameters
{{gitorious url | p = fg | r = hoorays-fgdata | b = topics/scriptable-ai-submodule | f = Nasal/ai/ai.nas | l = 1 | v = blob }}.
Numbered parameters
{{gitorious url | fg | hoorays-fgdata | topics/scriptable-ai-submodule | Nasal/ai/ai.nas | l = 1 | v = blob }}.
Related templates
|