Hg Mercurial - Upgrading code not in repository

49 views Asked by At

I have a customized local repository of NopCommerce 3.5. The new version of NopCommerce (3.6) is out and I would like to try to update to it. I downloaded their source code and I would like to somehow replace all the files in my local repository with the new files (outside the repository) and then have mercurial detect the changes and merge them with my changes. Obviously the merge would be manual but I have no problem with that.

In case I am not explaining this properly, let me give you and example:

I have file foo.cs (v3.5) which has custom code in my local repository. I downloaded the new foo.cs (v3.6) which is not in any repository. How can I merge them so that I can keep my changes and the the new changes added by the NopCommerce team?

This is what I have tried so far: I created a new branch called "Nop3.6" and replaced foo.cs. Then I tried to merge the "Nop3.6" branch with my "default" branch hoping to be able to merge manually and keep both, my custom code and the new changes added in foo.cs (v3.6). As you might expect this didn't work. my foo.cs file (v3.5) was completely replaced with the new foo.cs and all my changes were lost.

Any help in the right direction would be much appreciated.

1

There are 1 answers

1
planetmaker On BEST ANSWER

Doing the merge vice versa (your changes into v3.6 might work better. Also make sure that you have selected a reasonable merge tool (internal works, but there are possibly more convenient ones out there, I use kdiff3 myself):

I assume you have a repository with v3.5 and on top of that you have one or several changesets which are your own modifications of that source. If you haven't committed your changes as changesets on top of v3.5, then do that now.

Then, in order to get a decent merge with v3.6 do the following: update to the unmodified v3.5 again. Copy v3.6 over this and commit the complete change as v3.6. You end up with a repository which has two anonymous branches with v3.5 being their common ancestor.

Now you can merge those two branches. As you possibly want to keep your changes on top of v3.6, update to v3.6 and merge your local changes into that branch.