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

Re: Is this supposed to work?

From: B. W. Fitzpatrick <fitz_at_red-bean.com>
Date: 2002-06-21 03:44:40 CEST

> Hi,
> Is this supposed to work, or is it one of those "we don't handle this"
> cases:
>
> svn mv b c; svn mv a b

While the error is caused by something different, I suspect that this
falls under the umbrella of the following email that Ben
Collins-Sussman sent to the list yesterday (included below for
convenience).

Ben, please correct me if I'm wrong.

-Fitz

------- Forwarded Message

To: Blair Zajac <blair@orcaware.com>
Cc: Subversion Developers Mailing List <dev@subversion.tigris.org>
From: Ben Collins-Sussman <sussman@collab.net>
Date: 19 Jun 2002 16:24:39 -0500

> svnadmin create repos
> svn co file:///`pwd`/repos -d r
> cd r
> mkdir 1
> touch 1/1
> svn add 1 1/1
> svn ci -F /dev/null
> svn mv 1 2
> svn mv 2/1 2/2
> svn ci -F /dev/null

I see the bug, and I know what's wrong.

The bug is that the second 'mv' command didn't just error out right
there on the spot, as it should have.

Remember that a scheduled 'mv' is just a scheduled 'cp'
(add-with-history) followed by a scheduled 'rm'. And we *don't*
allow something to be copied twice. In other words:

   svn cp A B
   svn cp B C

is illegal, and needs to be prevented by libsvn_wc... which it's
apparently not doing anymore. The second 'cp' is clobbering the
entry's copyfrom-url field (which already existed from the first
copy.)

Here's a comment from our code, at the bottom of libsvn_wc/copy.c:

/*
  Rabbinic Commentary

  Q: Why can't we 'svn cp' something that we just copied?
      i.e. 'svn cp foo foo2; svn cp foo2 foo3"

  A: It leads to inconsistencies.

      In the example above, foo2 has no associated repository URL,
      because it hasn't been committed yet. But suppose foo3 simply
      inherited foo's URL (i.e. foo3 'pointed' to foo as a copy
      ancestor by virtue of transitivity.)
 
      For one, this is not what the user would expect. That's
      certainly not what the user typed! Second, suppose that the
      user did a commit between the two 'svn cp' commands. Now foo3
      really *would* point to foo2, but without that commit, it
      pointed to foo. Ugly inconsistency, and the user has no idea
      that foo3's ancestor would be different in each case.

      And even if somehow we *could* make foo3 point to foo2 before
      foo2 existed in the repository... what's to prevent a user from
      committing foo3 first? That would break.

*/

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

------- End of Forwarded Message

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jun 21 03:45:10 2002

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