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

Re: svn:externals Are checkouts atomic?

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2005-01-26 21:11:33 CET

On Jan 26, 2005, at 1:48 PM, Scott Palmer wrote:
>
> It's certainly non-critical. I just thought I would plant the idea of
> atomic checkouts because it seems like something that would be
> beneficial if it just worked that way.
>

The problem is that the term "atomic" is somewhat loaded, and can mean
many things: atomic at what level?

If I run 'svn checkout URL', am I guaranteed to either get the entire
tree, or no tree at all? Certainly not. So checkouts and updates
certainly aren't "atomic" in that sense. Luckily, they're restartable
and can pick up where they left off. There's no need to have this sort
of atomicity.

If I run 'svn checkout URL', and somebody commits while I'm receiving
the tree, do I get a half-broken tree, perhaps something buggy or
unbuildable? Absolutely not. The checkout and update commands always
grab exactly *one* revision tree, and revision trees are immutable
objects. If you don't specify the revision with -r, then HEAD is
converted to a single revision number at the beginning and that exact
tree is fetched. Repository writers never interfere with repository
readers. So here's at least one sense in which checkout is "atomic".
You always get one specific tree, not a mix of trees.

If I run 'svn checkout URL1 URL2', is it possible to get revision N of
URL1 and revision N+1 of URL2? Yes, but that's just because of the way
the commandline client parses arguments. It treats that command as if
you had typed 'svn checkout URL1; svn checkout URL2', so it's possible
that a commit happens during the first checkout. In this example, the
commandline client isn't treating the targets as an "atomic group"
here. Could this be improved? Surely. But a simple workaround is to
figure out the value of HEAD, then run 'svn checkout -r X URL1 URL2'.

Ways to get HEAD:

   1. svn log -rHEAD repository-root-URL
   2. if you have a working copy, 'svn status -u'.

If you need to programmatically get HEAD, and don't want your program
to parse the output of the commands above, then write a C/Perl/Python
program that calls RA->get_youngest_revision().

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Jan 26 21:15:40 2005

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.