From cec2babec18f27f62d2909cd8300fa72b127e802 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Mon, 24 Jun 2013 10:47:21 +0000 Subject: adapt stattrans.pl alioth URLs (view/diff/download) after wagner upgrade CVS version numbers stattrans.pl: 1.112 -> 1.113 --- stattrans.pl | 68 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 13 deletions(-) (limited to 'stattrans.pl') diff --git a/stattrans.pl b/stattrans.pl index 99cd15f2802..40da62ba890 100755 --- a/stattrans.pl +++ b/stattrans.pl @@ -389,6 +389,38 @@ if ($config{'difftype'} eq 'u') { $seconddifftype = 'u'; } +sub alioth_cvs_file_url { + my ($path) = @_; + + return + sprintf( 'http://anonscm.debian.org/viewvc/webwml/webwml/%s', $path ); +} + +sub alioth_cvs_log_url { + my ($path) = @_; + + return alioth_cvs_file_url($path); +} + +sub alioth_cvs_diff_url { + my ( $path, $r1, $r2, $diff_format ) = @_; + + return alioth_cvs_file_url($path) + . sprintf( '?r1=%s;r2=%s;diff_format=%s', $r1, $r2, $diff_format ); +} + +sub alioth_cvs_view_url { + my ($path) = @_; + + return alioth_cvs_file_url($path) . '?view=markup'; +} + +sub alioth_cvs_raw_url { + my ($path) = @_; + + return alioth_cvs_file_url($path) . '?view=co'; +} + print "Creating files: " if ($config{'verbose'}); foreach $lang (@search_in) { my @processed_langs = ($langs{$lang}); @@ -435,24 +467,28 @@ foreach $lang (@search_in) { } else { if (defined $status_db{$lang}) { if ($transversion{"$lang/$file"} ne ''){ - $o_body .= sprintf 'Unified diff\' href="http://alioth.debian.org/scm/viewvc.php/webwml/%s?root=webwml&view=diff&r1=%s&r2=%s&diff_format=u">%s → %s ', - "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, $transversion{"$lang/$file"}, $version{"$orig/$file"}; - $o_body .= sprintf 'Colored diff\' href="http://alioth.debian.org/scm/viewvc.php/webwml/%s?root=webwml&view=diff&r1=%s&r2=%s&diff_format=h">%s → %s ', - "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, $transversion{"$lang/$file"}, $version{"$orig/$file"}; + $o_body .= sprintf 'Unified diff\' href="%s">%s → %s ', + alioth_cvs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, 'u' ), + $transversion{"$lang/$file"}, $version{"$orig/$file"}; + $o_body .= sprintf 'Colored diff\' href="%s">%s → %s ', + alioth_cvs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, 'h' ), + $transversion{"$lang/$file"}, $version{"$orig/$file"}; $o_body .= "$statspan"; } else { $o_body .= sprintf "%d (%.2f ‰)", $sizes{$file}, $sizes{$file}/$nsize * 1000; } } else { - $o_body .= sprintf "%s\ ->\ %s", - $file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $firstdifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; - $o_body .= sprintf "%s\ ->\ %s", - $file, $transversion{"$lang/$file"}, $version{"$orig/$file"}, $seconddifftype, $transversion{"$lang/$file"}, $version{"$orig/$file"}; + $o_body .= sprintf "%s\ ->\ %s", + alioth_cvs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, $firstdifftype ), + $transversion{"$lang/$file"}, $version{"$orig/$file"}; + $o_body .= sprintf "%s\ ->\ %s", + alioth_cvs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, $seconddifftype ), + $transversion{"$lang/$file"}, $version{"$orig/$file"}; } } - $o_body .= sprintf "[L]", $msg, $file, $version{"$orig/$file"}; - $o_body .= sprintf "[V]\ ", $lang, $file; - $o_body .= sprintf "[F]", $lang, $file; + $o_body .= sprintf "[L]", $msg, alioth_cvs_log_url("$orig/$file"), $version{"$orig/$file"}; + $o_body .= sprintf "[V]\ ", alioth_cvs_view_url("$lang/$file"); + $o_body .= sprintf "[F]", alioth_cvs_raw_url("$lang/$file"); $o_body .= sprintf "%s", $maintainer{"$lang/$file"} || ""; $o_body .= $todo if (defined $status_db{$lang}); $o_body .= "\n"; @@ -656,7 +692,10 @@ foreach $lang (@search_in) { print HTML "\n"; } - print HTML '
Created with webwml-stattrans
'."\n"; + print HTML + '
Created with webwml-stattrans
' . "\n"; close (HTML); } else { print "Can't open $config{'htmldir'}/$l.wml\n"; @@ -807,7 +846,10 @@ foreach $lang (@search_in) { print HTMLI ""; print HTMLI "\n"; -print HTMLI '
Created with webwml-stattrans
'."\n"; +print HTMLI + '
Created with webwml-stattrans
' . "\n"; close (HTMLI); print "done.\n" if ($config{'verbose'}); -- cgit v1.2.3