How to get "last action" from SVN::Client?

D

david.karr

I've used TortoiseSVN to get all the history entries for a branch.
Each entry has a "last action", indicating "added", "modified", or
"deleted". I'd like to have a Perl script using SVN::Client (or any
other appropriate module) generate this output instead. I've used the
"log" method of SVN::Client, and I've read through the SVN::Client
documentation, but I don't see any way to get this information. The
only reference in the documentation to one of "Add", "Modify", or
"Delete" is when committing a change. What am I missing?
 
D

david.karr

Quoth "david.karr said:
I've used TortoiseSVN to get all the history entries for a branch.
Each entry has a "last action", indicating "added", "modified", or
"deleted".  I'd like to have a Perl script using SVN::Client (or any
other appropriate module) generate this output instead.  I've used the
"log" method of SVN::Client, and I've read through the SVN::Client
documentation, but I don't see any way to get this information.  The
only reference in the documentation to one of "Add", "Modify", or
"Delete" is when committing a change.  What am I missing?

The SVN::Client->log method passes a svn_log_changed_path_t object[0] to
its callback; this is documented in SVN::Core and tells you what changed
in that revision.

Ok, that looks promising. However, when I code this, it seems like
that hash is always empty.

Does it matter that the server is SVN 1.4.x?

This is an excerpt from my script:
-----------------
my $ctx = new SVN::Client(auth =>
[SVN::Client::get_simple_provider()]);

my @revisionsList;

$ctx->log([$opt_element], 1, "HEAD", 1, 0, \&addToRevisionsList);

sub addToRevisionsList($$$$$$) {
my ($changed_paths, $revision, $author, $date, $message, $pool) =
@_;
print "revision[$revision] author[$author] date[$date]
message[$message]\n";
print "changed_paths[$changed_paths] size[" .
keys(%changed_paths) . "]\n";
while(($key, $value) = each(%changed_paths)) {
print "key[$key]\n";
}
}
----------------
 
S

sln

Quoth "david.karr said:
I've used TortoiseSVN to get all the history entries for a branch.
Each entry has a "last action", indicating "added", "modified", or
"deleted".  I'd like to have a Perl script using SVN::Client (or any
other appropriate module) generate this output instead.  I've used the
"log" method of SVN::Client, and I've read through the SVN::Client
documentation, but I don't see any way to get this information.  The
only reference in the documentation to one of "Add", "Modify", or
"Delete" is when committing a change.  What am I missing?

The SVN::Client->log method passes a svn_log_changed_path_t object[0] to
its callback; this is documented in SVN::Core and tells you what changed
in that revision.

Ok, that looks promising. However, when I code this, it seems like
that hash is always empty.

Does it matter that the server is SVN 1.4.x?

This is an excerpt from my script:
-----------------
my $ctx = new SVN::Client(auth =>
[SVN::Client::get_simple_provider()]);

my @revisionsList;

$ctx->log([$opt_element], 1, "HEAD", 1, 0, \&addToRevisionsList);

sub addToRevisionsList($$$$$$) {
my ($changed_paths, $revision, $author, $date, $message, $pool) =
@_;
print "revision[$revision] author[$author] date[$date]
message[$message]\n";
print "changed_paths[$changed_paths] size[" .
keys(%changed_paths) . "]\n";
while(($key, $value) = each(%changed_paths)) {
print "key[$key]\n";
}
}
----------------
"If $changed_paths is defined it references a hash"

so $changed_paths is a hash "reference", you must dereference
it to get the key values. %{$changed_paths}.

use strict;
use warnings;

my $ref = {'a','b', 'c','d'};

while (my ($key, $val) = each %$ref) {
print "$key = $val\n";
}

-sln
 
J

John Bokma

Ben Morrow said:
I've no idea, I'm afraid. I haven't used SVN for quite some time,

Did you migrate to git, and if yes was it an easy migration. As in
migrating the repositories and migrating to the new tool chain?

If not git, I am curious as well.

I use mainly subversion but want to look more into git. I know that
which vc is somewhat a matter of taste, but IMO it doesn't hurt to use
another one for a while.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top