You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by John Goerzen <jg...@complete.org> on 2003/05/01 20:12:29 UTC

Python ra sessions?

Hello,

I'm working on writing a Python script that talks to remote
Subversion servers.  I've got it as far as the svn_ra_get_ra_library()
step (ie, not very far).  The next thing I seem to need to do is to
get a session object.  However, this involves a lot of callbacks and I
haven't seen any examples or information about how to set that up in
Python.  The internal code libsvn_client uses doesn't seem to be
exported through the Swig bindings either, so I'm sorta stuck.  I also
couldn't find anything in the examples that ship with Subversion.

Anybody have any info?

Thanks,
John


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by cm...@collab.net.
John Goerzen <jg...@complete.org> writes:

> Is this more doable in C?  That is, am I stuck because of the Python
> RA bindings, or because of the RA lib itself, or because I'm being
> stupid some other way?

If you insist on using the RA interface, then yes, it is more doable
in C than Python because the Python RA bindings aren't up to snuff.

My opinion of why you are stuck?  You're trying to design a sandwich
at the atomic level instead of just slapping together the bread, ham,
cheese, and lettuce your already have sitting in your refrigerator.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by John Goerzen <jg...@complete.org>.
On Fri, May 02, 2003 at 11:10:32AM -0500, cmpilato@collab.net wrote:
> Yeah, I guess you could try to use that.
> 
> I apologize, John, but I have to really need to bail out of trying to
> help you further on this.  I can't seem to convince you that you're
> killing yourself needlessly.  I mean, if your itching to do some

Yeah, I'm the type that has to fail miserably before learning not to do
something.  Thanks for your assistance anyway.

Is this more doable in C?  That is, am I stuck because of the Python RA
bindings, or because of the RA lib itself, or because I'm being stupid some
other way?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by cm...@collab.net.
John Goerzen <jg...@complete.org> writes:

> cmpilato@collab.net writes:
> 
> > One caveat: don't expect your second repository to be a true copy of
> > your first.  The repository stores all kinds of interesting bits of
> > data about how files and dirs have been copied and moved around, and
> > almost none of that is exposed via the RA interfaces.  You should be
> 
> Hrmm, that will likely be a fatal flaw then.  Is that exposed at the
> repos layer or would I have to go down to the fs?
>
> Though, isn't the svn command-line client able to access that
> information?  For instance, a svn log -v will show where something was
> copied from, and it obviously knows about adds and deletes.

Yeah, I guess you could try to use that.

I apologize, John, but I have to really need to bail out of trying to
help you further on this.  I can't seem to convince you that you're
killing yourself needlessly.  I mean, if your itching to do some
Python, you'd be better off just writing a simple Python server that
pipes 'svnadmin dump' output across a socket, and a client that pipes
that junk through 'svnadmin load'.  But the RA bindings have had
practically no attention given them, and the functionality they would
offer is far too abstract to earn a higher priority than getting the
svn_client, svn_wc, svn_repos, and svn_fs bindings up to speed.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by John Goerzen <jg...@complete.org>.
cmpilato@collab.net writes:

> One caveat: don't expect your second repository to be a true copy of
> your first.  The repository stores all kinds of interesting bits of
> data about how files and dirs have been copied and moved around, and
> almost none of that is exposed via the RA interfaces.  You should be

Hrmm, that will likely be a fatal flaw then.  Is that exposed at the
repos layer or would I have to go down to the fs?

Though, isn't the svn command-line client able to access that
information?  For instance, a svn log -v will show where something was
copied from, and it obviously knows about adds and deletes.

Anyway, I'm still stuck trying to build a session object in Python.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by cm...@collab.net.
John Goerzen <jg...@complete.org> writes:

> >> bidirectional sync, since I think that's not at all appropriate.
> >
> > What do you mean by "copying the revision over"?  
> 
> To be sure, I don't know yet.
> 
> My theory, from reading a chapter in the book and dome of the doxygen
> material, is that I should be able to obtain a delta and properties
> from each given source revision, and should then be able to commit a
> revision on the destination side using the same delta and properties.
> 
> Now that's only a theory, so if you have to shoot it down, I'll paint
> a nice target on it for you :-)

Nono, now that I see what your plan is, it's not terribly unfeasible.
I think you'd make better use of your time soaking up the Indian Ocean
with paper towels, but hey, it's your time.  :-)

One caveat: don't expect your second repository to be a true copy of
your first.  The repository stores all kinds of interesting bits of
data about how files and dirs have been copied and moved around, and
almost none of that is exposed via the RA interfaces.  You should be
able to get a second repository that has the same directory layout and
textual/property contents as the first, but structurally there will be
a world of difference.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by John Goerzen <jg...@complete.org>.
cmpilato@collab.net writes:
> The problem you're going to run into is that we don't *have* an API
> for addressing the entire repository via a remote machine.

Hmm, my thinking was that I wouldn't need any more access than
svn_client is able to attain.  Since svn_client is able to obtain full
information about the status of the repository at each revision, plus
revision properties such as dates, couldn't my own program obtain the
same information via svn_ra?

Likewise, as svn_client is able set these things for its commits, it
would seem to be doable.

>> bidirectional sync, since I think that's not at all appropriate.
>
> What do you mean by "copying the revision over"?  

To be sure, I don't know yet.

My theory, from reading a chapter in the book and dome of the doxygen
material, is that I should be able to obtain a delta and properties
from each given source revision, and should then be able to commit a
revision on the destination side using the same delta and properties.

