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

Re: branching and switch question

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2004-08-26 16:32:56 CEST

On Wed, 2004-08-25 at 18:41, Tor Ringstad wrote:
> Ben Collins-Sussman <sussman <at> collab.net> writes:
>
> > If you created the branch by running 'svn cp working-copy URL', you're
> > likely to create a branch in the repository with "unexpected" results.
> > I won't go into detail here.
>
> Could you explain that?
>
> I've been using "svn cp working-copy URL" every now and then as a
> convenient and efficient way of making a snapshot of a wc, and never
> encountered anything unexpected.
>
> Are you implying that this is a dangerous practice?

It's not 'dangerous', but it may not give you what you expect.

If you run 'svn cp -rX URL1 URL2', you know that URL2 will be an *exact*
copy of URL1 in revision X.

If you run 'svn cp working-copy URL2', what happens is that the svn
client crawls over all the 'mixed revisions' in your working copy and
builds a repository tree that exactly reflects those mixed revisions.
And often, it's not what you expect.

Here's an example:

   When you run 'svn rm foo; svn commit':

    1. a new repos revision is created where foo is gone, say, rev N.
    2. foo is (effectively) removed from your .svn/entries file
    3. the working parent-dir of foo is still at rev N-1.

Technically, your working parent-dir is "out of sync" with reality: it
claims to be at rev N-1, yet it's missing foo. But, when you run 'svn
copy working-copy URL', a pristine version of the parent directory is
used to build the server-transaction. The file seems to magically
reappear in the transaction, and the URL doesn't look like a perfect
reflection of your working-copy anymore.

I'm not sure if this is a bug or not. :-) But regardless, the
absolute "cleanest" way to create a branch is to do 'svn cp URL URL'.
No surprises, no edge-cases, and it's much faster too... no need to
crawl your working copy.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Aug 26 16:35:44 2004

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