Modul:Vorlage:Phab: Unterschied zwischen den Versionen
2015-04-19
wp>PerfektesChaos (2015-04-05) |
wp>PerfektesChaos (2015-04-19) |
||
Zeile 1: | Zeile 1: | ||
--[=[ 2015-04- | --[=[ 2015-04-19 | ||
{{Template:Phab}} | {{Template:Phab}} | ||
]=] | ]=] | ||
Zeile 426: | Zeile 426: | ||
if action == "commit" or | if action == "commit" or | ||
action == "commitdiff" then | action == "commitdiff" then | ||
swift = | if attach then | ||
sub | if action == "commit" then | ||
swift = "browse" | |||
else | |||
swift = "change" | |||
end | |||
state = "master" | |||
else | |||
sub = string.format( "r%s%s", | |||
shortcut, state ) | |||
end | |||
elseif action == "history" then | elseif action == "history" then | ||
swift = action | swift = action | ||
Zeile 444: | Zeile 452: | ||
end | end | ||
if state then | if state then | ||
sub = string.format( "%s | local sep | ||
if state == "master" then | |||
sep = "/" | |||
else | |||
sep = "" | |||
end | |||
sub = string.format( "%s%s%s", sub, sep, state ) | |||
end | end | ||
if attach then | if attach then | ||
sub = string.format( "%s/%s", sub, attach ) | sub = string.format( "%s/%s", sub, attach ) | ||
if adopt | |||
and state ~= "HEAD" | |||
and state ~= adopt then | |||
sub = string.format( "%s;%s", sub, adopt ) | |||
end | |||
if anchor then | if anchor then | ||
sub = string.format( "%s$%s", sub, anchor ) | sub = string.format( "%s$%s", sub, anchor ) | ||
Zeile 530: | Zeile 549: | ||
slot = args[ r ] | slot = args[ r ] | ||
end | end | ||
r = lonely( args, | r = lonely( args, { "dir", "file", "plain" } ) | ||
if r then | |||
swift = r | |||
source = args[ swift ] | |||
end | |||
r = lonely( args, { "commit", "commitdiff" } ) | |||
if r then | if r then | ||
swift = r | swift = r | ||
load = true | |||
end | end | ||
if args.history then | if args.history then | ||
Zeile 563: | Zeile 587: | ||
end | end | ||
end | end | ||
if load then | if load then | ||
if scope | if scope == "SVN" then | ||
r = "Invalid SVN identifier: " | |||
if slot:match( "^[0-9]+$" ) then | |||
slot = tonumber( slot ) | |||
if slot >= 1 and slot <= 115794 then | |||
r = false | |||
end | |||
slot = string.format( "%d", slot ) | |||
end | |||
if r then | |||
local e = r .. slot | |||
error( e, 0 ) | |||
end | |||
else | |||
id40( slot ) | id40( slot ) | ||
end | end | ||
Zeile 572: | Zeile 607: | ||
since = args.diff | since = args.diff | ||
id40( since ) | id40( since ) | ||
elseif last then | |||
swift = "history" | |||
end | end | ||
r, show = phabDiffusion( swift, scope, slot, source, jump, since, | r, show = phabDiffusion( swift, scope, slot, source, jump, since, | ||
Zeile 587: | Zeile 619: | ||
show = source | show = source | ||
if args.diff then | if args.diff then | ||
show = | show = string.format( "%s ./.%s", show, since:sub( 1, 7 ) ) | ||
elseif load then | |||
show = string.format( "%s;%s", show, slot:sub( 1, 7 ) ) | |||
end | end | ||
elseif load then | elseif load then | ||
Zeile 605: | Zeile 639: | ||
error( "Unknown project: " .. scope, 0 ) | error( "Unknown project: " .. scope, 0 ) | ||
end | end | ||
lonely( args, | |||
{ "commit", "commitdiff", "dir", "file", "plain" } ) | |||
r = git( swift, scope, slot, source, jump, since ) | r = git( swift, scope, slot, source, jump, since ) | ||
r = string.format( "[%s %s]", r, show ) | r = string.format( "[%s %s]", r, show ) |