⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vssdiff.pm

📁 codestriker is a develop useful tool to review code on web user interface.
💻 PM
字号:
################################################################################ Codestriker: Copyright (c) 2001, 2002, 2003 David Sitsky.# All rights reserved.# sits@users.sourceforge.net## This program is free software; you can redistribute it and modify it under# the terms of the GPL.# Parser object for reading VSS (Visual Source Safe) diffs.package Codestriker::FileParser::VssDiff;use strict;use Codestriker::FileParser::BasicDiffUtils;# Return the array of filenames, revision number, linenumber, whether its# binary or not, and the diff text.# Return () if the file can't be parsed, meaning it is in another format.sub parse ($$$) {    my ($type, $fh, $repository) = @_;    # Array of results found.    my @result = ();    my $line = <$fh>;    while (defined($line)) {        # Values associated with the diff.        my $revision;        my $filename;        my $repmatch;        # Skip whitespace.        while (defined($line) &&               ($line =~ /^\s*$/o || $line =~ /^Version not found/o)) {            $line = <$fh>;        }        return @result unless defined $line;        # For VSS diffs, the start of the diff block is the "Diffing:" line        # which contains the filename and version number.  Some diffs may        # not contain the version number for us.        if ($line =~ /^Diffing: (.*);(.+)$/o) {            $filename = $1;            $revision = $2;            $repmatch = 1;        } elsif ($line =~ /^Diffing: (.*)$/o) {            $filename = $1;            $revision = $Codestriker::PATCH_REVISION;            $repmatch = 0;        } else {            # Some other weird format.            return ();        }        # The next line will be the "Against:" line, followed by a blank line.        $line = <$fh>;        return () unless defined $line && $line =~ /^Against:/o;        $line = <$fh>;        return () unless defined $line && $line =~ /^\s*$/o;        # The next part of the diff will be the old style diff format, or        # possibly "No differences." if there are no differences.        $line = <$fh>;        if ($line !~ /^No differences\./o) {            my $chunk;            do              {                  my $leading_context = '';                  my $leading_context_line_count = 0;                  my $trailing_context = '';                  my $trailing_context_line_count = 0;                  if ($line =~ /^\*\*\*\*\*\*\*\*/o ||                      $line =~ /^ /o) {                      # Need to record some leading context.                      $line = <$fh> if $line =~ /^\*\*\*\*\*\*\*\*/o;                      while ($line =~ /^ (.*)$/o) {                          $leading_context .= "$1\n";                          $leading_context_line_count++;                          $line = <$fh>;                      }                  }                  $chunk = Codestriker::FileParser::BasicDiffUtils                    ->read_diff_text($fh, $line, $filename, $revision,                                     $repmatch);                  if (defined $chunk) {                      # Check for trailing context.                      $line = <$fh>;                      while (defined $line && $line =~ /^ (.*)$/o) {                          $trailing_context .= "$1\n";                          $trailing_context_line_count++;                          $line = <$fh>;                      }                      # Adjust the chunk accordingly with the leading and                      # trailing context.                      if ($leading_context_line_count > 0) {                          $chunk->{old_linenumber} -= $leading_context_line_count;                          $chunk->{new_linenumber} -= $leading_context_line_count;                          $chunk->{text} = $leading_context . $chunk->{text};                      }                      if ($trailing_context_line_count > 0) {                          $chunk->{text} .= $trailing_context;                      }                      push @result, $chunk;                  }              } while (defined $chunk && defined $line);        }        # Read the next line.        $line = <$fh> if defined $line;    }    # Return the found diff chunks.    return @result;}1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -