Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

SVN::Client not committing?

by zigdon (Deacon)
on Nov 29, 2006 at 20:08 UTC ( #586812=perlquestion: print w/replies, xml ) Need Help??

zigdon has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, I come seeking your wisdom!

I must be doing something wrong here - but I can't seem to get SVN::Client to commit. Here's a little test program that shows the issue - all it tries to do is to create a new directory on a local working copy, then commit it to the repository:

#!/usr/bin/perl -w use strict; use warnings; use SVN::Client; use Term::ReadLine; use Data::Dumper; my $term = new Term::ReadLine 'MQ Package'; my $path = "/home/boger_d/lib/tmp/svn/repo"; my $svn = SVN::Client->new( auth => [SVN::Client::get_simple_provider(), # set the callback to get the username/password, if needed SVN::Client::get_simple_prompt_provider(\&prompt, 2), SVN::Client::get_username_provider() ]); # log message callback $svn->log_msg(sub {$$_[0] = "testing mkdir"}); # check the current layout print "Before mkdir:\n"; print join "\n", keys %{$svn->ls("$path", "HEAD", 0)}; # create a new directory $svn->mkdir("$path/mkdir"); # and commit it my $res = $svn->commit(["$path/mkdir"], 1); # check new layout print "\n\nAfter mkdir:\n"; print join "\n", keys %{$svn->ls("$path", "HEAD", 0)}; # and the return value of the commit print "\n\nReturn value of commit\n", Dumper $res; sub prompt { my $cred = shift; my $realm = shift; my $default_username = shift; my $may_save = shift; my $pool = shift; print "Enter authentication info for realm: $realm\n"; my $username = $term->readline("Username: "); chomp $username; $cred->username($username); my $password = $term->readline("Password: "); chomp $password; $cred->password($password); }

Seems simple enough, but when it runs, here's what I get:

Before mkdir: mq_check After mkdir: mq_check Return value of commit $VAR1 = undef;

The docs aren't great (and missing from CPAN for some reason - here's a copy), but I believe I'm using the module correctly.

Anyone have any experience with this? Any idea what I might be doing wrong? I can tell it's connecting to the repo ok, since it can list the contents correctly. I can also see it did actually create the new directory, and scheduled it for adding - just not able to commit!

Any help would be greatly appreciated!

-- zigdon

Replies are listed 'Best First'.
Re: SVN::Client not committing?
by Sandy (Curate) on Nov 29, 2006 at 20:43 UTC
    Hello

    Based only on my knowlege of SVN, I believe I know what the problem is:

    After committing a working copy to the repository, the svn info shows that you are still at the last revision.

    To update the information about your working copy (i.e. make it up-to-date with the repository) you must update.

    I presume that there is an update method for SVN::Client?

    So, try an update right after the commit, and see if that 'fixes' the problem.

    Sandy

      Actually, I believe when you do an 'svn commit' from the command line, it does implicitly update the committed resources in the working copy. But I did add an '$svn->update' call at the end of the script, but the checking after the script runs, it still shows the directory as just "marked for adding":
      $ svn info mkdir Path: mkdir URL: file:///home/boger_d/lib/tmp/svn/test/mkdir Revision: 0 Node Kind: directory Schedule: add $ svn update At revision 1. $ svn info mkdir Path: mkdir URL: file:///home/boger_d/lib/tmp/svn/test/mkdir Revision: 0 Node Kind: directory Schedule: add

      -- zigdon

        Was there any answer to this in the end? I am suffering from the same problem.

        Duncs
Re: SVN::Client not committing?
by Anonymous Monk on Jun 15, 2012 at 17:06 UTC

    So i've had this same problem, except I'm trying to mkdir on a repo URL instead of a working copy(it's hosted on localhost through apache2). I should ostensibly be able to set a commit log message and then run mkdir, but that does not work. Instead, nothing happens, I get no error message, and the directories are not created. In fact, the revision number does not even change. if my repo url is

     http://localhost/svn/repo1

    shouldn't I just be able to do:

     $svn->mkdir("http://localhost/svn/repo1/newDir");

    where $svn is an initialized SVN::Client object with the correct authentication information?

    I suspected that it would be something having to do with an access error through apache, but after reviewing both the error and access logs in apache2, I can find no errors, and the script is indeed succeeding in accessing my SVN repo.

    Does anyone have any ideas?

Re: SVN::Client not committing?
by Anonymous Monk on Nov 30, 2006 at 11:18 UTC
    The docs aren't great (and missing from CPAN for some reason - here's a copy)
    Docs are not on cpan because SVN::Client itself is not on CPAN.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://586812]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2019-06-27 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (111 votes). Check out past polls.

    Notices?