You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Casper Hornstrup <ch...@users.sourceforge.net> on 2004/06/12 09:00:56 UTC

Synchronizing two branches

Say I have two branches http://server/repos/branchA and
http://server/repos/branchB.

Head of branchB has some changes that is not on head of
branchA, and I would like to merge these changes to branchA
so that head of branchA has the same content as branchB.
If I cannot assume anything about the history of branchB,
what are the svn commands to do that?

Casper


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

RE: Synchronizing two branches

Posted by Casper Hornstrup <ch...@users.sourceforge.net>.
 

> -----Original Message-----
> From: Ben Collins-Sussman [mailto:sussman@collab.net] 
> Sent: 27. juni 2004 00:33
> To: Casper Hornstrup
> Cc: users@subversion.tigris.org
> Subject: RE: Synchronizing two branches
> 
> On Sat, 2004-06-26 at 17:16, Casper Hornstrup wrote:
> 
> > I should have created the branch directory first using svn mkdir, 
> > committed, and then imported the sources to it or done it 
> completely differently?
> 
> I think I'm completely confused about what you're trying to 
> do.  I assumed that you were doing the "standard" SCM 
> branching/merging thing:
> 
>   * import some code to /trunk.
>   * copy /trunk to /branches/somebranch
>   * make changes to both the trunk and somebranch over many days.
>   * "port" all the changes made on somebranch back to the trunk.
> 
> But it seems like that's not what you're doing.  You don't 
> have two lines of development evolving independently at all.
> 
> Are you simply importing two independent trees into two 
> directories, and then wanting to 'sync' them?  If so, there's 
> no history in either branch to work from.  What does 'sync' 
> mean?  What do you want to happen? 
> Sorry for my confusion.

The scenario I'm trying to find a solution for is this:

For each "normal" branch I have another branch that mirrors the
normal branch. The layout in the repository is:

trunk
branches/branchA
checkin/trunk
checkin/branches/branchA

Now, you checkin your patch on the branch in the checkin directory.
Then some software notices that and will checkout the corresponding
branch (for instance trunk corresponds to checkin/trunk), apply the
patch you just checked in, build the working copy and run tests and
if everything went okay, then the software will merge the patch to
the corresponding branch (trunk in this case). If the working copy
failed to build, or a test failed then the software will revert the
change just committed by you.

This ensures that the trunk branch and branches in the branches
directory will always build and that all tests pass for the contents
of these branches.

Now this is all good, but if some event happen that cause the
software to loose information about the state of the repository
then there may be conflicts when merging which cannot be resolved
since it is an automated system. There could happen a power failure
for instance. So at startup of this software (service), I want to
make sure that the branches (trunk and checkin/trunk and branchA and
checkin/branches/branchA in this case) are equal. I would like to do
this by applying the difference between checkin/trunk and trunk to
checkin/trunk, so checkin/trunk becomes equal (has exactly the same
contents) to trunk which we know is good.

Now, I could just "svn rm checkin/trunk" and "svn cp trunk checkin/trunk",
but then, on their next "svn up", developers would see their working copy
go away and reapear and most likely this will cause merge conflicts in
their working copy.

More information is available at:
http://212.242.245.122/SvnIntegration.pdf

Casper


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

RE: Synchronizing two branches

Posted by Ben Collins-Sussman <su...@collab.net>.
On Sat, 2004-06-26 at 17:16, Casper Hornstrup wrote:

> I should have created the branch directory first using svn mkdir, committed, and
> then imported the sources to it or done it completely differently?

I think I'm completely confused about what you're trying to do.  I
assumed that you were doing the "standard" SCM branching/merging thing:

  * import some code to /trunk.
  * copy /trunk to /branches/somebranch
  * make changes to both the trunk and somebranch over many days.
  * "port" all the changes made on somebranch back to the trunk.

But it seems like that's not what you're doing.  You don't have two
lines of development evolving independently at all.

Are you simply importing two independent trees into two directories, and
then wanting to 'sync' them?  If so, there's no history in either branch
to work from.  What does 'sync' mean?  What do you want to happen? 
Sorry for my confusion.




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

