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

svn cp a b; svn cp b c; svn ci

From: mark benedetto king <bking_at_inquira.com>
Date: 2002-08-05 23:33:58 CEST

Why do we disallow the following sequences?

$ svn cp a b
$ svn cp b c
$ svn ci

and

$ svn mv a b
$ svn mv b c
$ svn ci

There is a comment in subversion/libsvn_wc/copy.c that reads:

  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.

Let's assume the worst. Let's assume that the actual sequence of
events is:

$ svn cp a b
$ vi b
$ svn cp b c
$ svn ci

In this case, if c's ancestor is a (not b), then the repo will
show delta(a,b) for b and delta(a,c) for c, rather than
delta(a,b) for b and delta(b,b) for c. Is this such a bad
thing?

svn diff will still work fine. all the other operations I can
think of will still work fine. It's a perfectly valid WC/repo.

The only argument I can think of is that "the log doesn't model
reality". IOW, the log makes it look like we typed "svn cp a b;
svn cp a c; vi b; vi c; svn ci". Well, this may sound like
a compelling argument, but I think it falls apart pretty quickly.
If I were to do "svn cp a b; vi b; ci; svn cp b c; cat a > c;
svn ci" the logs wouldn't model reality either. the SVN log
really *can't* model reality, the best it can do is model a
sequence of events that are serially equivalent to the sequence
of events that actually took place.

--ben

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Aug 5 23:39:52 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.