[svk-devel] Many add-s, rm-s, propset-s - how to avoid many store()s rewriting the config file?

Peter Valdemar Mørch swp5jhu02 at sneakemail.com
Tue May 8 14:54:42 EDT 2007


Hi,

I want to keep a directory tree with 1000s of files under version 
control with svk.

I also want to keep a record of the file mode, uid and gid of the 
different files as properties with propset.


What I intended to do was to
#!/usr/bin/perl -w
use strict;
use SVK;
use SVK::XD;

and then look at the output of $svk->status("/dir/to/tree"). For each 
line beginning with /^\?/ $svk->add($file) and for each line /^\!/ 
$svk->rm($file) and then $svk->propset('mode', $mode, $file) and similar 
for uid and gid.

However, this takes *forever* - especially initially. Because after 
every operation, store() is called that does a YAML::DumpFile() on 
$SVKROOT/config and presumably a LoadFile() again right after. As config 
gets bigger, this takes longer and longer and longer.

Is there any way to only have it do *one* store - in the end when it is 
done, instead of the many, many stores in between?

As an experiment I just used YAML directly on the config file, and what 
took hours with $svk->???() took a second or two with YAML... But 
messing with the config file directly is, well, messy.

What to do? In XD.pm, sub store has this:
   return unless $self->{statefile};
Is there some proper way to temporary delete the statefile key and then 
re-insert it just before the last operation?

Peter
-- 
Peter Valdemar Mørch
http://www.morch.com


More information about the svk-devel mailing list