[tex-live] howto partial svn update?

Staszek Wawrykiewicz staw at gust.org.pl
Wed Jan 24 00:17:22 CET 2007

On Wed, 24 Jan 2007, Norbert Preining wrote:

> On Die, 23 Jan 2007, Staszek Wawrykiewicz wrote:
> > I do not know so many svn tricks, but I always use Reinhard's script
> > (made in Bachotek :-) which makes svn update much faster. I hope that 
> > Rainhard is not against if I send you it (he already gave it to the 
> > community some months ago).
> PLease, send it to the list ...

Attached (public domain). You only need to set TEXLIVE_SVN_ROOT
Staszek Wawrykiewicz
StaW at gust.org.pl

-------------- next part --------------
#!/usr/bin/perl -w

# Copyright 2006 Reinhard Kotucha <reinhard.kotucha at web.de>
# Public domain

# Usage: Set the environmment variable TEXLIVE_SVN_ROOT 
# to the directory where the directories Build and Master reside.

# svncleanup is a script which can be used to run svn cleanup or similar
# commands on the files and dirs which had been updated most recently.

if (defined $ENV{'TEXLIVE_SVN_ROOT'}) {
    die "Directory $ENV{'TEXLIVE_SVN_ROOT'} not found\n" .
	"Check TEXLIVE_SVN_ROOT environment variable.\n" 
	unless (-d $ENV{'TEXLIVE_SVN_ROOT'});
} else {
    die "Environment variable TEXLIVE_SVN_ROOT not set.\n";

sub initialize_cleanup {
    open CLEANUP, "> $SVNCLEANUP" or die "Can't open $SVNCLEANUP";
    print CLEANUP "\#!/bin/sh\n\n" .
	"function CMD () { svn cleanup \"\$1\"; }\n\n";
    close CLEANUP;

sub append_cleanup {
    my $file=shift;
    open CLEANUP, ">> $SVNCLEANUP" or die "cant open $SVNCLEANUP";
    print CLEANUP "CMD $file\n";
    close CLEANUP;


# if the number of slashes in a particular (relative) path is smaller
# than $dirlevel we update the files separately instead of the whole
# subtree.

open LOG, "svn log -vq -rBASE:HEAD $ENV{'TEXLIVE_SVN_ROOT'} |";
#open LOG, "svn log -vq -r1500:HEAD $ENV{'TEXLIVE_SVN_ROOT'} |";
while (<LOG>) {
    if (/\s{3}[AMDUCG]\s\/trunk\/([^\s]+).*/) {
	if (length ("$slashes") < $dirlevel) {
	} else {
close LOG;

foreach $dir (keys %dirs) {
    push @alldirs, $dir;

# sort directories in order to get:
#  a/b/c
#  a/b/c/x
#  a/b/c/y
# We will skip directories x and y.  This increases performance significantly.

@sorted_dirs=sort @alldirs;


foreach $dir (@sorted_dirs) {
# skip subdirs which had been processed alreay
    next if ($dir=~/^$lastdir/);
    print "d: svn update $ENV{'TEXLIVE_SVN_ROOT'}/$dir\n";
    append_cleanup "$ENV{'TEXLIVE_SVN_ROOT'}/$dir";
    system "svn update $ENV{'TEXLIVE_SVN_ROOT'}/$dir";

foreach $file (keys %files) {
    print "f: svn update $ENV{'TEXLIVE_SVN_ROOT'}/$file\n";
    append_cleanup "$ENV{'TEXLIVE_SVN_ROOT'}/$file";
    system "svn update $ENV{'TEXLIVE_SVN_ROOT'}/$file";

system "svn update -N $ENV{'TEXLIVE_SVN_ROOT'}";

More information about the tex-live mailing list