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

Re: Merging non-versioned directory into versioned one

From: Ryan Schmidt <subversion-2008c_at_ryandesign.com>
Date: Mon, 27 Oct 2008 15:31:21 -0500

On Oct 27, 2008, at 10:44, Trevor Harmon wrote:

> Occasionally I come across an unfortunate scenario where I've got
> two copies of a directory: an old one checked into a repository,
> and a newer one that happens to exist entirely outside of
> Subversion (not in a repository or working copy). The new one has
> just a few scattered changes compared to the old one.
>
> My goal is to merge the two directories so that the old one is
> updated with all of the new's changes. With a single file, this
> task would be easy: I'd simply replace the working copy with the
> new file, then check in the change. With a directory, however, it's
> a lot more complicated. I can't just replace the old version's
> working copy with the new directory because that would wipe out
> the .svn metadata. Instead, what I've been doing is this:
>
> svn remove mydir
> svn ci mydir
> [copy the new mydir into current directory]
> svn add mydir
> svn ci mydir
>
> Although this works, it has the disadvantage of splitting what
> should be a single repository commit into two. If mydir is large,
> there will be two large changesets for each commit, even if only a
> small portion of the directory has changed.
>
> Is there a better way of handling this? Thanks,

How about (with Subversion 1.5.0 or greater):

rm -rf mydir
cp -Rp /path/to/new/mydir mydir
svn up --force mydir
svn ci mydir

The above is untested by me, but I thought this is what the new --
force option is for.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-10-27 21:32:06 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.