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

Re: [PATCH] Moving/copying added files and dirs

From: Paul Burba <paulb_at_softlanding.com>
Date: 2006-08-08 22:52:14 CEST

"Ivan Zhakov" <chemodax@gmail.com> wrote on 08/08/2006 02:59:16 PM:

> On 8/8/06, Paul Burba <paulb@softlanding.com> wrote:
> > ...and here here it is. This patch supports copying and moving of
added
> > paths within a WC or from a WC to the REPOS.
> Hi, Paul!
> Thank you for continue working on this usefull thing.
>
> >
> > Re issue 1 above, after looking at this I think the solution shouldn't
> > reside in libsvn_wc, but rather in libsvn_client. Trying to teach
> > svn_wc_copy2() to copy paths that are not versioned doesn't make a lot
of
> > sense. It seems all we really need to do is copy the added files
without
> > the administrative directories and then add them. The first task
sounds
> > an awful lot like an export, and with some borrowed/modified code from
> > copy_versioned_files() in export.c that's what this patch does. Then
a
> > call to svn_client_add3() adds the copied files. Does this approach
sound
> > reasonable?
>
> After look to code I agree with you. This approach reasonable. But I
> see two problems with your current patch:
>
> Now unversioned files in versioned commited directory copied when you
> copy directory. I mean:
>
> $ mkdir dir
> $ svn add dir
> $ svn ci -m ""
> $ touch dir\foo
> $ svn st dir
> ? dir\foo
>
> $ svn cp dir dir2
> $ svn st dir2
> ? dir2\foo
>
> But your patch seems copy only versioned files, i.e.
> $ mkdir dir
> $ svn add dir
> $ svn ci -m ""
> $ touch dir\foo
> $ svn st dir
> A dir
> ? dir\foo
>
> $ svn cp dir dir2
> $ svn st dir2
> A dir2

Hi Ivan,

I'm assuming you didn't check in dir in the second example and this is
just a cut and past error(?)
 
> So there is inconsistency. I consider it's bad.

I agree it's somewhat inconsistent, but realize that "svn copy A A_COPY"
copies *only* the first generation unversioned children of "A", for
example, let's take the old reliable greek tree with an unversioned tree
in it rooted at A\D\I, then copy and move it's parent, currently trunk
behaves like this:
------------------------------------------------------------
svn st -v
                1 1 jrandom .
                1 1 jrandom A
                1 1 jrandom A\B
                1 1 jrandom A\B\lambda
                1 1 jrandom A\B\E
                1 1 jrandom A\B\E\alpha
                1 1 jrandom A\B\E\beta
                1 1 jrandom A\B\F
                1 1 jrandom A\mu
                1 1 jrandom A\C
? A\D\I
                1 1 jrandom A\D
                1 1 jrandom A\D\gamma
                1 1 jrandom A\D\G
                1 1 jrandom A\D\G\pi
                1 1 jrandom A\D\G\rho
                1 1 jrandom A\D\G\tau
                1 1 jrandom A\D\H
                1 1 jrandom A\D\H\chi
                1 1 jrandom A\D\H\omega
                1 1 jrandom A\D\H\psi
                1 1 jrandom iota

dir A\D\i /s
 Volume in drive C has no label.
 Volume Serial Number is BC4D-A20A

 Directory of
C:\SVN\svn.trunk.copymove\src-trunk.collabnet.trunk\Release\subversion\tests\cmdline\svn-test-work\working_copies\copy_tests-1\A\D\I

08/08/2006 04:40 PM <DIR> .
08/08/2006 04:40 PM <DIR> ..
08/08/2006 04:40 PM <DIR> J
08/08/2006 04:40 PM 21 unversioned1
               1 File(s) 21 bytes

 Directory of
C:\SVN\svn.trunk.copymove\src-trunk.collabnet.trunk\Release\subversion\tests\cmdline\svn-test-work\working_copies\copy_tests-1\A\D\I\J

08/08/2006 04:40 PM <DIR> .
08/08/2006 04:40 PM <DIR> ..
08/08/2006 04:40 PM 21 unversioned2
               1 File(s) 21 bytes

     Total Files Listed:
               2 File(s) 42 bytes
               5 Dir(s) 78,639,190,016 bytes free

svn cp A\D D_copy
A D_copy

svn mv A\D D_move --force
A D_move
D A\D\gamma
D A\D\G\pi
D A\D\G\rho
D A\D\G\tau
D A\D\G
D A\D\H\chi
D A\D\H\omega
D A\D\H\psi
D A\D\H
D A\D

svn st -v
                1 1 jrandom .
                1 1 jrandom A
                1 1 jrandom A\B
                1 1 jrandom A\B\lambda
                1 1 jrandom A\B\E
                1 1 jrandom A\B\E\alpha
                1 1 jrandom A\B\E\beta
                1 1 jrandom A\B\F
                1 1 jrandom A\mu
                1 1 jrandom A\C
D 1 1 jrandom A\D
D 1 1 jrandom A\D\gamma
D 1 1 jrandom A\D\G
D 1 1 jrandom A\D\G\pi
D 1 1 jrandom A\D\G\rho
D 1 1 jrandom A\D\G\tau
D 1 1 jrandom A\D\H
D 1 1 jrandom A\D\H\chi
D 1 1 jrandom A\D\H\omega
D 1 1 jrandom A\D\H\psi
? D_move\I
A + - 1 jrandom D_move
   + - 1 jrandom D_move\gamma
   + - 1 jrandom D_move\G
   + - 1 jrandom D_move\G\pi
   + - 1 jrandom D_move\G\rho
   + - 1 jrandom D_move\G\tau
   + - 1 jrandom D_move\H
   + - 1 jrandom D_move\H\chi
   + - 1 jrandom D_move\H\omega
   + - 1 jrandom D_move\H\psi
                1 1 jrandom iota
? D_copy\I
A + - 1 jrandom D_copy
   + - 1 jrandom D_copy\gamma
   + - 1 jrandom D_copy\G
   + - 1 jrandom D_copy\G\pi
   + - 1 jrandom D_copy\G\rho
   + - 1 jrandom D_copy\G\tau
   + - 1 jrandom D_copy\H
   + - 1 jrandom D_copy\H\chi
   + - 1 jrandom D_copy\H\omega
   + - 1 jrandom D_copy\H\psi

------------------------------------------------------------

Notice none of the unversioned children of H get moved, while only A\D\I
gets copied.

Also, a related oddity: While svn copy normally copies these first
generation unversioned children, svn move requires you to use --force and
then it *deletes* all the unversioned items in the source and does *not*
copy any of them...so much for "this subcommand is equivalent to a 'copy'
and 'delete'."

My thought when making the patch was to make svn copy more like svn move
when operating on added dirs with unversioned children. I'm definitely
not saying this is the right approach, but to tweak my patch to copy only
first generation children of the source doesn't seem like a good idea
either.

Anyone else have some thoughts on this?
 
Paul B.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 8 22:52:46 2006

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.