Nicht angemeldeter Benutzer - Bearbeiten von Seiten ist nur als angemeldeter Benutzer möglich.
Änderungen
Zur Navigation springen
Zur Suche springen
Zeile 1:
Zeile 1:
− +
Zeile 121:
Zeile 121:
− +
Zeile 190:
Zeile 190:
− +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Zeile 201:
Zeile 395:
+
− local load
Zeile 211:
Zeile 405:
− +
Zeile 250:
Zeile 444:
+
Zeile 260:
Zeile 455:
+
Zeile 276:
Zeile 472:
− +
+
+
+
+
Zeile 366:
Zeile 566:
− +
+
Zeile 410:
Zeile 611:
− +
+
Zeile 444:
Zeile 646:
− +
− +
+
Zeile 473:
Zeile 676:
− +
Zeile 484:
Zeile 687:
− +
Zeile 500:
Zeile 703:
− +
2015-03-23
--[=[ 2013-12-01
--[=[ 2015-03-23
{{Template:Phab}}
{{Template:Phab}}
]=]
]=]
-- Return table with sequence of matching elements, or false
-- Return table with sequence of matching elements, or false
local r = { }
local r = { }
local i, k, v
local i
for k, v in pairs( args ) do
for k, v in pairs( args ) do
for i = 1, #alone do
for i = 1, #alone do
local function sourcing( args )
local function phabAssigned( frame )
-- Retrieve table with callsign assignments
-- Precondition:
-- frame -- object or nil
-- Postcondition:
-- Return table or nil
-- Throws error on failure
-- Uses:
-- mw.getCurrentFrame()
-- mw.loadData()
local got, lucky, r, s
if not frame then
frame = mw.getCurrentFrame()
end
s = frame:getTitle() .. "/callsigns"
lucky, got = pcall( mw.loadData, s )
if type( got ) == "table" then
r = got
else
error( "Invalid: " .. s, 0 )
end
return r
end -- phabAssigned()
local function phabCallsigns( args, frame )
-- Create wikitable of all callsigns
-- Precondition:
-- args -- table; options
-- frame -- object or nil
-- Uses:
-- phabAssigned()
local connect = phabAssigned( frame )
local r
if connect then
local limit = ( args.callsigns == "0" )
local callsigns = { }
local order = { }
local store = "https://phabricator.wikimedia.org/"
local sub = "diffusion/"
local details, pages, s, sign, support
r = "{| class='wikitable sortable'\n" ..
"|- class='hintergrundfarbe6'\n" ..
"! Callsign !! Titel !!\n"
for k, v in pairs( connect ) do
if k:find( "/", 3, true ) then
-- GIT legacy
v = false
elseif limit and type( v ) == "string" then
details = connect[ v ]
if type( details ) == "table" and
type( details.list ) == "boolean" and
not details.list then
v = false
end
end
if type( v ) == "string" then
s = callsigns[ v ]
if s then
if #s < #k then
callsigns[ v ] = k
end
else
callsigns[ v ] = k
table.insert( order, v )
end
end
end -- for k, v
table.sort( order )
for i = 1, #order do
sign = order[ i ]
show = callsigns[ sign ]
r = string.format( "%s|-\n|[%s%s%s %s]||%s\n",
r, store, sub, sign, sign, show )
pages = { }
details = connect[ sign ]
if type( details ) ~= "table" then
details = { }
end
if details.support then
table.insert( pages,
string.format( "[[%s]]",
details.support ) )
end
if type( details.bound ) == "table" then
for k, v in pairs( details.bound ) do
table.insert( pages,
string.format( "[%s%s %s]",
store, v, v ) )
end -- for k, v
end
support = details.mwPage
if not support then
s = show:match( "^extension%-([%w_]+)$" )
if s then
support = "Extension:" .. s
end
end
if support then
table.insert( pages,
string.format( "[[mw:%s]]", support ) )
end
if #pages > 0 then
r = string.format( "%s|%s\n",
r, table.concat( pages, "<br>" ) )
end
end -- for i
r = r .. "|}\n"
end
return r
end -- phabCallsigns()
local function phabDiffusion( action, assembly, adopt, attach,
anchor, against, frame )
-- Create URL for Phabricator Diffusion since 2015-03
-- Precondition:
-- action -- string; kind of request
-- assembly -- string; project
-- adopt -- string; branch
-- attach -- string; file or directory (or empty)
-- anchor -- string; line number (or empty)
-- against -- string; diff ./. previous ID (or empty)
-- frame -- object or nil
-- Postcondition:
-- Return URL, if identified, or nil
-- Uses:
-- phabAssigned()
local translate = phabAssigned( frame )
local r
if translate then
local shortcut
if assembly:match( "^%u%u%u?%u?$" ) then
shortcut = assembly
else
shortcut = translate[ assembly ]
if not shortcut and assembly:find( "/", 3, true ) then
-- GIT legacy
local s = assembly:gsub( "mediawiki/extensions/",
"extension-" )
shortcut = translate[ s ]
end
end
if shortcut then
local store = "https://phabricator.wikimedia.org/"
local state, sub, swift
if adopt ~= "master" and adopt ~= "HEAD" then
state = adopt
end
if attach and not state then
state = "master"
end
if state then
if action then
if action == "commit" or
action == "commitdiff" then
swift = action
sub = string.format( "r%s%s",
shortcut, state )
elseif action == "history" then
swift = action
else
swift = "browse"
end
else
swift = "browse"
end
end
if not sub then
sub = "diffusion/" .. shortcut
if swift then
sub = string.format( "%s/%s", sub, swift )
end
if state then
sub = string.format( "%s/%s", sub, state )
end
if attach then
sub = string.format( "%s/%s", sub, attach )
if anchor then
sub = string.format( "%s#L%s", sub, anchor )
end
end
end
r = store .. sub
end
end
return r
end -- phabDiffusion()
local function sourcing( args, frame )
-- Link to a code source, directory, branch or related
-- Link to a code source, directory, branch or related
-- Precondition:
-- Precondition:
-- args -- table; assignments
-- args -- table; assignments
-- frame -- object or nil
-- Postcondition:
-- Postcondition:
-- Returns string, if fine
-- Returns string, if fine
-- id40()
-- id40()
-- mw.text.trim()
-- mw.text.trim()
-- phabDiffusion()
-- git()
-- git()
local jump = false
local jump = false
local last = false
local last = false
local scope = "mediawiki/core"
local scope = "mediawiki/core"
local show
local show
local source = false
local source = false
local swift = "dir"
local swift = "dir"
local k, v, r
local load, r
r = lonely( args,
r = lonely( args,
{ "branch", "commit", "commitdiff", "diff" } )
{ "branch", "commit", "commitdiff", "diff" } )
end
end
end
end
r = false
load = ( args.commit or args.commitdiff )
load = ( args.commit or args.commitdiff )
if load then
if load then
if last then
if last then
swift = "history"
swift = "history"
else
end
end
end
end
show = scope .. "/*"
show = scope .. "/*"
end
end
r = git( swift, scope, slot, source, jump, since )
r = phabDiffusion( swift, scope, slot, source, jump, since, frame )
if not r then
r = git( swift, scope, slot, source, jump, since )
.. "[[Category:Wikipedia:Technik/Phabricator/Diffusion]]"
end
return string.format( "[%s %s]", r, show )
return string.format( "[%s %s]", r, show )
end -- sourcing()
end -- sourcing()
end
end
r = string.format( "[%s %s]", r, show )
r = string.format( "[%s %s]", r, show )
r = string.format( "%s %s", task( args ), r )
r = string.format( "%s <small style=\"font-weight:normal\">(%s)</small>",
task( args ), r )
return r
return r
end -- taskBugzilla()
end -- taskBugzilla()
local function main( args )
local function main( args, frame )
-- Do the job
-- Do the job
-- Precondition:
-- Precondition:
-- args -- table; assignments
-- args -- table; assignments
-- frame -- object or nil
-- Postcondition:
-- Postcondition:
-- Returns string with link, if fine
-- Returns string with link, if fine
plain = 2,
plain = 2,
project = 2,
project = 2,
title = 2 }
title = 2,
local k, v, r
callsigns = 3 }
local gr
for k, v in pairs( args ) do
for k, v in pairs( args ) do
mode = params[ k ]
mode = params[ k ]
error( r, 0 )
error( r, 0 )
else
else
local procs = { unified, sourcing }
local procs = { unified, sourcing, phabCallsigns }
if mode == 0 then
if mode == 0 then
mode = 2
mode = 2
end
end
end -- for k, v
end -- for k, v
r = procs[ mode ]( got )
r = procs[ mode ]( got, frame )
end
end
return r
return r
function p.f( frame )
function p.f( frame )
local lucky, r = pcall( main, frame:getParent().args )
local lucky, r = pcall( main, frame:getParent().args, frame )
if not lucky then
if not lucky then
r = string.format( "<span class=\"error\">%s</span>", r )
r = string.format( "<span class=\"error\">%s</span>", r )