[Pmwiki-users] Remote wiki sync - partial solution using CVS
Vaclav Stepan
w
Sat Jul 31 06:48:22 CDT 2004
Hi,
from the archive it seems this was alredy few times discussed, but I
didn't find any ready-to use solution,
so let me open the subject once again.
There is one Wiki on a server at work. I would like to enable people to
1. Make copies offline
2. Work on the contents offline and sync with the master later
All the users have shell accounts on the server, all use some flavour of
Unix at home/for the offline work.
At the moment I am playing with the following sollution:
1. wiki.d on the central server was imported into CVS as project and
checkout to the same place later, alike the description of the
``backup into the CVS tree in cookbook''.
2. If I want to go offline, I commit the changes on the offline
server to the repository and do a 'cvs update' on the notebook.
When I get back on-line, I do an update and commit on notebook and
the same on the server.
If nobody touched/changed the contents on the main server in the
meantime, this works well.
If somebody changed another page than me, this works too, with the
exception, that AllRecentChanges cause CVS conflict.
Attached dirty script solves them, run:
cd wiki.d ; for i in ./#*AllRecentChanges* ; do join.pl $i ; done
The script needs to be rewritten to correctly handle sorting of the
elements.
If somebody worked on the same page in the meantime, the RecentChanges
file and the page differ. Although
the RecentChanges file may be merged using mentioned script, I can't
find an easy way to join the files itself.
May I combine the diffs from files somehow? Or would it be better to
render the pages from both servers
using pmwe, merge them and put into CVS with some comment like "%
automatically merged -> possible nonsense"?
Ideas? Comments?
Vaclav Stepan
---
join.pl:
---
#!/usr/bin/perl -w
$one=$ARGV[0];
($two)=$one=~ /\.\#(.*)\.[0-9]+\.[0-9]+/;
rename($two, "$two.tmp");
open(ONE,"<$one") or die("First");
open(TWO,"<$two.tmp") or die("Second");
open(OUT,">$two") or die("Third");
# Read and print from the first file until we get to the text
$r='';
until ($r =~ /^text/) {print OUT $r; $r = <ONE>};
chomp($r);
$r =~ s/^text=//;
@times1=split(/?/,$r);
$r='';
until ($r =~ /^text/) {$r = <TWO>};
chomp($r);
$r =~ s/^text=//;
@times2=split(/?/,$r);
foreach $time ((@times1, @times2)) {
($datum) = $time =~ /.*\. \. \. (.*) by/;
$time{$datum} = $time;
}
print OUT "text=";
foreach $zaznam (sort keys %time) {
print OUT "$time{$zaznam}?";
}
print OUT "\n";
while ($r=<ONE>) {
print OUT $r;
}
close(ONE);
close(TWO);
close(OUT);
unlink("$one");
unlink("$two.tmp");
More information about the pmwiki-users
mailing list