From f0a1427cf26e30cd1081db3d26430174e2a3cfd2 Mon Sep 17 00:00:00 2001 From: loy Date: Thu, 9 Mar 2023 17:02:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-80651=20=E6=A8=A1=E6=9D=BF=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=E9=87=8D=E6=9E=84=E4=B8=80=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/file/PreferencePane.java | 5 ++++- .../fr/design/mainframe/vcs/common/VcsHelper.java | 14 ++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 46485409bb..84511d1eb4 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -390,7 +390,10 @@ public class PreferencePane extends BasicPane { vcsPane.add(enableVcsPanel); vcsPane.add(intervalPanel); vcsPane.add(saveCommitCheckBox); - vcsPane.add(gcControlPane); + if (WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode()) { + // 老版本时才显示gc选项 + vcsPane.add(gcControlPane); + } } /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index 980ccb5a3a..b334194ee3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -24,7 +24,7 @@ import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import com.fr.workspace.server.vcs.git.config.GcConfig; -import javax.swing.Icon; +import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.Color; import java.util.List; @@ -137,20 +137,18 @@ public class VcsHelper implements JTemplateActionListener { String fileName = getEditingFilename(); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); + boolean replace = needDeleteVersion(entity); int latestFileVersion = 0; if (entity != null) { latestFileVersion = entity.getVersion(); } if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { - operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1); + operator.saveVersionFromCache(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); - FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY))); + List updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); + SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); } else { - operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1); - } - VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndexAndUsername(fileName, getCurrentUsername(), 1); - if (needDeleteVersion(oldEntity)) { - operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); + operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); } if (GcConfig.getInstance().isGcEnable()) { operator.gc();