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

Re: RFE: copy with metadataOnly should allow removed/replaced sources and added/replaced targets

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 23 Apr 2015 15:59:29 +0100

Marc Strapetz wrote:
> Using copy with the new metadataOnly option (through the API) only allows to
> "move" or "copy" a missing file onto an unversioned file. It could also be
> helpful to copy/move metadata from a removed (or replaced) source to an
> already added (or replaced) target.
>
>
> Use case 1: the user has removed file "a" and moved file "b" to file "a"
> without using SVN:
>
> $ svn status
> M a
> ! b
>
> Goal is to preserve "b"'s history for the new "a" and have the history of
> the old "a" being ended.

Marc,

If I understand correctly, the goal of this example is to make the
version control operations reflect the filesystem operations, so that
we end up with:

path 'a': replaced with a copy from 'b'
path 'b': deleted (or rather the object that was here has been moved
to path 'a')

> With metadataOnly being more tolerant, this could
> then be done by:
>
> $ svn rm --keep-local a
> $ svn add a
> $ svn cp --metadata-only b a

I don't understand why you suggest that sequence of commands. I don't
expect 'svn cp' should allow copying to a destination that's already
under version control (that is, 'a' after 'svn add a'), metadata-only
or not. I would expect 'svn cp --metadata-only' to do everything just
the same as plain 'svn cp' except not touch or look at what's on disk:
so not try to copy the disk file and not care about whether the file
is present on disk at either the source or target location.

Therefore I think the appropriate sequence for your example would be:

  $ svn rm --keep-local a
  $ svn mv --metadata-only b a

or, more-or-less equivalently (but without 'local move tracking'):

  $ svn rm --keep-local a
  $ svn cp --metadata-only b a
  $ svn rm --metadata-only b

In other words, I would expect the required svn metadata-only commands
to mirror the disk-level commands that the user performed initially.

> Use case 2: the user has moved file "a" to file "b" and created a new file
> "a" without using SVN:
>
> $ svn status
> M a
> ? b
>
> Goal is to preserve old "a"'s history for "b" and start a new history for
> new "a". With metadataOnly being more tolerant, this could then be done by:
>
> $ svn rm --keep-local a
> $ svn add a
> $ svn cp --metadata-only a b

And there again, I would expect:

  $ svn mv --metadata-only a b
  $ svn add a

or

  $ svn cp --metadata-only a b
  $ svn rm --metadata-only a
  $ svn add a

Does that make more sense?

- Julian
Received on 2015-04-23 17:06:53 CEST

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.