RE: Synchronizing two branches

Posted by Casper Hornstrup <ch...@users.sourceforge.net>.
 

> -----Original Message-----
> From: Ben Collins-Sussman [mailto:sussman@collab.net] 
> Sent: 26. juni 2004 23:56
> To: Casper Hornstrup
> Cc: users@subversion.tigris.org
> Subject: RE: Synchronizing two branches
> 
> On Sat, 2004-06-26 at 13:48, Casper Hornstrup wrote:
> 
> 
> > 
> C:\svntest\svncshconsultdk\newrepos\checkin\trunk\reactos>svn 
> merge -r 
> > 33:HEAD 
> > https://svn.csh-consult.dk/reactos/vendor/reactos/20040628/reactos
> 
> Um, if HEAD == 33, then you're asking 'svn merge' comparing 
> r33 of the vendor branch with r33 of the vendor branch.  
> That's not going to produce a patch, since you're comparing 
> the same tree with itself.  Of course there's no output.  :-)
> 
> You need to compare two 'snapshots' of the vendor tree:  the 
> way the vendor branch looked when it was first created, and 
> the way it looks now.  So you need to compare the revision in 
> which the branch was created with HEAD.

Hmm http://svnbook.red-bean.com/svnbook/ch04s04.html#svn-ch-4-sect-4.1
uses the revision from the output of svn log, but maybe it is because
svn copy was used there? I used svn import so the branch didn't exist
in revision 32, so svn merge complains.

C:\svntest\svncshconsultdk\newrepos\checkin\trunk\reactos>svn merge -r 32:HEAD
https://svn.csh-consult.dk/reactos/vendor/reactos/20040628/reactos
svn: REPORT request failed on '/reactos/!svn/vcc/default'
svn:
Invalid editor anchoring; at least one of the input paths is not a directory and
 there was no source entry

I should have created the branch directory first using svn mkdir, committed, and
then imported the sources to it or done it completely differently?

Casper


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

RE: Synchronizing two branches

Posted by Ben Collins-Sussman <su...@collab.net>.
On Sat, 2004-06-26 at 13:48, Casper Hornstrup wrote:


> C:\svntest\svncshconsultdk\newrepos\checkin\trunk\reactos>svn merge -r 33:HEAD
> https://svn.csh-consult.dk/reactos/vendor/reactos/20040628/reactos

Um, if HEAD == 33, then you're asking 'svn merge' comparing r33 of the
vendor branch with r33 of the vendor branch.  That's not going to
produce a patch, since you're comparing the same tree with itself.  Of
course there's no output.  :-)

You need to compare two 'snapshots' of the vendor tree:  the way the
vendor branch looked when it was first created, and the way it looks
now.  So you need to compare the revision in which the branch was
created with HEAD.



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

RE: Synchronizing two branches

Posted by Casper Hornstrup <ch...@users.sourceforge.net>.
 

> -----Original Message-----
> From: Ben Collins-Sussman [mailto:sussman@collab.net] 
> Sent: 26. juni 2004 17:19
> To: Casper Hornstrup
> Cc: users@subversion.tigris.org
> Subject: RE: Synchronizing two branches
> 
> On Sat, 2004-06-26 at 08:30, Casper Hornstrup wrote:
> 
> > Okay, from reading chapter 4, I believe what I want is:
> > svn merge --ignore-ancestry http://server/repos/branchA 
> > http://server/repos/branchB
> 
> Nope, you've made the "classic mistake".  If you compare the 
> latest versions of both branches, you're defining a "patch" which 
> 
>    * adds all the changes that happened on branch B
>    * removes all the changes that happened on branch A.
> 
> Take a look at the beginning of this section of the book, 
> these first few paragraphs in "Merging a whole branch to another":
> 
> http://svnbook.red-bean.com/svnbook/ch04s04.html#svn-ch-4-sect-4.1
> 
> To get the patch you want, you must compare the beginning of 
> the branch with the end of the branch;  then apply that patch 
> to a working copy of the *other* branch.

