You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Craig Mills <CM...@intek.com> on 2006/06/12 22:40:24 UTC

Help understanding branch merges

I have a (beginner) question about merging code from a branch back into
the main trunk.  

We made a branch, and one programmer was developing in that branch.
Meanwhile the trunk continued being modified.  It came time to merge the
branch into my main trunk.  

Working from a current directory with my up-top-date HEAD in it, I ran
the command:

svn merge --dry-run svn://host/app
svn://host/app/branches/7Branches/060606Branch


The files listed for changing looked somewhat like what I was expecting,
so went ahead and did the whole merge (without the --dry-run).  

BUT: what appears to have happened is that 
a) the newest files in the branch were all moved into the main trunk:
that is, newer files which had bug fixes in the branch, were brought
into the trunk. This was what I expected.

b) some files (which had been added to the trunk AFTER the branch was
made) were deleted in the trunk as a result of the merge
c) some trunk files were over-written with the (older) files from the
branch which were in place when the branch was 

Parts b) and c) were NOT what I was expecting at all from merging.

It appears that my problem is a flavor of something I saw mentioned in
the list archives: "If you compare the tips of branch and trunk, you're
going to get a diff that you don't want: you'll be specifying "all
branch changes, plus removal of all trunk changes that took place since
the branch was made."

But what I am wondering, is what exactly is the syntax I *should* have
used?  Is merging a two-step process?  I don't understand how to get the
"diff" before I merge.  


My branch was created with revision 99.  So maybe I should have used
something more like:

svn merge --dry-run svn://host/app@99
svn://host/app/branches/7Branches/060606Branch@153

?
Thanx all for your patience...
Craig 

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


Re: Help understanding branch merges

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 13, 2006, at 00:40, Craig Mills wrote:

> Working from a current directory with my up-top-date HEAD in it,

Presumably you mean the up-to-date HEAD *of trunk*


> I ran the command:
>
> svn merge --dry-run svn://host/app
> svn://host/app/branches/7Branches/060606Branch

Why svn://host/app? Is that the URL of your trunk? If so, that's odd;  
it means that your branches are inside your trunk, which could  
certainly be problematic for you later. Most people put their trunk  
in a separate directory, à la this structure:

svn://host/
	app/
		trunk/
		branches/
			somebranch/
			...
		tags/
			sometag/
			...


> The files listed for changing looked somewhat like what I was  
> expecting,
> so went ahead and did the whole merge (without the --dry-run).
>
> BUT: what appears to have happened is that
> a) the newest files in the branch were all moved into the main trunk:
> that is, newer files which had bug fixes in the branch, were brought
> into the trunk. This was what I expected.
>
> b) some files (which had been added to the trunk AFTER the branch was
> made) were deleted in the trunk as a result of the merge
> c) some trunk files were over-written with the (older) files from the
> branch which were in place when the branch was
>
> Parts b) and c) were NOT what I was expecting at all from merging.
>
> It appears that my problem is a flavor of something I saw mentioned in
> the list archives: "If you compare the tips of branch and trunk,  
> you're
> going to get a diff that you don't want: you'll be specifying "all
> branch changes, plus removal of all trunk changes that took place  
> since
> the branch was made."
>
> But what I am wondering, is what exactly is the syntax I *should* have
> used?  Is merging a two-step process?  I don't understand how to  
> get the
> "diff" before I merge.
>
>
> My branch was created with revision 99.  So maybe I should have used
> something more like:
>
> svn merge --dry-run svn://host/app@99
> svn://host/app/branches/7Branches/060606Branch@153

Your branch was created from trunk revision 99, and you have never  
merged any changes from the branch into the trunk? Then the command  
you want, in an up-to-date working copy of the trunk, is:

svn merge -r99:153 svn://host/app/branches/7Branches/060606Branch .

This means: take the changes that occurred between revisions 99 and  
153 on the indicated branch, and repeat them in the current working  
copy ("."). Then you test the changes. Then you commit them, being  
careful to indicate in the commit message that you have merged  
revisions 99 to 153 of that branch into the trunk. This is so that,  
if the branch continues to be used and changed, and you later want to  
merge those additional changes into the trunk, you'll know that your  
next merge command needs to start at revision 153.


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


Re: Help understanding branch merges

Posted by Chris Curvey <cc...@gmail.com>.
What you wanted to do was (from your working directory, which is up-to-date
with the trunk

svn merge -r99:HEAD svn://host/app/branches/7Branches/060606Branch

On 6/12/06, Craig Mills <CM...@intek.com> wrote:
>
> I have a (beginner) question about merging code from a branch back into
> the main trunk.
>
> We made a branch, and one programmer was developing in that branch.
> Meanwhile the trunk continued being modified.  It came time to merge the
> branch into my main trunk.
>
> Working from a current directory with my up-top-date HEAD in it, I ran
> the command:
>
> svn merge --dry-run svn://host/app
> svn://host/app/branches/7Branches/060606Branch
>
>
> The files listed for changing looked somewhat like what I was expecting,
> so went ahead and did the whole merge (without the --dry-run).
>
> BUT: what appears to have happened is that
> a) the newest files in the branch were all moved into the main trunk:
> that is, newer files which had bug fixes in the branch, were brought
> into the trunk. This was what I expected.
>
> b) some files (which had been added to the trunk AFTER the branch was
> made) were deleted in the trunk as a result of the merge
> c) some trunk files were over-written with the (older) files from the
> branch which were in place when the branch was
>
> Parts b) and c) were NOT what I was expecting at all from merging.
>
> It appears that my problem is a flavor of something I saw mentioned in
> the list archives: "If you compare the tips of branch and trunk, you're
> going to get a diff that you don't want: you'll be specifying "all
> branch changes, plus removal of all trunk changes that took place since
> the branch was made."
>
> But what I am wondering, is what exactly is the syntax I *should* have
> used?  Is merging a two-step process?  I don't understand how to get the
> "diff" before I merge.
>
>
> My branch was created with revision 99.  So maybe I should have used
> something more like:
>
> svn merge --dry-run svn://host/app@99
> svn://host/app/branches/7Branches/060606Branch@153
>
> ?
> Thanx all for your patience...
> Craig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>


-- 
The short answer is "Yes."  The long answer is "No."