From 03b8588e1a19728dd486943b52a45fafdbec59b2 Mon Sep 17 00:00:00 2001 From: Irina Chernushina Date: Sat, 12 Jul 2008 20:05:45 +0400 Subject: [PATCH] SVN: use ancestry parameter for merge file (for IDEA-12035 SVN: "Resolve Text Conflict" creates an EMPTY merge result) --- .../org/jetbrains/idea/svn/SvnBundle.properties | 3 ++- .../org/jetbrains/idea/svn/SvnConfiguration.java | 1 + .../idea/svn/actions/ChangeListsMergerFactory.java | 5 ++--- .../idea/svn/actions/ChangeSetMergerFactory.java | 5 ++--- .../integrate/IntegratedSelectedOptionsDialog.java | 14 ++++++------ .../org/jetbrains/idea/svn/integrate/Merger.java | 10 ++++----- .../idea/svn/integrate/MergerFactory.java | 3 +-- .../jetbrains/idea/svn/integrate/PointMerger.java | 11 +++++----- .../idea/svn/update/SvnIntegrateEnvironment.java | 2 +- .../idea/svn/update/SvnIntegratePanel.form | 25 ++++++++++++---------- .../idea/svn/update/SvnIntegratePanel.java | 10 ++++----- 11 files changed, 45 insertions(+), 44 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties index 7bbbae949b..2892ffc32f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties @@ -556,4 +556,5 @@ action.Subversion.properties.diff.with.local.name=Properties Diff with Local action.Subversion.properties.diff.name=Properties Diff action.Subversion.properties.difference.diff.title=Subversion properties difference: {0} action.Subversion.properties.difference.diff.for.move.title=Subversion properties difference: {0} -> {1} -message.Subversion.files.can.not.be.added.to.subversion.are.not.under.working.copy.text=File(s) {0} can not be added to Subversion control since they are not under working copy. \ No newline at end of file +message.Subversion.files.can.not.be.added.to.subversion.are.not.under.working.copy.text=File(s) {0} can not be added to Subversion control since they are not under working copy. +action.Subversion.integrate.difference.option.use.ancestry.text=&Use ancestry \ No newline at end of file diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java index e6b4902b7f..bd85c2d6f8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java @@ -81,6 +81,7 @@ public class SvnConfiguration implements ProjectComponent, JDOMExternalizable { public boolean UPDATE_RUN_STATUS = false; public boolean UPDATE_RECURSIVELY = true; public boolean MERGE_DRY_RUN = false; + public boolean MERGE_DIFF_USE_ANCESTRY = true; private final Map myMergeRootInfos = new HashMap(); private final Map myUpdateRootInfos = new HashMap(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeListsMergerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeListsMergerFactory.java index cd8c2890b0..8351b13299 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeListsMergerFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeListsMergerFactory.java @@ -18,8 +18,7 @@ public class ChangeListsMergerFactory implements MergerFactory { myChangeListsList = new ArrayList(changeListsList); } - public Merger createMerger(final SvnVcs vcs, final File target, final boolean dryRun, final UpdateEventHandler handler, - final SVNURL currentBranchUrl) { - return new Merger(vcs, myChangeListsList, target, dryRun, handler, currentBranchUrl); + public Merger createMerger(final SvnVcs vcs, final File target, final UpdateEventHandler handler, final SVNURL currentBranchUrl) { + return new Merger(vcs, myChangeListsList, target, handler, currentBranchUrl); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeSetMergerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeSetMergerFactory.java index 3d07a0aff1..eea75f0695 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeSetMergerFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ChangeSetMergerFactory.java @@ -22,8 +22,7 @@ public class ChangeSetMergerFactory implements MergerFactory { mySelectedChanges = new ArrayList(selectedChanges); } - public Merger createMerger(final SvnVcs vcs, final File target, final boolean dryRun, final UpdateEventHandler handler, - final SVNURL currentBranchUrl) { - return new PointMerger(vcs, mySelectedList, target, dryRun, handler, currentBranchUrl, mySelectedChanges); + public Merger createMerger(final SvnVcs vcs, final File target, final UpdateEventHandler handler, final SVNURL currentBranchUrl) { + return new PointMerger(vcs, mySelectedList, target, handler, currentBranchUrl, mySelectedChanges); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java index 1d933c57f4..da9649d94a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java @@ -81,8 +81,9 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper { myWorkingCopiesList.setSelectedIndex(0); } - myDryRunCheckbox.setSelected(SvnConfiguration.getInstance(myVcs.getProject()).MERGE_DRY_RUN); - myStatusBox.setSelected(SvnConfiguration.getInstance(myVcs.getProject()).UPDATE_RUN_STATUS); + SvnConfiguration svnConfig = SvnConfiguration.getInstance(myVcs.getProject()); + myDryRunCheckbox.setSelected(svnConfig.MERGE_DRY_RUN); + myStatusBox.setSelected(svnConfig.UPDATE_RUN_STATUS); mySourceInfoLabel.setText(SvnBundle.message("action.Subversion.integrate.changes.branch.info.source.label.text", currentBranch)); myTargetInfoLabel.setText(SvnBundle.message("action.Subversion.integrate.changes.branch.info.target.label.text", selectedBranchUrl)); @@ -189,12 +190,9 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper { } public void saveOptions() { - SvnConfiguration.getInstance(myVcs.getProject()).MERGE_DRY_RUN = myDryRunCheckbox.isSelected(); - SvnConfiguration.getInstance(myVcs.getProject()).UPDATE_RUN_STATUS = myStatusBox.isSelected(); - } - - public boolean isDryRun() { - return myDryRunCheckbox.isSelected(); + SvnConfiguration svnConfig = SvnConfiguration.getInstance(myVcs.getProject()); + svnConfig.MERGE_DRY_RUN = myDryRunCheckbox.isSelected(); + svnConfig.UPDATE_RUN_STATUS = myStatusBox.isSelected(); } protected JComponent createCenterPanel() { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java index 369bac50cd..4de3ca48cc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java @@ -7,6 +7,7 @@ import com.intellij.util.NotNullFunction; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnBundle; +import org.jetbrains.idea.svn.SvnConfiguration; import org.jetbrains.idea.svn.SvnVcs; import org.jetbrains.idea.svn.update.UpdateEventHandler; import org.tmatesoft.svn.core.SVNException; @@ -23,16 +24,16 @@ import java.util.List; public class Merger { private final List myChangeLists; protected final File myTarget; - protected final boolean myDryRun; protected final SVNDiffClient myDiffClient; protected int myCount; private final ProgressIndicator myProgressIndicator; protected CommittedChangeList myLatestProcessed; protected final SVNURL myCurrentBranchUrl; private StringBuilder myCommitMessage; + protected final SvnConfiguration mySvnConfig; - public Merger(final SvnVcs vcs, final List changeLists, final File target, - final boolean dryRun, final UpdateEventHandler handler, final SVNURL currentBranchUrl) { + public Merger(final SvnVcs vcs, final List changeLists, final File target, final UpdateEventHandler handler, final SVNURL currentBranchUrl) { + mySvnConfig = SvnConfiguration.getInstance(vcs.getProject()); myCurrentBranchUrl = currentBranchUrl; myDiffClient = vcs.createDiffClient(); myChangeLists = changeLists; @@ -40,7 +41,6 @@ public class Merger { Collections.sort(myChangeLists, ByNumberChangeListComparator.getInstance()); myTarget = target; - myDryRun = dryRun; myCount = 0; myProgressIndicator = ProgressManager.getInstance().getProgressIndicator(); myDiffClient.setEventHandler(handler); @@ -77,7 +77,7 @@ public class Merger { protected void doMerge() throws SVNException { myDiffClient.doMerge(myCurrentBranchUrl, SVNRevision.UNDEFINED, SVNRevision.create(myLatestProcessed.getNumber() - 1), - SVNRevision.create(myLatestProcessed.getNumber()), myTarget, true, true, false, myDryRun); + SVNRevision.create(myLatestProcessed.getNumber()), myTarget, true, true, false, mySvnConfig.MERGE_DRY_RUN); } @NonNls diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergerFactory.java index abf922bd70..a8a45c483f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergerFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergerFactory.java @@ -7,6 +7,5 @@ import org.tmatesoft.svn.core.SVNURL; import java.io.File; public interface MergerFactory { - Merger createMerger(final SvnVcs vcs, final File target, - final boolean dryRun, final UpdateEventHandler handler, final SVNURL currentBranchUrl); + Merger createMerger(final SvnVcs vcs, final File target, final UpdateEventHandler handler, final SVNURL currentBranchUrl); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java index fa25971cc4..e879d71b6e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java @@ -26,10 +26,10 @@ public class PointMerger extends Merger { private SvnVcs myVcs; private final UpdateEventHandler myHandler; - public PointMerger(final SvnVcs vcs, CommittedChangeList selectedChangeList, final File target, final boolean dryRun, - final UpdateEventHandler handler, final SVNURL currentBranchUrl, final List selectedChanges) { + public PointMerger(final SvnVcs vcs, CommittedChangeList selectedChangeList, final File target, final UpdateEventHandler handler, final SVNURL currentBranchUrl, + final List selectedChanges) { super(vcs, new ArrayList(Arrays.asList(selectedChangeList)), - target, dryRun, handler, currentBranchUrl); + target, handler, currentBranchUrl); myHandler = handler; myVcs = vcs; mySelectedChanges = selectedChanges; @@ -65,7 +65,7 @@ public class PointMerger extends Merger { myDiffClient.doMerge(SVNURL.parseURIEncoded(beforeUrl), ((SvnRevisionNumber) before.getRevisionNumber()).getRevision(), SVNURL.parseURIEncoded(afterUrl), ((SvnRevisionNumber) after.getRevisionNumber()).getRevision(), - afterPath, false, true, false, myDryRun); + afterPath, false, true, false, mySvnConfig.MERGE_DRY_RUN); } private void delete(final Change change) throws SVNException { @@ -78,7 +78,7 @@ public class PointMerger extends Merger { final String beforeUrl = before.getFullPath(); final File beforePath = SvnUtil.fileFromUrl(myTarget, path, beforeUrl); - myWcClient.doDelete(beforePath, false, myDryRun); + myWcClient.doDelete(beforePath, false, mySvnConfig.MERGE_DRY_RUN); } private void add(final Change change) throws SVNException { @@ -93,6 +93,7 @@ public class PointMerger extends Merger { final SVNRevision revision = ((SvnRevisionNumber)after.getRevisionNumber()).getRevision(); final SVNCopySource[] copySource = new SVNCopySource[]{new SVNCopySource(revision, revision, SVNURL.parseURIEncoded(afterUrl))}; + // todo dry run myCopyClient.doCopy(copySource, afterPath, false, true, true); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java index f631f34899..586f90b841 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java @@ -108,7 +108,7 @@ public class SvnIntegrateEnvironment extends AbstractSvnUpdateIntegrateEnvironme diffClient.setEventHandler(myHandler); diffClient.doMerge(info.getUrl1(), info.getRevision1(), info.getUrl2(), info.getRevision2(), root, - svnConfig.UPDATE_RECURSIVELY, true, false, svnConfig.MERGE_DRY_RUN); + svnConfig.UPDATE_RECURSIVELY, svnConfig.MERGE_DIFF_USE_ANCESTRY, false, svnConfig.MERGE_DRY_RUN); SvnConfiguration.getInstance(myVcs.getProject()).LAST_MERGED_REVISION = getLastMergedRevision(info.getRevision2(), info.getUrl2()); return info.getResultRevision(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.form b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.form index 926f7457b8..e1fd4580a9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.form +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.form @@ -1,18 +1,16 @@
- + - - - + @@ -20,8 +18,7 @@ - - + @@ -29,23 +26,29 @@ - - + - + - - + + + + + + + + + diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.java index 606dfcc0bf..0e7409c61d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegratePanel.java @@ -15,14 +15,12 @@ */ package org.jetbrains.idea.svn.update; +import com.intellij.openapi.options.ConfigurationException; +import com.intellij.openapi.vcs.FilePath; import org.jetbrains.idea.svn.SvnConfiguration; import org.jetbrains.idea.svn.SvnVcs; import javax.swing.*; - -import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.options.ConfigurationException; - import java.util.Collection; public class SvnIntegratePanel extends AbstractSvnUpdatePanel{ @@ -32,6 +30,7 @@ public class SvnIntegratePanel extends AbstractSvnUpdatePanel{ private JCheckBox myRecursiveBox; private JPanel myRootOptionsPanel; private JPanel myPanel; + private JCheckBox myUseAncestry; public SvnIntegratePanel(final SvnVcs vcs, Collection roots) { super(vcs); @@ -49,11 +48,12 @@ public class SvnIntegratePanel extends AbstractSvnUpdatePanel{ public void reset(final SvnConfiguration configuration) { super.reset(configuration); myDryRunCheckbox.setSelected(configuration.MERGE_DRY_RUN); - + myUseAncestry.setSelected(configuration.MERGE_DIFF_USE_ANCESTRY); } public void apply(final SvnConfiguration configuration) throws ConfigurationException { super.apply(configuration); configuration.MERGE_DRY_RUN = myDryRunCheckbox.isSelected(); + configuration.MERGE_DIFF_USE_ANCESTRY = myUseAncestry.isSelected(); } protected JComponent getPanel() { -- 2.11.4.GIT