[interchange-cvs] interchange - jon modified dist/lib/UI/usertag/diff.tag

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Wed Nov 21 12:35:00 2001


User:      jon
Date:      2001-11-21 17:34:22 GMT
Modified:  dist/lib/UI/usertag Tag: STABLE_4_8-branch diff.tag
Log:
Merge in minor changes from 4.9 diff tag.

Revision  Changes    Path
No                   revision



No                   revision



2.0.2.1   +27 -15    interchange/dist/lib/UI/usertag/diff.tag


rev 2.0.2.1, prev_rev 2.0
Index: diff.tag
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/usertag/diff.tag,v
retrieving revision 2.0
retrieving revision 2.0.2.1
diff -u -u -r2.0 -r2.0.2.1
--- diff.tag	2001/07/18 02:22:15	2.0
+++ diff.tag	2001/11/21 17:34:22	2.0.2.1
@@ -4,37 +4,49 @@
 UserTag diff Routine <<EOR
 sub {
     my ($curr, $prev, $opt) = @_;
-    if($opt->{context}) {
-        $opt->{flags} = ' -c';
-    }
+
+	$opt->{flags} .= ' -c' if $opt->{context};
+	$opt->{flags} .= ' -u' if $opt->{unified};
+
+	my $data_opt = {};
+	$data_opt->{safe_data} = 1 if $opt->{safe_data};
+
     unless($opt->{flags} =~ /^[-\s\w.]*$/) {
         Log("diff tag: Security violation with flags: $opt->{flags}");
         return "Security violation with flags: $opt->{flags}. Logged.";
     }
-    my $currfn;
-    my $prevfn;
-    my $codere = '[-\w#/.]+';
-    my $coderex = '[-\w:#=/.%]+';
+
+    my ($currfn, $prevfn);
+
     if($curr =~ /^(\w+)::(.*?)::(.*)/) {
-        my $table = $1;
-        my $col = $2;
-        my $key = $3;
+        my ($table, $col, $key) = ($1, $2, $3);
         $currfn = "tmp/$Vend::SessionName.current";
-        Vend::Util::writefile(">$currfn", tag_data($table, $col, $key));
+		my $data = tag_data($table, $col, $key, $data_opt);
+		if ($opt->{ascii}) {
+			$data =~ s/\r\n?/\n/g;
+			$data .= "\n" unless substr($data, -1, 1) eq "\n";
+		}
+        Vend::Util::writefile(">$currfn", $data);
     }
     else {
         $currfn = $curr;
     }
+
     if($prev =~ /^(\w+)::(.*?)::(.*)/) {
-        my $table = $1;
-        my $col = $2;
-        my $key = $3;
+        my ($table, $col, $key) = ($1, $2, $3);
         $prevfn = "tmp/$Vend::SessionName.previous";
-        Vend::Util::writefile(">$prevfn", tag_data($table, $col, $key));
+		my $data = tag_data($table, $col, $key, $data_opt);
+		if ($opt->{ascii}) {
+			$data =~ s/\r\n?/\n/g;
+			$data .= "\n" unless substr($data, -1, 1) eq "\n";
+		}
+        Vend::Util::writefile(">$prevfn", $data);
     }
     else {
         $prevfn = $prev;
     }
+
+#Debug("diff command: 'diff $opt->{flags} $prevfn $currfn'");
     return `diff $opt->{flags} $prevfn $currfn`;
 }
 EOR