You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Template:Gitweb/doc

From Wikitech-static
Jump to navigation Jump to search

This generates a link to a file on Gerrit.

The goal is to avoid manual URLs like

 https://gerrit.wikimedia.org/g/mediawiki/extensions/examples/+/HEAD/extension.json

and also future-proof against changes and evolution to source code viewers.

Usage

{{Gitweb |project=mediawiki/extensions/examples |file=extension.json }}

produces

extension.json
{{Gitweb |project=mediawiki/extensions/examples |file=extension.json| text=important file }}

produces

important file
{{Gitweb |project=operations/mediawiki-config}}

produces

operations/mediawiki-config

Parameters

project
mandatory. Full name of the Git repository, including any "mediawiki/extensions/" or "operations/" prefix, but without .git suffix.
file
optional. Link to a file within the project, instead of linking to the repository summary page.
text
optional. Link label text. If not specified, defaults to file name or project name.
action
ignored. (Existed in the past for use with Gitweb, but we now use Gitiles.)
branch
optional. The branch in the git repo, default 'master' (unless project=operations/puppet, in which case, default 'production')

TemplateData

<templatedata> { "params": { "project": { "label": "Project", "description": "Project (repo) name", "example": "mediawiki/core", "type": "string", "required": true }, "file": { "label": "File", "description": "File name within repo", "example": "doc/README.md", "type": "string" }, "text": { "label": "Link text", "type": "string" }, "branch": { "label": "Git branch (default 'master')", "type": "string" } }, "description": "Adds link to repo/file", "format": "inline" } </templatedata>