Revision 2154530 of "Template:Phab file/doc" on mediawikiwiki

{{Documentation subpage}}
{{TNT|Historical|[[Template:Git file]] now uses Diffusion in Phabricator}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->

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

Big issue is mapping a gerrit <code>project=</code> path to Phabricator callsign (see discussion at [[phab:T101358]]).

(below copied from [[Template:Git file/doc]])

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

== Usage ==
; Basic
 <nowiki>{{phab file</nowiki> |file=''composer.json'' }}
 <nowiki>{{phab file</nowiki> |project=mediawiki/extensions/''Flow'' |file=''composer.json'' }}
produces
:{{phab file|file=composer.json }}
:{{phab file|project=mediawiki/extensions/Flow|file=composer.json }}

; action
 <nowiki>{{phab file</nowiki> |project=mediawiki/extensions/EventLogging 
 |file=server/bin/eventlogging-devserver
 |text=development server | action=raw }}
produces
:{{phab file|project=mediawiki/extensions/EventLogging 
 |file=server/bin/eventlogging-devserver
 |text=development server |action=raw}}

; line number
 <nowiki>{{phab file |file=tests/phpunit/includes/MessageTest.php |line=152 }}</nowiki>
produces
:{{phab file |file=tests/phpunit/includes/MessageTest.php |line=152 }}

; project summary page
 <nowiki>{{phab file</nowiki> |project=mediawiki/extensions/EventLogging |action=summary
 |text=EventLogging extension}}
produces
:{{phab file |project=mediawiki/extensions/EventLogging |action=summary |text=EventLogging extension}}
''See also {{tl|gitblit}}''

===  more tests ===
While developing this template:

; Unimplemented project: <nowiki>{{phab file</nowiki> |project=mediawiki/extensions/NotMapped |file=Test.php }}
produces
{{phab file |project=mediawiki/extensions/NotMapped |file=Test.php }}

; other projects
phabricator/tools: {{phab file |project=phabricator/tools |file=README}}

=== Parameters ===
; project
: defaults to mediawiki/core. Must be entire path to project &mdash; e.g. mediawiki/extensions/EventLogging, not "EventLogging" and without any <tt>.git</tt> suffix.
; branch
: defaults to HEAD.
; file
: optional. A file or directory within the project, without the leading ''''/'''<nowiki>'</nowiki>.  If you just want to link to the project, use {{tl|gitweb}}. Note to avoid confusion you may want to invoke this template with underscore &mdash; <code><nowiki>{{git</nowiki>'''_'''file | file=''name''}}</code>.
; text
: optional. The text that's linked.  If not specified, defaults to file.
; action
: optional. You can give a Gitblit action, e.g. <code>action=raw</code> , <code>action=blame</code>, <code>action=history</code>. Use <code>action=tree</code> to link to a directory in the project. ''Note:'' Gitblit doesn't support gerrit/gitweb's action blob_plain
; line
: optional. <code>line=42</code> will add a fragment to the URL that positions the browser at line 42 of the file.

== Known Issues ==
* Merge with {{tl|Git}}, or maybe {{tl|Gerrit}}, {{tl|MW file}}, etc. but simpler?

== Notes ==
''still true with diffusion?'' The template has to use numeric entities <code>&amp;#59;</code> and <code>&amp;32;</code> for semicolon and hashmark because, as [[w:Wikipedia:Advanced_template_coding#MediaWiki_wiki-formats_the_clauses_inside_.23if|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 ==
* {{git 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).
* {{tl|gitblit}} generates link to repo summary
* {{tl|MW file}} generates complicated link to file, used by [[Manual]].
* lots of other fancy templates for extensions on gerrit, see [[:Category:Git]].
* {{tl|github}}

<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Git| ]]
}}</includeonly>