source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: cvsweb: Delete String::Ediff functionality.
Date: Mon, 11 Nov 2019 07:56:08 -0500 (EST)	[thread overview]
Message-ID: <8d0772827818c80c@mandoc.bsd.lv> (raw)

Log Message:
-----------
Delete String::Ediff functionality.
The module is not even ported to OpenBSD, the code is horrific,
and the functionality is totally unimportant.

Modified Files:
--------------
    cvsweb:
        cvsweb.cgi

Revision Data
-------------
Index: cvsweb.cgi
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/cvsweb.cgi,v
retrieving revision 4.14
retrieving revision 4.15
diff -Lcvsweb.cgi -Lcvsweb.cgi -u -p -r4.14 -r4.15
--- cvsweb.cgi
+++ cvsweb.cgi
@@ -103,8 +103,6 @@ use constant CVSWEBMARKUP => qr{^text/(x
 use constant LOG_FILESEPR => qr/^={77}$/o;
 use constant LOG_REVSEPR  => qr/^-{28}$/o;
 
-use constant HAS_EDIFF    => eval { require String::Ediff;  };
-
 # -----------------------------------------------------------------------------
 
 # All global initialization that can be done in compile time should go to
@@ -3353,214 +3351,6 @@ EOF
     }
   } elsif ($state eq "PreChange") {     # state eq "PreChange"
                                         # we got removes with subsequent adds
-    if (HAS_EDIFF) {
-      # construct the suffix tree
-      my $left_diff = join("\n", @$leftColRef[0..$leftRow-1]);
-      my $right_diff = join("\n", @$rightColRef[0..$rightRow-1]);
-      my $diff_str = String::Ediff::ediff($left_diff, $right_diff);
-
-      my @diff_str = split(/ /, $diff_str);
-      my $INFINITY = 10000000;
-      push(@diff_str, ($INFINITY) x 8);
-      my ($idx, $b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) =
-        (0, @diff_str[0..7]);
-      my ($l_cul, $r_cul) = (0, 0);
-      my ($ldx, $rdx) = (0, 0);
-      my (@left_html, @right_html);
-      for (my $j = 0; $j < $leftRow; $j++) {
-        my $line_len = length(@$leftColRef[$j]);
-        my $line = @$leftColRef[$j];
-        $l_cul += length($line) + 1; # includes "\n"
-        my $l_culx = $l_cul - 1; # not includes "\n"
-        if ($j < $lb1) {
-          $line = spacedHtmlText($line);
-          push(@left_html, "<td class=\"diff diff-changed\">$line</td>");
-        } elsif ($lb1 == $j) {
-          my $html_line;
-          while ($lb1 == $j) {
-            my $begin_char = $l_culx - $b1;
-
-            $line =~ /^(.*)(.{$begin_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-unchanged">';
-            $line = $2;
-            last if ($j != $le1);
-
-            my $end_char = $l_culx - $e1;
-            $line =~ /^(.*)(.{$end_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-changed">';
-            $line = $2;
-
-            $idx++;
-            my ($tb1, $te1, $tlb1, $tle1, $tb2, $te2, $tlb2, $tle2) =
-              ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2);
-            ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) =
-              @diff_str[$idx*8..($idx+1)*8-1];
-            $lb1 = $INFINITY if ($lb1 < 0);
-            $lb2 = $INFINITY if ($lb2 < 0);
-            $le1 = $INFINITY if ($le1 < 0);
-            $le2 = $INFINITY if ($le2 < 0);
-            if ($te1 > $b1) {
-              ($b1, $lb1) = ($te1, $tle1);
-            }
-            if ($te2 > $b2) {
-              ($b2, $lb2) = ($te2, $tle2);
-            }
-          }
-          push(@left_html,
-               sprintf('<td><span class="diff diff-changed">%s%s</span></td>',
-                       $html_line, spacedHtmlText($line)));
-        } elsif ($le1 == $j) {
-          my $html_line;
-          while ($le1 == $j) {
-            my $end_char = $l_culx - $e1;
-            $line =~ /^(.*)(.{$end_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-changed">';
-            $line = $2;
-
-            $idx++;
-            my ($tb1, $te1, $tlb1, $tle1, $tb2, $te2, $tlb2, $tle2) =
-              ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2);
-            ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) =
-              @diff_str[$idx*8..($idx+1)*8-1];
-            $lb1 = $INFINITY if ($lb1 < 0);
-            $lb2 = $INFINITY if ($lb2 < 0);
-            $le1 = $INFINITY if ($le1 < 0);
-            $le2 = $INFINITY if ($le2 < 0);
-            if ($te1 > $b1) {
-              ($b1, $lb1) = ($te1, $tle1);
-            }
-            if ($te2 > $b2) {
-              ($b2, $lb2) = ($te2, $tle2);
-            }
-
-            last if ($lb1 != $j);
-
-            my $begin_char = $l_culx - $b1;
-
-            $line =~ /^(.*)(.{$begin_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-unchanged">';
-            $line = $2;
-          }
-          push(@left_html,
-              sprintf('<td><span class="diff diff-unchanged">%s%s</span></td>',
-                      $html_line, spacedHtmlText($line)));
-        } else {
-          $line = spacedHtmlText($line);
-          push(@left_html, "<td class=\"diff diff-unchanged\">$line</td>");
-        }
-      }
-      ($idx, $b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) =
-        (0, @diff_str[0..7]);
-      $lb1 = $INFINITY if ($lb1 < 0);
-      $lb2 = $INFINITY if ($lb2 < 0);
-      $le1 = $INFINITY if ($le1 < 0);
-      $le2 = $INFINITY if ($le2 < 0);
-      for (my $j = 0; $j < $rightRow; $j++) {
-        my $line_len = length(@$rightColRef[$j]);
-        my $line = @$rightColRef[$j];
-        $r_cul += length($line) + 1; # includes "\n"
-        my $r_culx = $r_cul - 1; # not includes "\n"
-        if ($j < $lb2) {
-          $line = spacedHtmlText($line);
-          push(@right_html, "<td class=\"diff diff-changed\">$line</td>");
-        } elsif ($lb2 == $j) {
-          my $html_line;
-          while ($lb2 == $j) {
-            my $begin_char = $r_culx - $b2;
-
-            $line =~ /^(.*)(.{$begin_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-unchanged">';
-            $line = $2;
-
-            last if ($j != $le2);
-
-            my $end_char = $r_culx - $e2;
-            $line =~ /^(.*)(.{$end_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-changed">';
-            $line = $2;
-
-            $idx++;
-            my ($tb1, $te1, $tlb1, $tle1, $tb2, $te2, $tlb2, $tle2) =
-              ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2);
-            ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) =
-              @diff_str[$idx*8..($idx+1)*8-1];
-            $lb1 = $INFINITY if ($lb1 < 0);
-            $lb2 = $INFINITY if ($lb2 < 0);
-            $le1 = $INFINITY if ($le1 < 0);
-            $le2 = $INFINITY if ($le2 < 0);
-            if ($te1 > $b1) {
-              ($b1, $lb1) = ($te1, $tle1);
-            }
-            if ($te2 > $b2) {
-              ($b2, $lb2) = ($te2, $tle2);
-            }
-          }
-          push(@right_html,
-               sprintf('<td><span class="diff diff-changed">%s%s</span></td>',
-                       $html_line, spacedHtmlText($line)));
-        } elsif ($le2 == $j) {
-          my $html_line;
-          while ($le2 == $j) {
-            my $end_char = $r_culx - $e2;
-            $line =~ /^(.*)(.{$end_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-changed">';
-            $line = $2;
-
-            $idx++;
-            my ($tb1, $te1, $tlb1, $tle1, $tb2, $te2, $tlb2, $tle2) =
-              ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2);
-            ($b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) =
-              @diff_str[$idx*8..($idx+1)*8-1];
-            $lb1 = $INFINITY if ($lb1 < 0);
-            $lb2 = $INFINITY if ($lb2 < 0);
-            $le1 = $INFINITY if ($le1 < 0);
-            $le2 = $INFINITY if ($le2 < 0);
-            if ($te1 > $b1) {
-              ($b1, $lb1) = ($te1, $tle1);
-            }
-            if ($te2 > $b2) {
-              ($b2, $lb2) = ($te2, $tle2);
-            }
-
-            last if ($lb2 != $j);
-
-            my $begin_char = $r_culx - $b2;
-            $line =~ /^(.*)(.{$begin_char})$/;
-            $html_line .= spacedHtmlText($1) .
-              '</span><span class="diff diff-unchanged">';
-            $line = $2;
-          }
-          push(@right_html,
-               sprintf('<td nowrap="nowrap"><span class="diff diff-unchanged"'.
-                       '>%s%s</span></td>',
-                       $html_line, spacedHtmlText($line)));
-        } else {
-          $line = spacedHtmlText ($line);
-          push @right_html, "<td class=\"diff diff-unchanged\">$line</td>";
-        }
-      }
-      for (my $j = 0; $j < $leftRow || $j < $rightRow ; $j++) { # dump out both cols
-        print  '<tr>';
-        if ($j < $leftRow) {
-          print $left_html[$j];
-        } else {
-          print '<td class="diff diff-changed-missing">&nbsp;</td>';
-        }
-        if ($j < $rightRow) {
-          print $right_html[$j];
-        } else {
-          print '<td class="diff diff-changed-missing">&nbsp;</td>';
-        }
-        print "</tr>\n";
-      }
-    } else {
       for (my $j = 0; $j < $leftRow || $j < $rightRow; $j++) { # dump both cols
         print "<tr>\n";
         if ($j < $leftRow) {
@@ -3579,7 +3369,6 @@ EOF
         }
         print "\n</tr>\n";
       }
-    }
   }
 }
 
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2019-11-11 12:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d0772827818c80c@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).