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

[PATCH] Allow replace on repo-to-repo copy

From: Justin Patrin <papercrane_at_gmail.com>
Date: 2007-01-25 07:14:44 CET

In order to support more easily scriptable tagging (among other
things), I've created a patch to allow replacement of the destination
in a repo to repo copy.

Assume that the repo is set up at http://svn.example.com/svn and there
are the normal trunk and tags directories.

An initial:
  svn copy http://svn.example.com/svn/trunk http://svn.example.com/svn/tags/tag1
Will do a copy to tag1. A second call:
  svn copy http://svn.example.com/svn/trunk http://svn.example.com/svn/tags/tag1
will essentially do this:
  svn copy http://svn.example.com/svn/trunk
http://svn.example.com/svn/tags/tag1/trunk
and make a copy of /trunk at /tags/tag1/trunk. This is generally not
what a person means when specifying an already existing tag. You can
do a delete of tag1 and then do another repo to repo copy in order to
replace the tag, but this makes 2 revisions (causing 2 entries in the
log and 2 e-mails if you use commit e-mail hooks). You can get around
this by doing a checkout of the entire repo, deleting the tag in the
checkout, then copying from trunk to tag1 and checking in. This will
replace the tag in a single transaction.

My patch allows you to add --replace to a copy command to override the
default behavior and do a replacement in a single transation.
  svn copy --replace http://svn.example.com/svn/trunk
http://svn.example.com/svn/tags/tag1

I have included 2 patches, one for trunk and one for 1.4.2. My testing
shows that by default svn works the same as before and with --replace
it deletes and copies as expected.

I have not checked closely for possible memory leakage or other logic
errors but I think this patch is nearly ready for comittal, assuming
other clients are fixed accordingly. Adding an additional FALSE to the
end of calls to svn_client_copy4() in trunk and svn_client_copy3() in
1.4.2 should be enough to cause any other clients to compile and work
as normal.

-- 
Justin Patrin



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

Received on Thu Jan 25 07:15:06 2007

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