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

Re: Failed commit after renames

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-06-19 23:24:39 CEST

> 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
Received on Wed Jun 19 23:26:34 2002

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.