[hg]: IDEA-147086 Add an ability to merge current branch with commit from log

This commit is contained in:
Nadya Zabrodina
2015-11-12 17:02:17 +03:00
parent ce0ca811f9
commit b21affbb36
2 changed files with 34 additions and 0 deletions
+3
View File
@@ -101,6 +101,8 @@
description="Create new tag pointing to this commit"/>
<action class="org.zmlx.hg4idea.action.HgCreateNewBranchFromLogAction" id="hg4idea.CreateNewBranch" text="New Branch..."
description="Create new branch starting from the selected commit"/>
<action class="org.zmlx.hg4idea.action.HgMergeWithRevisionFromLog" id="hg4idea.MergeWithRevision" text="Merge With"
description="Merge with selected revision"/>
<group id="Hg.Mq" class="com.intellij.ide.actions.NonTrivialActionGroup" text="MQ" popup="true"
icon="AllIcons.Modules.Edit">
<action class="org.zmlx.hg4idea.action.mq.HgQImportFromLogAction" id="hg4idea.QImport" text="Import"
@@ -137,6 +139,7 @@
<reference id="hg4idea.UpdateToRevision"/>
<reference id="hg4idea.CreateNewBranch"/>
<reference id="hg4idea.CreateNewTag"/>
<reference id="hg4idea.MergeWithRevision"/>
<separator/>
<reference id="Hg.Mq"/>
<add-to-group group-id="Vcs.Log.ContextMenu"/>
@@ -0,0 +1,31 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zmlx.hg4idea.action;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import com.intellij.vcs.log.VcsFullCommitDetails;
import org.jetbrains.annotations.NotNull;
import org.zmlx.hg4idea.command.HgMergeCommand;
import org.zmlx.hg4idea.repo.HgRepository;
public class HgMergeWithRevisionFromLog extends HgLogSingleCommitAction {
@Override
protected void actionPerformed(@NotNull final HgRepository repository, @NotNull VcsFullCommitDetails commit) {
FileDocumentManager.getInstance().saveAllDocuments();
HgMergeCommand.mergeWith(repository, commit.getId().asString(), UpdatedFiles.create());
}
}