I think I have tried that before without success. Svn just returns to
the prompt. The command is correct right? I want to sync
checkin/trunk/reactos to vendor/reactos/20040628/reactos.
HEAD is r33 btw. 

C:\svntest\svncshconsultdk\newrepos\checkin\trunk\reactos>svn log
https://svn.csh-consult.dk/reactos/vendor/reactos/20040628/reactos
------------------------------------------------------------------------
r33 | chorns | 2004-06-26 02:09:53 +0200 (Sat, 26 Jun 2004) | 1 line

ReactOS 20040626
------------------------------------------------------------------------

C:\svntest\svncshconsultdk\newrepos\checkin\trunk\reactos>svn merge -r 33:HEAD
https://svn.csh-consult.dk/reactos/vendor/reactos/20040628/reactos

C:\svntest\svncshconsultdk\newrepos\checkin\trunk\reactos>


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

RE: Synchronizing two branches

Posted by Ben Collins-Sussman <su...@collab.net>.
On Sat, 2004-06-26 at 08:30, Casper Hornstrup wrote:

> Okay, from reading chapter 4, I believe what I want is:
> svn merge --ignore-ancestry http://server/repos/branchA
> http://server/repos/branchB

Nope, you've made the "classic mistake".  If you compare the latest
versions of both branches, you're defining a "patch" which 

   * adds all the changes that happened on branch B
   * removes all the changes that happened on branch A.

Take a look at the beginning of this section of the book, these first
few paragraphs in "Merging a whole branch to another":

http://svnbook.red-bean.com/svnbook/ch04s04.html#svn-ch-4-sect-4.1

To get the patch you want, you must compare the beginning of the branch
with the end of the branch;  then apply that patch to a working copy of
the *other* branch.




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

RE: Synchronizing two branches

Posted by Casper Hornstrup <ch...@users.sourceforge.net>.
 > -----Original Message-----
> From: Ben Collins-Sussman [mailto:sussman@collab.net] 
> Sent: 13. juni 2004 23:44
> To: Casper Hornstrup
> Cc: users@subversion.tigris.org
> Subject: Re: Synchronizing two branches
> 
> Casper Hornstrup wrote:
> 
> > Say I have two branches http://server/repos/branchA and 
> > http://server/repos/branchB.
> > 
> > Head of branchB has some changes that is not on head of 
> branchA, and I 
> > would like to merge these changes to branchA so that head 
> of branchA 
> > has the same content as branchB.
> > If I cannot assume anything about the history of branchB, 
> what are the 
> > svn commands to do that?
> 
> Please chapter 4 of the Subversion book.  At least make an 
> effort, and then come ask specific questions.  :-)

Okay, from reading chapter 4, I believe what I want is:
svn merge --ignore-ancestry http://server/repos/branchA 
http://server/repos/branchB

With my approx. 70MB, 6.800 file, and 1.000 directory code
base I get very poor performance. Now it has run over 2
hours and it has not gotten very far. There is
about a month worth of changes between the two branches.

An example:

U  lib\rtl\makefile
A  lib\rtl\encode.c
U  lib\crtdll\stdlib\wcstomb.c
D  lib\crtdll\stdio\vfprintf.c
D  lib\crtdll\stdio\vfwprint.c
D  lib\crtdll\libc\atexit.h
D  lib\crtdll\libc\file.h
U  lib\crtdll\makefile
U  lib\userenv\setup.c
U  lib\userenv\environment.c

Re: Synchronizing two branches

Posted by Ben Collins-Sussman <su...@collab.net>.
Casper Hornstrup wrote:

> Say I have two branches http://server/repos/branchA and
> http://server/repos/branchB.
> 
> Head of branchB has some changes that is not on head of
> branchA, and I would like to merge these changes to branchA
> so that head of branchA has the same content as branchB.
> If I cannot assume anything about the history of branchB,
> what are the svn commands to do that?

Please chapter 4 of the Subversion book.  At least make an effort, and 
then come ask specific questions.  :-)


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