Template:Phab file

From MediaWiki.org
Jump to navigation Jump to search

{{{file}}}

Template documentation

Test replacement for {{git file}} that links to file in Phabricator's diffusion instead of soon-to-be-deprecated gitblit at git.wikimedia.org (phab:T128).
{{git file}} now does this, using Module:Callsigns, so this is obsolete.

Big issue is mapping a gerrit project= path to Phabricator callsign (see discussion at phab:T101358).

(below copied from Template:Git file/doc)

This generates a link to a file on https://phabricator.wikimedia.org/diffusion/.

Usage[edit]

Basic
{{phab file |file=composer.json }}
{{phab file |project=mediawiki/extensions/Flow |file=composer.json }}

produces

composer.json
composer.json
action
{{phab file |project=mediawiki/extensions/EventLogging 
|file=server/bin/eventlogging-devserver
|text=development server | action=raw }}

produces

development server
line number
{{phab file |file=tests/phpunit/includes/MessageTest.php |line=152 }}

produces

tests/phpunit/includes/MessageTest.php
project summary page
{{phab file |project=mediawiki/extensions/EventLogging |action=summary
|text=EventLogging extension}}

produces

EventLogging extension

See also {{gitblit}}

more tests[edit]

While developing this template:

Unimplemented project
{{phab file |project=mediawiki/extensions/NotMapped |file=Test.php }}

produces Test.php

other projects

phabricator/tools: README

Parameters[edit]

project
defaults to mediawiki/core. Must be entire path to project — e.g. mediawiki/extensions/EventLogging, not "EventLogging" and without any .git suffix.
branch
defaults to HEAD.
file
optional. A file or directory within the project, without the leading '/'. If you just want to link to the project, use {{gitweb}}. 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 Gitblit action, e.g. action=raw , action=blame, action=history. Use action=tree to link to a directory in the project. Note: Gitblit 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[edit]

Notes[edit]

still true with diffusion? 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[edit]

  • {{{file}}}, this template's code will replace it
  • This replaces Template:GitwebFile which had almost exactly the same functionality (but undocumented and uncategorized so pages missed it).
  • {{gitblit}} generates link to repo summary
  • {{MW file}} generates complicated link to file, used by Manual.
  • lots of other fancy templates for extensions on gerrit, see Category:Git.
  • {{github}}