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

Restful interface to Subversion?

From: David Wilson <dw_at_botanicus.net>
Date: Sat, 2 Feb 2008 16:44:54 +0000

Hi there,

I've recently been reading Sam Ruby's excellent book on Restful Web
Services, and slowly appear to be finding alignment with his thinking.
To cut a long story short, his concept entails exposing every
"resource" available in a service as at least one distinct URI, with
the potential for other URIs to expose compound views of other
resources in some meaningful format. The design of a "restful" HTTP
service entails exposing little more than providing implementations of
GET/PUT/POST for manipulating these resources. Designing services
built on these simple concepts has a large number of advantages
(turning every Javascript-aware web browser into a fully capable
application development platform is one example).

It struck a chord, reminding me of what it is like to tail an Apache
access_log while watching a mod_dav_svn commit or checkout, and the
ugly opacity of all the Subversion-internal URLs that fly past.

I've been thinking about this a little bit over the past few days, and
the more I think about it, the more I really wish the Subversion
client used a scheme like this to communicate with the server, rather
than trying to shim itself into the DeltaV/WebDAV scheme (which
clearly results in a lot of ugly complexity).

Take an imaginary Subversion service exposing a restful view of a
repository, rooted at http://svn/repo/:

# List of revisions exposed perhaps in an ATOM-based XML container
(want to Subscribe to new commits? No problem):
http://svn/repo/revisions/

# Data for a single revision, exposed perhaps as some XMLish format by default:
http://svn/repo/revisions/1234
http://svn/repo/revisions/1234/xdelta
http://svn/repo/revisions/1234/compound
http://svn/repo/revisions/1234/properties/svn:log

http://svn/repo/revisions/1234/tree/trunk/someproject/main.c

Creating a new revision could be accomplished with a POST to the
/revisions URL, with the post data being a compound representation of
the revision delta and the revision properties.

Efficiently representing ranges of commits (e.g. for an "svn up") is
something I'm not entirely sure about yet. There's a tonne of other
issues of course, for example, how would the properties of a directory
be exposed without namespace conflicts occurring with the contents of
the directory? etc.

Just posting to see what people think. It would instantly allow e.g.
really nice shell scripting, quick Javascript hacks for talking to
repositories (or even making commits!), and a million other things
that are practically impossible due to the large(ish), opaque C API,
and not to mention actually having the Subversion client installed
(and supported by your OS) in the first place.

I really love the idea of making commits by composing a little XML
document in Javascript, and POSTing it to the correct URL.

Please comment/flame/rebuke/whatever as much as you like, these really
are cheap thoughts that I haven't spent much time refining. :)

Thanks,

David.

Note: please use group-reply or otherwise preserve my e-mail in the CC
header; I'm not currently subscribed.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-02-02 22:23:25 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.