mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-109794 ability to push mercurial bookmark
This commit is contained in:
@@ -108,6 +108,7 @@ public class HgPusher {
|
||||
command.setRevision(dialog.getRevision());
|
||||
command.setForce(dialog.isForce());
|
||||
command.setBranchName(dialog.getBranch());
|
||||
command.setBookmarkName(dialog.getBookmarkName());
|
||||
command.setIsNewBranch(dialog.isNewBranch());
|
||||
return command;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class HgPushCommand {
|
||||
private String myRevision;
|
||||
private boolean myForce;
|
||||
private String myBranchName;
|
||||
private String myBookmarkName;
|
||||
private boolean myIsNewBranch;
|
||||
|
||||
public HgPushCommand(Project project, @NotNull VirtualFile repo, String destination) {
|
||||
@@ -50,14 +51,18 @@ public class HgPushCommand {
|
||||
myForce = force;
|
||||
}
|
||||
|
||||
public void setBranchName(String branch) {
|
||||
myBranchName = branch;
|
||||
public void setBranchName(String branchName) {
|
||||
myBranchName = branchName;
|
||||
}
|
||||
|
||||
public void setIsNewBranch(boolean isNewBranch) {
|
||||
myIsNewBranch = isNewBranch;
|
||||
}
|
||||
|
||||
public void setBookmarkName(String bookmark) {
|
||||
myBookmarkName = bookmark;
|
||||
}
|
||||
|
||||
public void execute(final HgCommandResultHandler resultHandler) {
|
||||
final List<String> arguments = new LinkedList<String>();
|
||||
if (!StringUtil.isEmptyOrSpaces(myRevision)) {
|
||||
@@ -73,6 +78,10 @@ public class HgPushCommand {
|
||||
arguments.add(myBranchName);
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmptyOrSpaces(myBookmarkName)) {
|
||||
arguments.add("-B");
|
||||
arguments.add(myBookmarkName);
|
||||
}
|
||||
if (myForce) {
|
||||
arguments.add("-f");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="529" height="307"/>
|
||||
<xy x="3" y="20" width="546" height="397"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -18,13 +18,13 @@
|
||||
<children>
|
||||
<vspacer id="f51de">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="2" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="3b42" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="3b42" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="-1" height="100"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -34,17 +34,9 @@
|
||||
</clientProperties>
|
||||
<border type="etched" title="Options"/>
|
||||
<children>
|
||||
<component id="e40ef" class="javax.swing.JCheckBox" binding="revisionCbx">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Revision:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8b024" class="javax.swing.JTextField" binding="revisionTxt">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -55,45 +47,76 @@
|
||||
</component>
|
||||
<hspacer id="27a66">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="1" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<grid id="3c96d" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="etched" title="Branch Options"/>
|
||||
<children>
|
||||
<component id="1adc4" class="javax.swing.JComboBox" binding="branchComboBox">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="4" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="e6341" class="javax.swing.JCheckBox" binding="branchCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.push.branch"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e76b" class="javax.swing.JCheckBox" binding="newBranchCheckBox">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="false"/>
|
||||
<horizontalAlignment value="0"/>
|
||||
<horizontalTextPosition value="11"/>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.push.asNewBranch"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="131ed" class="javax.swing.JComboBox" binding="myBookmarkComboBox">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="4" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a621e" class="javax.swing.JCheckBox" binding="myBookmarkCheckBox">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.push.bookmark"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="e40ef" class="javax.swing.JCheckBox" binding="revisionCbx">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Revision:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5fcc4" class="javax.swing.JCheckBox" binding="forceCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.push.force"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e6341" class="javax.swing.JCheckBox" binding="branchCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.push.branch"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1adc4" class="javax.swing.JComboBox" binding="branchComboBox">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="e76b" class="javax.swing.JCheckBox" binding="newBranchCheckBox">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="false"/>
|
||||
<text resource-bundle="org/zmlx/hg4idea/HgVcsMessages" key="hg4idea.push.asNewBranch"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="af930">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<nested-form id="9e17d" form-file="org/zmlx/hg4idea/ui/HgRepositorySelectorComponent.form" binding="hgRepositorySelectorComponent">
|
||||
|
||||
@@ -51,6 +51,8 @@ public class HgPushDialog extends DialogWrapper {
|
||||
private JComboBox branchComboBox;
|
||||
private EditorComboBox myRepositoryURL;
|
||||
private JCheckBox newBranchCheckBox;
|
||||
private JComboBox myBookmarkComboBox;
|
||||
private JCheckBox myBookmarkCheckBox;
|
||||
private String myCurrentRepositoryUrl;
|
||||
|
||||
public HgPushDialog(Project project, Collection<HgRepository> repos, @Nullable HgRepository selectedRepo) {
|
||||
@@ -67,6 +69,7 @@ public class HgPushDialog extends DialogWrapper {
|
||||
final UpdatingListener updatingListener = new UpdatingListener();
|
||||
revisionCbx.addChangeListener(updatingListener);
|
||||
branchCheckBox.addChangeListener(updatingListener);
|
||||
myBookmarkCheckBox.addChangeListener(updatingListener);
|
||||
revisionTxt.getDocument().addDocumentListener(updatingListener);
|
||||
|
||||
setTitle(HgVcsMessages.message("hg4idea.push.dialog.title"));
|
||||
@@ -125,6 +128,11 @@ public class HgPushDialog extends DialogWrapper {
|
||||
return branchCheckBox.isSelected() ? (String)branchComboBox.getSelectedItem() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getBookmarkName() {
|
||||
return myBookmarkCheckBox.isSelected() ? (String)myBookmarkComboBox.getSelectedItem() : null;
|
||||
}
|
||||
|
||||
public boolean isForce() {
|
||||
return forceCheckBox.isSelected();
|
||||
}
|
||||
@@ -165,7 +173,9 @@ public class HgPushDialog extends DialogWrapper {
|
||||
|
||||
private void updateComboBoxes(HgRepository repo) {
|
||||
final Collection<String> branches = repo.getOpenedBranches();
|
||||
final Collection<String> bookmarkNames = HgUtil.getNamesWithoutHashes(repo.getBookmarks());
|
||||
branchComboBox.setModel(new DefaultComboBoxModel(branches.toArray()));
|
||||
myBookmarkComboBox.setModel(new DefaultComboBoxModel(bookmarkNames.toArray()));
|
||||
}
|
||||
|
||||
private void updateRepositoryUrlText(String defaultPath) {
|
||||
@@ -180,6 +190,7 @@ public class HgPushDialog extends DialogWrapper {
|
||||
revisionTxt.setEnabled(revisionCbx.isSelected());
|
||||
branchComboBox.setEnabled(branchCheckBox.isSelected());
|
||||
newBranchCheckBox.setEnabled(branchCheckBox.isSelected());
|
||||
myBookmarkComboBox.setEnabled(myBookmarkCheckBox.isSelected());
|
||||
}
|
||||
|
||||
private boolean validateOptions() {
|
||||
|
||||
Reference in New Issue
Block a user