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

Re: Perl bindings (was: Re: SVN::Client -- determine recent interesting rev of file)

From: David James <djames_at_collab.net>
Date: 2006-07-13 05:55:49 CEST

On 7/12/06, Nik Clayton <nik@ngo.org.uk> wrote:
> > One of the things I need to do is, given a repository path and a
> > revision, find the youngest revision in which the path was modified that
> > is less than or equal to the given revision.

Hi Nik,

The Perl bindings for Subversion 1.4 now support svn_client_info.
Using this function, you can easily find out the last revision at
which a specified path was changed. Here's an example script to show
you how.

use SVN::Client;

# Create a new client object
my ($ctx) = SVN::Client->new;

# Print out the last rev before $rev at which the following
# URL was changed
my $url = "http://svn.collab.net/repos/svn/trunk/contrib";
my $rev = 13000;
print last_changed_rev($url, $rev), "\n";

sub last_changed_rev {
  my ($url, $rev) = @_;
  my $last_changed_rev;
  $ctx->info($url, undef, $rev,
       my ($path, $info, $pool) = @_;
       $last_changed_rev = $info->last_changed_rev();
  return $last_changed_rev;

Hope this helps,


David James -- http://www.cs.toronto.edu/~james
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jul 13 05:56:14 2006

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

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