[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

SVN API in Perl

From: Christian Kuelker <christian.kuelker_at_cipworx.org>
Date: Fri, 18 Dec 2009 16:08:19 +0100

Dear Giulio Troccoli,

> I'm simply trying to get the status of a WC. In my Perl script I have
[...]
> How do I use $status in status_receiver?

The document http://www.perlmonks.org/?node_id=738308 might help.

Attached script shows simple usage. It assumes a checked out repro
at /tmp/svn.

Kind regards
Christian

#!/usr/bin/perl -w
use warnings;
use strict;
use SVN::Client;

my $path = '/tmp/svn';
my $recursive = 1; # for checkout, status
my $update = 1; # status will compare with online repository
my $get_all = 1; # status will get only interesting

my $ctx = SVN::Client->new();
$ctx->status($path,'HEAD',\&status_func,$recursive,$get_all,$update,0);

sub status_func {
    my $p = shift; # path
    my $s = shift; # status object

    if ( $s->copied() ) { # use status object directly
        print 'copied';
    }
    else {
        print q{ } x 6;
    }
    my $e = $s->entry(); # get entry object
    print " commit author " . $e->cmt_author();

    $p =~ s{^$path/}{}gmx;
    print "$p \n";

}
Received on 2009-12-18 16:23:03 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.