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

RE: [feature] Log HTTP header for autoversioning

From: Stephen Haberman <stephen_at_exigencecorp.com>
Date: 2005-01-14 04:50:24 CET

> >> * use pure WebDAV commands (after turning on Autoversioning).
> >> You get minimal features, but the command set is very tiny
> >> and easy to use.
> >
> > Is there a way to control log messages with this?
>
> Nope.

Dang.

> >> * use WebDAV/deltaV commands.
> >> All features available, though the command set is larger
> >> and more complex.
> >
> > I considered this, but [snip] too hard to roll on my own.
>
> Yup, versioning is hard.

Dang.

> I think your life would be way easier just using the libsvn_client
> python bindings.

...Really?

Here is how easy my life is now:

        io = StringIO.StringIO(text)
        io.seek(0)

        c = pycurl.Curl()
        c.setopt(pycurl.PUT, 1)
        c.setopt(pycurl.URL, self.url + '/' + page)
        c.setopt(pycurl.INFILE, io.read)
        c.setopt(pycurl.INFILESIZE, len(text))
        c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_ANY)
        if self.username is not None:
            c.setopt(pycurl.USERPWD, '%s:%s' % (self.username,
self.password))
        c.perform()

That does a SSL/digest auth PUT with no memory pools, no working copies,
etc. The only thing it doesn't do is have a log message. :-)

Okay, you got me, I don't have the slightest clue how to use the Subversion
C API and the Python bindings that (somewhat) wrap it (I'd love to see a
"real" wrapper that could do something like:

   repo = Repo(myUrl, user, pass)
   oldContents = repo.get('file.txt')
   repo.addOrUpdate('file.txt', newContents)
   repo.commit(log)

My first experience with the bindings was via Greg Stein's SubWiki, which I
was using back in the 0.1/2-ish days. Every ~6 months or so, I take another
look at code like:

http://svn.webdav.org/repos/projects/subwiki/trunk/lib/subwiki/util.py
http://svn.webdav.org/repos/projects/subwiki/trunk/plugins/std/change.py

And, you're right, I could cut/paste hack together something that works, but
deciphering the code out of SubWiki and keeping track of all the handles,
transactions, etc., etc., is not something I could do in a night. The pycurl
code I did in a night. I know I'm being lazy, but that is my guiding metric.

I get that the libsvn_client can do anything and everything. But I think I
can safely assert it is not easy to learn. For just dropping a file into a
svn repo, I think it is way too much overhead.

Perhaps I'm being idealistic, but I just want to put one file into
Subversion, with a log message, in less than 10 lines of code. If you could
provide the libsvn_client example code (preferably Python :-) that does it,
I would be very, very grateful (and would suggest keeping the example around
on the website to benefit others learning the bindings - heck, I could make
a patch for that if you help me with the code :-).

> Why are you determined to reimplement the wheel? Or
> is requiring the presence of svn libs too big a burden?

No, I'm certainly not trying to reinvent the wheel. I'm just being as lazy
as possible. And up until now when log messages created an itch, WebDAV
GET/PUT was, I think you'd have to admit, awesomely simple compared to the
libsvn_client stuff. It did exactly what I wanted.

So, that was my reasoning. You're frustrating me making this libsvn_client
stuff sound easy :-), so perhaps I'll take another crack at deciphering
stuff from the SubWiki code. I'll work on that over the next few days as I
have time. Any pointers would certainly be appreciated.

Thanks,
Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jan 14 04:52:06 2005

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.