Perforce MediaWiki extension

From PDWiki

Jump to: navigation, search


Contents

Tags implemented by this extension

The Perforce MediaWiki extension implements the following tags:

p4change

The p4change tag produces a P4Web link to a Perforce changelist. The usage is as follows:

<p4change>1234</p4change>
<p4change style="long">1234</p4change>

The first form produces a simple link containing only the change number:

1234

The second form produces a full line containing additional information fetched from Perforce:

Change 1234 on 2002/01/08 by david_abrahams@morepie 'Newly added files were missing '


p4changes

The p4changes tag produces a list of Perforce changelists. The usage is as follows:

<p4changes num="5" path="//public/jam/src/..."/>
<p4changes num="5" path="//public/jam/src/..." desc="short|long|full"/>
<p4changes num="5" path="//public/jam/src/..." desc="short|long|full" user="seiwald"/>

The following example uses all of the parameters (<p4changes num="3" path="//public/jam/src/..." desc="long" user="seiwald"/>):

  • Change 4409 on 2004/08/19 by seiwald@golly-seiwald
      Drop 'rc3' moniker of jam-2.5. Folded rc2 and rc3 RELNOTES into
      the main part of the document. Built new tar/zip balls.
      Only 16 months later.
  • Change 3072 on 2003/04/09 by seiwald@golly-seiwald
      Bring generated jam files up to date.
  • Change 3071 on 2003/04/09 by seiwald@golly-seiwald
      Bring generated jam files up-to-date.

Note that this is equivalent to running the command: p4 changes -m3 -L -u seiwald //public/jam/src/...

p4print

The p4print tag places the contents of a depot file directly into the page. The usage is as follows:

<p4print path="//public/jam/src/execunix.c"/>

The file contents will be rendered as raw text inside a <pre> tag, with any HTML escaped.

p4variants

The p4variants tag produces a list of branches from a specified path that have changes in them which have not yet been integrated back. This is a time-consuming query, so this tag uses AJAX to load the output on demand rather than automatically including it in the page. The usage is as follows:

<p4variants path="//public/perforce/utils/reviewd/p4review.py"/>

The supplied path may be a single file or a directory (path ending in * or ...). Branches of the user-supplied path are identified by examining integration records with p4 integrated and looking for correspondences between the supplied path and the individual paired files. Unintegrated changelists are found by running p4 interchanges between identified branches and the supplied path, and the results are filtered by running p4 integrate -n to verify that at least one file in each candidate changelist has a pending integrate action.

Here is an example of the above usage (click [find variants] to run the query):

Parser functions implented by this extension

p4changes

Same as the p4changes tag, with attributes specified in the following order:

{{#p4changes:num|path|desc|user}}

p4info

Displays server info (same as "p4 info|grep Server"). Usage:

{{#p4info:}}

p4graph

Generates GraphViz DOT markup graphing the history of a file. If the GraphViz extension is installed, the graph will be rendered on the page. Usage:

{{#p4graph:path|constraint}}

The optional "constraint" parameter specifies which elements the graph should try to keep aligned: "file" or "change" (default is neither).

p4print

Same as the p4print tag, but provides additional options for translating the output. The syntax is:

{{#p4print:path|mode}}

The "mode" can be any one of "raw", "text", or "wiki":

  • raw: All HTML is escaped and the result is displayed in a <pre> block. This is exactly equivalent to using the <p4print/> tag. raw is the default mode if none is specified.
  • text: The file contents are treated as if they were wiki text, but a space is placed at the beginning of each line to put the file into a <pre> block. Any wiki markup or allowed HTML in the file will be rendered as in a normal page (within a <pre> block), and URLs will be rendered as links. This option should be suitable for most plain text files. (Note that some HTML tags may break up the block, in which case raw is a better choice.)
  • wiki: The file contents are treated as if they were wiki text. This is probably only useful for files that contain no formatting at all, files that are specifically wiki-formatted, or very minimal HTML pages.

p4variants

Same as the p4variants tag:

{{#p4variants:path}}

The Special:Perforce page

The Special:Perforce page can be used to put any of the parser function queries in a dedicated dynamically generated page. This is primarily useful in cases where the query results are arbitrarily large and you don't want to embed them directly into the page, but you want to provide easy access to them.

The link syntax is:

[[Special:Perforce/query/arg1@@arg2@@...]]

with query being a Perforce parser function name minus the leading "#p4". For example: Special:Perforce/changes/50@@//public/jam/src/...@@long

The default Special:Perforce page contains some generic information about your Perforce server and a small collection of Perforce-related links.

About This Project

Recent Changes RSS_Feed.gif

  • Change 6449 on 2008/09/19 by sam_stafford@samwise-silver-mwiki
      Add another esoteric undoc parameter to the #p4graph function.
      Whatever you pass in here gets inserted into the digraph block as-is,
      so that you can add extra nodes, labels, et cetera in DOT markup.
      Usage: {{#p4graph:path|constraint|p4port|dotmarkup}}
  • Change 6339 on 2008/05/16 by sam_stafford@samwise-silver-mwiki
      Add credits entry to Special Pages section.
  • Change 6337 on 2008/05/14 by sam_stafford@samwise-silver-mwiki
      Use proc_open() instead of exec() to read 'p4 integrated'. I THINK
      that this will reduce the memory footprint by allowing each line of
      output to be discarded as it's processed, which might allow this
      function to handle larger projects without hitting PHP's memory limits.
  • Change 6334 on 2008/05/13 by sam_stafford@samwise-silver-mwiki
      Add more subpages to Special:Perforce, one per parser function.
      Rudimentary error handling in #p4graph function.
  • Change 6333 on 2008/05/12 by sam_stafford@samwise-silver-mwiki
      Big changes:
      1) #p4graph parser function that generates GraphViz output (need the
      GraphViz plugin to see the graph on the page, or copy and paste the
      output into a GraphVis renderer)
      2) Special:Perforce page (so that you can link to a graph on a separate
      page rather than embedding it)
      3) #p4info parser function (mostly to provide content for
      Special:Perforce)
      There should also now be a change number embedded in the credits entry
      so you can see what version of the plugin you have installed.

License

Copyright (C) 2008 Perforce Software

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
Personal tools