doc

From Encyclopedia of Scientonomy
Jump to navigation Jump to search

Template:Mbox Template:Timw

This generates a link to a file in Diffusion (Phabricator).

If this template is not working for a repository, make sure its callsign is listed in Module:Callsigns.

Usage

Basic
{{git file |file=composer.json }}

produces

Script error: No such module "callsigns"./browse/master/composer.json composer.json
{{git file |project=mediawiki/extensions/Flow |file=FlowActions.php }}

produces

Script error: No such module "callsigns"./browse/master/FlowActions.php FlowActions.php
text
{{git file |project=mediawiki/extensions/EventLogging 
|file=server/bin/eventlogging-devserver
|text=development server }}

produces

Script error: No such module "callsigns"./browse/master/server/bin/eventlogging-devserver development server
action
{{git file |file=composer.json |action=raw }}
{{git file |file=composer.json |action=blame }}
{{git file |file=composer.json |action=history }}

produces

Script error: No such module "callsigns"./browse/master/composer.json?view=raw composer.json
Script error: No such module "callsigns"./browse/master/composer.json?blame=1 composer.json
Script error: No such module "callsigns"./history/master/composer.json composer.json
{{git file |project=mediawiki/extensions/EventLogging |text=EventLogging extension |action=tree }}

produces

Script error: No such module "callsigns"./browse/master/ EventLogging extension
line number
{{git file |file=tests/phpunit/includes/MessageTest.php |line=123 }}

produces

Script error: No such module "callsigns"./browse/master/tests/phpunit/includes/MessageTest.php$123 tests/phpunit/includes/MessageTest.php
project summary page (deprecated)
{{git file |project=oojs/core |action=summary |text=OOjs (core)}}

produces

Script error: No such module "callsigns"./summary/master/ OOjs (core)

^ 2015-08-27 this is actually only working by coincidence, https://phabricator.wikimedia.org/diffusion/GOJS/blahblah/anythingUnrecognized also redirects to the simple https://phabricator.wikimedia.org/diffusion/GOJS/ summary page
Instead use the proper Template:Tl template.

Parameters

project
defaults to mediawiki/core. Must be entire path to project — e.g. mediawiki/extensions/EventLogging, not "EventLogging" and without any .git suffix. The template uses Module:Callsigns to map this to a Diffision "callsign", e.g. EEVL.
branch
defaults to HEAD, or you can specify e.g. branch=REL1_25. TODO: unlike old gitblit URLs, this doesn't work to link to a particular commit.
file
optional. A file or directory within the project, without the leading '/'. If you just want to link to the project, use Template:Tl. Note to avoid confusion you may want to invoke this template with underscore — {{git_file | file=name}}.
text
optional. The text that's linked. If not specified, defaults to file.
action
optional. You can give a Diffusion view action Gitblit action, e.g. action=raw , action=blame (enables Diffusion "blame mode"), action=history. Use action=tree to link to a directory in the project. Note: Diffusion doesn't support gerrit/gitweb's action blob_plain
line
optional. line=42 will add a fragment to the URL that positions the browser at line 42 of the file.

Known issues

Notes

The template has to use numeric entities &#59; and &32; for semicolon and hashmark because, as WP:Advanced template coding says, "MediaWiki wiki-formats the clauses inside #if". MediaWiki would sometimes parse these characters as introducing a definition term and numbered list (even though they're not at the start of new lines!).

See also