Prev: Why does perl allow so many different ways of doing essentially the same thing?
Next: FAQ 8.40 How do I avoid zombies on a Unix system?
From: david.karr on 10 Jun 2010 11:57 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?
From: Ben Morrow on 10 Jun 2010 13:03 Quoth "david.karr" <davidmichaelkarr(a)gmail.com>: > 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. Ben [0] I loathe SWIG-generated interfaces...
From: david.karr on 10 Jun 2010 16:00 On Jun 10, 10:03 am, Ben Morrow <b...(a)morrow.me.uk> wrote: > Quoth "david.karr" <davidmichaelk...(a)gmail.com>: > > > 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"; } } ----------------
From: sln on 10 Jun 2010 17:02 On Thu, 10 Jun 2010 13:00:25 -0700 (PDT), "david.karr" <davidmichaelkarr(a)gmail.com> wrote: >On Jun 10, 10:03�am, Ben Morrow <b...(a)morrow.me.uk> wrote: >> Quoth "david.karr" <davidmichaelk...(a)gmail.com>: >> >> > 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
From: sln on 10 Jun 2010 17:33
On Thu, 10 Jun 2010 14:02:21 -0700, sln(a)netherlands.com wrote: >On Thu, 10 Jun 2010 13:00:25 -0700 (PDT), "david.karr" <davidmichaelkarr(a)gmail.com> wrote: > >>keys(%changed_paths) . "]\n"; If you want to print the key/val's: print "@{[%$changed_paths]}\n"; or, just the keys print "@{[keys %$changed_paths]}\n"; Note, its inside quotes "". -sln |