[Laszlo-checkins] r10184 - openlaszlo/trunk/WEB-INF/lps/server/bin
dda@openlaszlo.org
dda at openlaszlo.org
Wed Jul 2 16:53:57 PDT 2008
Author: dda
Date: 2008-07-02 16:53:49 -0700 (Wed, 02 Jul 2008)
New Revision: 10184
Modified:
openlaszlo/trunk/WEB-INF/lps/server/bin/convert_laszlo.pl
openlaszlo/trunk/WEB-INF/lps/server/bin/convert_required.pl
Log:
Change 20080702-dda-B by dda at lester.local on 2008-07-02 19:50:28 EDT
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-a
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Add difftool feature to conversion scripts (from Corry Haines chaines at laszlosystems.com)
New Features:
Bugs Fixed: LPP-6584
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Changes made by Corry, reviewed by me (changed usage comment slightly,
and added same usage message to convert_required.pl).
Tests:
Tested the graphical tool via -g diff
and confirmed the three confirmation cases work as expected.
Modified: openlaszlo/trunk/WEB-INF/lps/server/bin/convert_laszlo.pl
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/bin/convert_laszlo.pl 2008-07-02 23:25:35 UTC (rev 10183)
+++ openlaszlo/trunk/WEB-INF/lps/server/bin/convert_laszlo.pl 2008-07-02 23:53:49 UTC (rev 10184)
@@ -42,6 +42,10 @@
-d debuglevel
get debugging info for development
+ -g graphical-difftool
+ for each file changed, invoke the graphical difftool,
+ and prompt the user to keep or not keep the changes
+
-t
create output for simple tests in /tmp/convtest
@@ -404,7 +408,7 @@
##
my $file;
my %options;
-$ok = getopts("d:tx:v", \%options);
+$ok = getopts("d:tx:vg:", \%options);
if (!$ok) {
print STDERR "$USAGE";
exit(1);
@@ -434,6 +438,13 @@
exit(0);
}
+my $diffTool = "";
+my $confirm = 0;
+if ($options{g}) {
+ $diffTool = $options{g};
+ $confirm = 1;
+}
+
if ($#ARGV < 0) {
print STDERR "$USAGE";
exit(1);
@@ -451,5 +462,23 @@
}
else {
convert_file($file);
+ if($confirm) {
+ my $isDiff = system("diff -q $file.bak $file");
+ if($isDiff != 0) {
+ system("$diffTool $file.bak $file");
+ print STDOUT "Would you like to: [u]se new, [k]eep old, [e]dit new: ";
+ $| = 1;
+ my $todo = <STDIN>;
+ chomp $todo;
+ if($todo eq 'k'){
+ system("rm", $file);
+ system("mv", "$file.bak", "$file");
+ } elsif($todo eq 'e'){
+ system("\$EDITOR $file");
+ }
+ } else {
+ print STDOUT "Files are the same... Continuing\n";
+ }
+ }
}
}
Modified: openlaszlo/trunk/WEB-INF/lps/server/bin/convert_required.pl
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/bin/convert_required.pl 2008-07-02 23:25:35 UTC (rev 10183)
+++ openlaszlo/trunk/WEB-INF/lps/server/bin/convert_required.pl 2008-07-02 23:53:49 UTC (rev 10184)
@@ -66,6 +66,10 @@
-d debuglevel
get debugging info for development
+ -g graphical-difftool
+ for each file changed, invoke the graphical difftool,
+ and prompt the user to keep or not keep the changes
+
-t
create output for simple tests in /tmp/convtest
@@ -355,7 +359,7 @@
##
my $file;
my %options;
-$ok = getopts("d:tx:v", \%options);
+$ok = getopts("d:tx:vg:", \%options);
if (!$ok) {
print STDERR "$USAGE";
exit(1);
@@ -379,6 +383,13 @@
exit(1);
}
+my $diffTool = "";
+my $confirm = 0;
+if ($options{g}) {
+ $diffTool = $options{g};
+ $confirm = 1;
+}
+
foreach $file (@ARGV) {
if (! -f $file) {
}
@@ -391,5 +402,24 @@
}
else {
convert_file($file);
+ if($confirm) {
+ my $isDiff = system("diff -q $file.bak $file");
+ if($isDiff != 0) {
+ system("$diffTool $file.bak $file");
+ print STDOUT "Would you like to: [u]se new, [k]eep old, [e]dit new: ";
+ $| = 1;
+ my $todo = <STDIN>;
+ chomp $todo;
+ if($todo eq 'k'){
+ system("rm", $file);
+ system("mv", "$file.bak", "$file");
+ } elsif($todo eq 'e'){
+ system("\$EDITOR $file");
+ }
+ } else {
+ print STDOUT "FIles are the same... Continuing\n";
+ }
+ }
+
}
}
More information about the Laszlo-checkins
mailing list