Now that's only a theory, so if you have to shoot it down, I'll paint
a nice target on it for you :-)

> I have a sneaking suspicion that the number of brick walls you are
> about to encounter is akin to, oh, a cross-section of post-Fire
> Chicago.

Well, as long as it's not impossible... :-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by cm...@collab.net.
John Goerzen <jg...@complete.org> writes:

> cmpilato@collab.net writes:
> 
> > Well, it really depends on what you are wanting to *do* with the RA
> > bindings.  Obviously, if you use the svn_client bindings, then you're
> > going to be limited to the types of operations exposed by that API.
> >
> > If you give me an example of what you're trying to do, I might be of
> > more assistance.
> 
> OK, well first let me say that I haven't dabbled with the SVN API much
> yet.  Just some simple things.  This is going to be a learning
> experience for me, and I'm using Python.

Okey dokey.

> I have a need to take a complete backup of a remote repository *,
> and this seems like a good way. Plus it's a good way for me to learn
> about the Subversion API.

Hm.  We use hot-backup.py + rsync to do the same, but that's if
irrelevant if your goal is to the learn the API.

The problem you're going to run into is that we don't *have* an API
for addressing the entire repository via a remote machine.

> As far as algorithm goes, my idea is to connect to each repository and
> get the latest revision number.  Any revision that's not yet in the
> destination repository gets copied over, hopefully with per-revision
> properties (like svn:date) intact.  I'm not planning any kind of
> bidirectional sync, since I think that's not at all appropriate.

What do you mean by "copying the revision over"?  

I have a sneaking suspicion that the number of brick walls you are
about to encounter is akin to, oh, a cross-section of post-Fire
Chicago.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by John Goerzen <jg...@complete.org>.
cmpilato@collab.net writes:

> Well, it really depends on what you are wanting to *do* with the RA
> bindings.  Obviously, if you use the svn_client bindings, then you're
> going to be limited to the types of operations exposed by that API.
>
> If you give me an example of what you're trying to do, I might be of
> more assistance.

OK, well first let me say that I haven't dabbled with the SVN API much
yet.  Just some simple things.  This is going to be a learning
experience for me, and I'm using Python.

What I'm trying to do is write "svnmirror".  The idea is to give it
two repository URLs -- a source and a destination.  One or both of
these could be remote.  When run, it will issue appropriate commands
to the destination repository to make it a mirror image of the
source.  No working copy should be involved at any point, which
appears to completely rule out svn_client (or almost).

You might wonder "what's the use when we have svnadmin dump?"  Well,
there are several uses.  One is that it's hard to do svnadmin dump in
a reliable way without doing this anyway.  You could set up a cron job
to issue a dump each day and e-mail it, but you then have to deal with
dropped e-mails, remembering the last rev covered, etc.  svnadmin dump
also does not work on anything but a repository that one has direct
local access too.  I have a need to take a complete backup of a remote
repository *, and this seems like a good way.  Plus it's a good way for
me to learn about the Subversion API.

As far as algorithm goes, my idea is to connect to each repository and
get the latest revision number.  Any revision that's not yet in the
destination repository gets copied over, hopefully with per-revision
properties (like svn:date) intact.  I'm not planning any kind of
bidirectional sync, since I think that's not at all appropriate.

* Ok, so svnadmin dump could work for me since I do have a shell over
  there, but it's not nearly as exciting :-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by cm...@collab.net.
John Goerzen <jg...@complete.org> writes:

> cmpilato@collab.net writes:
> 
> >> step (ie, not very far).  The next thing I seem to need to do is to
> >> get a session object.  However, this involves a lot of callbacks and I
> 
> > I'd recommend using the public svn_client bindings, and I'd recommend
> > holding off on that for a just a few minutes while I commit some
> > useful changes there.   
> 
> I'm having trouble figuring out how to do that in Python.  Can you
> give an example, or is that what you're adding with your commits?
> (I'm running 0.21, BTW)

Well, it really depends on what you are wanting to *do* with the RA
bindings.  Obviously, if you use the svn_client bindings, then you're
going to be limited to the types of operations exposed by that API.

If you give me an example of what you're trying to do, I might be of
more assistance.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by John Goerzen <jg...@complete.org>.
cmpilato@collab.net writes:

>> step (ie, not very far).  The next thing I seem to need to do is to
>> get a session object.  However, this involves a lot of callbacks and I

> I'd recommend using the public svn_client bindings, and I'd recommend
> holding off on that for a just a few minutes while I commit some
> useful changes there.   

I'm having trouble figuring out how to do that in Python.  Can you
give an example, or is that what you're adding with your commits?
(I'm running 0.21, BTW)

-- John


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Python ra sessions?

Posted by cm...@collab.net.
John Goerzen <jg...@complete.org> writes:

> Hello,
> 
> I'm working on writing a Python script that talks to remote
> Subversion servers.  I've got it as far as the svn_ra_get_ra_library()
> step (ie, not very far).  The next thing I seem to need to do is to
> get a session object.  However, this involves a lot of callbacks and I
> haven't seen any examples or information about how to set that up in
> Python.  The internal code libsvn_client uses doesn't seem to be
> exported through the Swig bindings either, so I'm sorta stuck.  I also
> couldn't find anything in the examples that ship with Subversion.

I'd recommend using the public svn_client bindings, and I'd recommend
holding off on that for a just a few minutes while I commit some
useful changes there.   

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org