diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgMergeProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgMergeProvider.java index 8df9cfb381eb..8a93dca6f04e 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgMergeProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgMergeProvider.java @@ -62,18 +62,16 @@ public class HgMergeProvider implements MergeProvider { if (wasFileCheckedIn(repo, file)) { // 1. We checked in. // We have a merge in progress, which means we have 2 heads (parents). - // the revision with greater revision number is "their" revision pulled from the parent repo, - // the revision with lesser revision number is the local change. see http://hgbook.red-bean.com/read/a-tour-of-mercurial-merging-work.html - // to retrieve the base version we get the parent of the local change, i.e. the [only] parent of appropriate parent - grandparent. + // the second one is "their" revision pulled from the parent repo, + // first parent is the local change. + // to retrieve the base version we get the parent of the local change, i.e. the [only] parent of the first parent. + //Whick one is local revision depends on which one is merged with, + // i.e if you update to 17 revision and then merge it woth 23, so 17 is your local and 17->parent is your base revision. + // This may produce misunderstanding when you update your project with merging (your update firstly to next revisions and then + // merge with previous). see http://hgbook.red-bean.com/read/managing-releases-and-branchy-development.html final Pair parents = command.parents(repo, file); - if (parents.first.getRevision().compareTo(parents.second.getRevision()) > 0) { - serverRevisionNumber = parents.first; - localRevisionNumber = parents.second; - } - else { - serverRevisionNumber = parents.second; - localRevisionNumber = parents.first; - } + serverRevisionNumber = parents.second; + localRevisionNumber = parents.first; final HgContentRevision local = new HgContentRevision(myProject, hgFile, localRevisionNumber); mergeData.CURRENT = local.getContentAsBytes(); // we are sure that we have a grandparent, because otherwise we'll get "repository is unrelated" error while pulling, diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java index cf0915a5f200..91f06c5f135b 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java @@ -113,10 +113,7 @@ public class HgRegularUpdater implements HgUpdater { abortOnMultiplePulledHeads(pulledBranchHeads); abortOnMultipleLocalHeads(remainingOriginalBranchHeads); - //update to the pulled in head, because we consider that head as the 'authoritative' head - updateToPulledHead(repository, updatedFiles, pulledBranchHeads.get(0), indicator); - - HgCommandResult mergeResult = doMerge(updatedFiles, indicator, warnings, remainingOriginalBranchHeads.get(0)); + HgCommandResult mergeResult = doMerge(updatedFiles, indicator, warnings, pulledBranchHeads.get(0)); if (shouldCommitAfterMerge()) { commitOrWarnAboutConflicts(warnings, mergeResult);