projects
/
irspy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e8368ab
)
Display diffs between the original and modified records
author
Mike Taylor
<mike@indexdata.com>
Wed, 1 Nov 2006 10:31:57 +0000
(10:31 +0000)
committer
Mike Taylor
<mike@indexdata.com>
Wed, 1 Nov 2006 10:31:57 +0000
(10:31 +0000)
bin/test-xml-update.pl
patch
|
blob
|
history
diff --git
a/bin/test-xml-update.pl
b/bin/test-xml-update.pl
index
f7d4a8a
..
7efb641
100755
(executable)
--- a/
bin/test-xml-update.pl
+++ b/
bin/test-xml-update.pl
@@
-1,6
+1,6
@@
#!/usr/bin/perl -w
#!/usr/bin/perl -w
-# $Id: test-xml-update.pl,v 1.1 2006-11-01 09:59:28 mike Exp $
+# $Id: test-xml-update.pl,v 1.2 2006-11-01 10:31:57 mike Exp $
#
# Run like this:
# perl -I ../lib ./test-xml-update.pl bagel.indexdata.dk:210/gils
#
# Run like this:
# perl -I ../lib ./test-xml-update.pl bagel.indexdata.dk:210/gils
@@
-64,7
+64,21
@@
if ($n == 0) {
my $rec = $rs->record(0);
my $xc = irspy_xpath_context($rec);
my %fieldsByKey = map { ( $_->[0], $_) } @fields;
my $rec = $rs->record(0);
my $xc = irspy_xpath_context($rec);
my %fieldsByKey = map { ( $_->[0], $_) } @fields;
+my $oldText = $xc->getContextNode()->toString();
my $nchanges = modify_xml_document($xc, \%fieldsByKey, \%data);
my $nchanges = modify_xml_document($xc, \%fieldsByKey, \%data);
+my $newText = $xc->getContextNode()->toString();
#ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
print "The record has been updated (nchanges=$nchanges).\n";
#ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
print "The record has been updated (nchanges=$nchanges).\n";
-print $xc->getContextNode()->toString();
+
+# Now display diffs between the original and modified records
+my $oldFile = "/tmp/old.txu.$$";
+my $newFile = "/tmp/new.txu.$$";
+open OLD, ">$oldFile";
+print OLD $oldText;
+close OLD;
+open NEW, ">/tmp/new.txu.$$";
+print NEW $newText;
+close NEW;
+system("diff $oldFile $newFile");
+unlink($oldFile);
+unlink($newFile);