From a3fcc21a7c098056a557a095178aee9f752d6059 Mon Sep 17 00:00:00 2001 From: Steve McIntyre Date: Wed, 13 Jun 2018 00:56:23 +0100 Subject: Multiple fixes and cleanups Remove old alioth support and links - it's gone now Remove the "compare" salsa links - they're not wanted Make output more consistent whether we have a status_db or not --- stattrans.pl | 76 ++++++++++++------------------------------------------------ 1 file changed, 15 insertions(+), 61 deletions(-) (limited to 'stattrans.pl') diff --git a/stattrans.pl b/stattrans.pl index 140d51997da..3ef824214c4 100755 --- a/stattrans.pl +++ b/stattrans.pl @@ -64,10 +64,6 @@ $opt_p =~ s/$/\$/g; my $VCSHOST = "salsa"; my $VCSBASE = "https://salsa.debian.org/webmaster-team/webwml"; -if (-d "$config{'wmldir'}/CVS") { - $VCSHOST = "alioth"; - $VCSBASE = "https://anonscm.debian.org/viewvc/webwml/webwml"; -} my $l = Webwml::Langs->new($opt_w); my %langs = $l->name_iso(); @@ -411,9 +407,7 @@ if ($config{'difftype'} eq 'u') { sub vcs_log_url { my ($path, $rev) = @_; - if ($VCSHOST =~ m/alioth/) { - return "$VCSBASE/$path#rev$rev"; - } elsif ($VCSHOST =~ m/salsa/) { + if ($VCSHOST =~ m/salsa/) { return "$VCSBASE/commits/$rev/$path"; } else { die "Unknown/unsupported VCSHOST $VCSHOST - ABORT\n"; @@ -423,9 +417,7 @@ sub vcs_log_url { sub vcs_diff_url { my ( $path, $r1, $r2, $diff_format ) = @_; - if ($VCSHOST =~ m/alioth/) { - return "$VCSBASE/$path/?r1=$r1&r2=$r2&diff_format=$diff_format"; - } elsif ($VCSHOST =~ m/salsa/) { + if ($VCSHOST =~ m/salsa/) { return "$VCSBASE/compare?from=$r1&to=$r2"; } else { die "Unknown/unsupported VCSHOST $VCSHOST - ABORT\n"; @@ -435,9 +427,7 @@ sub vcs_diff_url { sub vcs_view_url { my ($path) = @_; - if ($VCSHOST =~ m/alioth/) { - return "$VCSBASE/$path?view=markup"; - } elsif ($VCSHOST =~ m/salsa/) { + if ($VCSHOST =~ m/salsa/) { return "$VCSBASE/blob/master/$path"; } else { die "Unknown/unsupported VCSHOST $VCSHOST - ABORT\n"; @@ -447,9 +437,7 @@ sub vcs_view_url { sub vcs_raw_url { my ($path) = @_; - if ($VCSHOST =~ m/alioth/) { - return "$VCSBASE/$path?view=co"; - } elsif ($VCSHOST =~ m/salsa/) { + if ($VCSHOST =~ m/salsa/) { return "$VCSBASE/raw/master/$path"; } else { die "Unknown/unsupported VCSHOST $VCSHOST - ABORT\n"; @@ -510,46 +498,18 @@ foreach $lang (@search_in) { $o_body .= ""; } } else { - if (defined $status_db{$lang}) { - if ($transversion{"$lang/$file"} ne ''){ - if ($VCSHOST =~ m/alioth/) { - $o_body .= sprintf 'Unified diff\' href="%s">%s → %s ', - vcs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, 'u' ), - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}); - $o_body .= sprintf 'Colored diff\' href="%s">%s → %s ', - vcs_diff_url( "$orig/$file", short($transversion{"$lang/$file"}), short($version{"$orig/$file"}), 'h' ), - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}); - $o_body .= "$statspan"; + if (defined $status_db{$lang}) { + if ($transversion{"$lang/$file"} ne ''){ + $o_body .= sprintf "git diff %s..%s -- %s", + short($transversion{"$lang/$file"}), short($version{"$orig/$file"}), "$orig/$file"; + } else { + $o_body .= sprintf "%d (%.2f ‰)", $sizes{$file}, $sizes{$file}/$nsize * 1000; + } } else { - $o_body .= sprintf 'Commit diff\' href="%s">%s → %s ', - vcs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, 'u' ), - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}); - # FIXME - this is clearly wrong, but no idea what's meant to go here! - $o_body .= sprintf 'Git command line\' href="%s">%s → %s ', - vcs_diff_url( "$orig/$file", short($transversion{"$lang/$file"}), short($version{"$orig/$file"}), 'h' ), - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}); - $o_body .= "$statspan"; + $o_body .= sprintf "git diff %s..%s -- %s", + short($transversion{"$lang/$file"}), short($version{"$orig/$file"}), "$orig/$file"; } - } else { - $o_body .= sprintf "%d (%.2f ‰)", $sizes{$file}, $sizes{$file}/$nsize * 1000; - } - } else { - if ($VCSHOST =~ m/alioth/) { - $o_body .= sprintf "%s\ ->\ %s", - vcs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, $firstdifftype ), - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}); - $o_body .= sprintf "%s\ ->\ %s", - vcs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, $seconddifftype ), - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}); - } else { - $o_body .= sprintf "%s\ ->\ %s", - vcs_diff_url( "$orig/$file", $transversion{"$lang/$file"}, $version{"$orig/$file"}, $firstdifftype ), - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}); - $o_body .= sprintf "git diff %s..%s -- %s", - short($transversion{"$lang/$file"}), short($version{"$orig/$file"}), "$orig/$file"; - } - } - } + } $o_body .= sprintf "[L]", $msg, vcs_log_url("$orig/$file", $version{"$orig/$file"}); $o_body .= sprintf "[V]\ ", vcs_view_url("$lang/$file"); $o_body .= sprintf "[F]", vcs_raw_url("$lang/$file"); @@ -675,13 +635,7 @@ foreach $lang (@search_in) { } else { print HTML 'Comment'."\n"; print HTML 'Diffstat'."\n"; - if ($VCSHOST =~ m/alioth/) { - if ($opt_d eq "u") { print HTML 'Unified diffColored diff'; } - elsif ($opt_d eq "h") { print HTML 'Colored diffUnified diff'; } - else { print HTML 'Diff'; } - } else { - print HTML 'Commit diffGit command line'; - } + print HTML 'Git command line'; } print HTML 'Log'; print HTML 'Translation'; -- cgit v1.2.3