You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dan Mahn <sv...@digidescorp.com> on 2006/04/28 18:05:52 UTC

Merging from Branch from Working Copy

Hello.  I have a question about merging.

Here is my scenario:

- I modified my working copy, creating a new directory and then moving a 
couple files into it.

- Next, I created a branch from the working copy.

- Then I modified the files in the branch.

- Then I tried to merge the changes back to the trunk.

When I try to merge the changes back to trunk, I get an error generally 
like this:

svn: The URL 'https://<ip address>/<etc., etc.>/<Branch Name>/<New 
Directory Name>' has a different repository root than its parent

Well, this seems to be an issue because the new directory that I created 
was not previously existing in the repository, and hence it has no "parent".

Is there some way to work around this issue so that I can merge the work 
back into the trunk?  If I merge from the next newer revision in the 
branch, it will not have an error, but it obviously loses some of the 
edits I made.

By the way, this happened when I was giving a demonstration of 
Subversion (want to replace VSS), so this isn't an actual problem at 
this point.  I'm new to Subversion, however, and I would like to know 
what to do in the future.

Thanks in advance.

- Dan


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

Re: Merging from Branch from Working Copy

Posted by Dan Mahn <sv...@digidescorp.com>.

Ryan Schmidt wrote:
> 
> On Apr 28, 2006, at 20:05, Dan Mahn wrote:
> 
>> - I modified my working copy, creating a new directory and then moving 
>> a couple files into it.
>>
>> - Next, I created a branch from the working copy.
> 
> If I understand correctly, and you did not do a commit between these two 
> steps, then the (or at least a) problem is that you did two tasks in one 
> commit: creating a branch, and modifying files. Those are distinct 
> tasks, and should therefore be two commits. As it is now, you have a 
> branch, but its first revision does not correspond any state of the 
> trunk. So reasonable merging is now not possible.
>

Yes, there was a single commit for both of these steps.


> You should first create the branch, matching some revision of the trunk, 
> and then you can change the branch as you like.
> 
> svn cp $URL/trunk $URL/branches/my-branch -m "Making my-branch"
> svn co $URL/branches/my-branch
> # edit, edit, edit, add, delete
> svn ci -m "Committing changes to my-branch"
> 
> If you already had a working copy of trunk and had already made changes 
> and only then realized that you wanted to make these edits on a new 
> branch, then you should first create the branch as above, then switch 
> your working copy to the branch, then commit the changes.
> 
> svn cp $URL/trunk $URL/branches/my-branch -m "Making my-branch"
> cd working-copy-with-changes
> svn switch $URL/branches/my-branch
> svn ci -m "Committing changes to my-branch"
> 

Yes, I thought of that after I found the problem with merging.  I 
mentioned this technique to someone in the office, and they thought it 
was too complicated to expect someone to create a branch and then switch 
to it in order to commit the changes.

I understand that what I did was somewhat unorthodox, but if someone 
ends up doing this, he has created a problem that can't be easily 
resolved.  If you can't create a branch from your working copy, then why 
is it even an option?

- Dan


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

Re: Merging from Branch from Working Copy

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 28, 2006, at 20:05, Dan Mahn wrote:

> - I modified my working copy, creating a new directory and then  
> moving a couple files into it.
>
> - Next, I created a branch from the working copy.

If I understand correctly, and you did not do a commit between these  
two steps, then the (or at least a) problem is that you did two tasks  
in one commit: creating a branch, and modifying files. Those are  
distinct tasks, and should therefore be two commits. As it is now,  
you have a branch, but its first revision does not correspond any  
state of the trunk. So reasonable merging is now not possible.

You should first create the branch, matching some revision of the  
trunk, and then you can change the branch as you like.

svn cp $URL/trunk $URL/branches/my-branch -m "Making my-branch"
svn co $URL/branches/my-branch
# edit, edit, edit, add, delete
svn ci -m "Committing changes to my-branch"

If you already had a working copy of trunk and had already made  
changes and only then realized that you wanted to make these edits on  
a new branch, then you should first create the branch as above, then  
switch your working copy to the branch, then commit the changes.

svn cp $URL/trunk $URL/branches/my-branch -m "Making my-branch"
cd working-copy-with-changes
svn switch $URL/branches/my-branch
svn ci -m "Committing changes to my-branch"







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