简体   繁体   中英

TortoiseSVN merging a branch to trunk

This is a continuation of this question: TortoiseSVN merging branch to trunk If the original question should just be edited, please let me know and I'll do that.

Here's the current situation.

Have a project with a working copy on my PC that was all up to date. I created a new branch based on that and switched my working copy over to this new branch.

Since doing that another developer checked in some changes to the trunk, and I've made some changes to the branch. I don't think we've changed the same files so we should be good as far as any conflicts go.

I want to merge my changes back into the trunk.

I select merge, and then select merge a range of revision. URL to merge from i have the trunk selected. Range is blank. When i do a test merge it appears to be adding every file ever added into the project - it's certainly adding way more files then have been changes since i split off from the trunk. It's doing hundreds of files when there should just be 10 or 20 files changed.

Should i instead select the range of revisions that the other developer checked in to trunk? Or should i instead be selecting 'merge two different trees' ? If I try that and try doing a test merge from trunk to my branch i get a conflict. If i try doing from my branch to trunk, it looks like it works. Although I would then want to push everything back to trunk at that point since I've made some fixes in my branch that i want to include in the trunk before I proceed with any more changes in the branch.

edit : a little more detail to help clarity the current setup

My working copy was previously part of the trunk. I used tortoise to create a new branch and switched my working copy to that branch. So the project looks like: /project/branches/mybranch

trunk looks like /project/trunk

Another dev checked some changes into trunk, and i've checked some changes into mybranch. I want to merge all those changes back into trunk before i do any more work on mybranch. When i view the log for mybranch, there's only 3 checkins; 153, 154 and 159 (and 153 is just the creation of the branch) when i view the log for trunk there are 4 since it was split from the trunk: 155-158

There should be no conflicts as we did not work on the same files.

If i try to merge FROM mybranch and do not specify a revision range, it appears to be adding every file in the project. ie i do a test merge and it's showing hundreds of files as added.

If I do a test merge FROM trunk and specify revision 155-158 that looks like it will merge all the changes from trunk into my working copy. I suppose if i do that i can then check everything into mybranch at which point i just need to figure out how to merge everything back into trunk.

All of the above was done using 'merge a range of revisions'.

If i try doing 'merge two different trees' and try merging FROM trunk to mybranch (with head revision) i get a conflict.

If i try merging FROM mybranch to trunk, it looks like it works.

From what i have seen, it looks like doing the tree merge from mybranch to trunk is what i want to do. I'm just not certain since so far i've been told to do otherwise.

I want everything pushed into trunk. I plan on making large changes to the code in mybranch which will break the project until it's finished, which is why i want trunk to be up to date before i start on that, in case i need to fix any existing code.

edit2 : when i do a merge range of revisions and select mybranch as the url to merge from, this is what shows up in the tortoise window as the command: Command: Merging revisions 1-HEAD of /branches/mybranch into C:\\Users\\xxxx\\Documents\\Visual Studio 2010\\Projects\\MyProject, respecting ancestry, Test Only

My working copy is already on mybranch. So to me this sounds like it's merging mybranch into my working copy, which is already part of mybranch, so basically it's merging mybranch into itself?

Merging FROM trunk is the only thing that would make sense to me. And if do merge FROM trunk and select the revision range that the other dev checked in, the output seems correct. At that point then I would just need to then merge it all back into trunk.

Command: Merging revisions 154-158 of /trunk into C:\\Users\\XXX\\Documents\\Visual Studio 2010\\Projects\\myproject, respecting ancestry, Test Only

The revision numbers that matter are:

trunk: 155-158 - these are the revisions the other dev checked into trunk

mybranch: 153, 154 and 159. 153 is the creation of the branch. 154 and 159 are actual file changes that need to be merged into the trunk.

The other command i just tried which also seems like it will do what i want is if i merge from mybranch to trunk and specify revision 154 or 159 under FROM and revision 152 under TO (trunk). I've never tried working with anything other then the current revision though so I'm not exactly sure what happens if i merge with a revision a few numbers back.

Command: Merging from /branches/mybranch, revision 154 to /trunk, revision 152 into C:\\Users\\xxxx\\Documents\\Visual Studio 2010\\Projects\\myproject, respecting

appreciate any help on clarifying the correct way to do this.

Thanks

URL to merge from i have the trunk selected.

If you want merge back to trunk , then the URL to merge from is your branch . You merge from the repository-version of the branch to the local copy of trunk. When the merge is finished you check in the trunk.

Update : For all who don't want read entire comments bellow: As merk mentioned in the comments, it is necessary to have a checked out copy of the trunk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM