You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Trevor Harmon <tr...@vocaro.com> on 2008/10/27 15:44:33 UTC

Merging non-versioned directory into versioned one

Hi,

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,

Trevor


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

Re: Merging non-versioned directory into versioned one

Posted by Les Mikesell <le...@gmail.com>.
Trevor Harmon wrote:
> Hi,
> 
> 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,

I'd just copy the changed files over to the working copy and commit. 
Something like:
cd other_copy
rsync -av . /path/to/working_copy
should do it.  You can add the -n (dry-run) option to preview what will 
happen without actually doing it first, and if the source of the copy 
also is a checked out version with subversion metadate, add the 
--cvs-exclude option (which also knows about svn).
If new files have been created in your other copy, you'll have to 'svn 
add' them to commit.

-- 
   Les Mikesell
    lesmikesell@gmail.com

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

Re: Merging non-versioned directory into versioned one

Posted by Ryan Schmidt <su...@ryandesign.com>.
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@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Merging non-versioned directory into versioned one

Posted by Jan Hendrik <li...@gmail.com>.
Concerning Re: Merging non-versioned directory
jhanley@dgtlrift.com wrote on 27 Oct 2008, 10:24, at least in part:

> Quoting Trevor Harmon <tr...@vocaro.com>:
> 
> > Hi,
> >
> > 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.

If you are working under Windows you might try WinMerge.  It can 
compare whole directories (though not whole trees afaik) and lists 
the files which are different or exist only on one side.  You can 
compare those then in particular for each difference and decide 
what to take and what to ommit.  This involves manual work of 
course, but  for "a few scattered changes" it should be comfortable 
enough with WinMerge.

http://sourceforge.net/projects/winmerge

Jan Hendrik
---------------------------------------
Freedom quote:

     Die neue Toleranz duldet nichts mehr außer sich selbst.
     Vielfalt verspricht sie, aber tatsächlich fordert sie viel mehr:
     nicht mehr eine Tugend des zivilen Umgangs, der Duldsamkeit
     gegenüber anderen Formen des Zusammenlebens, sondern die
     gesellschaftliche Marginalisierung der "Intoleranten".
               -- Lorenz Jäger, Homintern,
                    Frankfurter Allgemeine Zeitung, 3. August 2007


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


Re: Merging non-versioned directory into versioned one

Posted by jh...@dgtlrift.com.
Quoting Trevor Harmon <tr...@vocaro.com>:

> Hi,
>
> 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

This procedure would result in the "EOLife" of any artifacts in mydir  
and completely new artifacts that have no relationship with the  
previously deleted.... a better procedure would be:

cd versioned_path
( cd ../unversioned_path ; tar cf - . ) | tar xvf -
svn status | grep "^?" | awk '{ print $2 }' | xargs svn add
# you may need to do something more elaborate with artifacts
#     that have spaces in the name

>
> 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,
>
> Trevor
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org




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


Re: Merging non-versioned directory into versioned one

Posted by Ulrich Eckhardt <ec...@satorlaser.com>.
On Monday 27 October 2008, 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.

There are two scenarios here, depending on whether the state in the repository 
has evolved on its own or not. If it evolved, I would simply create a working 
copy of the version when the non-version directory was forked. I'd then 
simply copy over the non-versioned directory and then update to HEAD in order 
to merge in the changes that occurred since the fork. Note that if there were 
files or directories added, this might require further manual handholding.

If the repository didn't change since the the independent copy was forked, you 
can skip the whole checking out at a certain revision and updating to HEAD, 
just copy over the directory and possibly manually apply added/watch for 
deleted files.

You could also automatically load the independent directory using 
svn_load_dirs, which is designed to create vendor branches.

> 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.

Not only that, but to SVN, the deleted dir and the one added are two separate 
entities which have nothing to do with each other. IOW the history line that 
connects those two is severed, too! Oh, and any delta-algorithms that would 
have reduced the data, both storage and traffic, are not applied either.

Uli

-- 
ML: http://subversion.tigris.org/mailing-list-guidelines.html
FAQ: http://subversion.tigris.org/faq.html
Docs: http://svnbook.red-bean.com/

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.

**************************************************************************************


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