diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 2f8b1cd206..58d9b0e88d 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -407,11 +407,12 @@ public class TemplateTreePane extends JPanel implements FileOperations { if (node instanceof FileNode) { FileNodeFILE nodeFILE = new FileNodeFILE((FileNode) node); if (nodeFILE.exists()) { - try { - WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), VcsHelper.getInstance().dealWithFilePath(((FileNode) node).getEnvPath())); - } catch (Exception e) { - FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName()); - return false; + if (!VcsHelper.getInstance().isLegacyMode()) { + try { + WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName()); + } } if (TemplateResourceManager.getResource().delete(nodeFILE)) { HistoryTemplateListCache.getInstance().deleteFile(nodeFILE); 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 bd3551256a..49054f651b 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 @@ -27,6 +27,7 @@ import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; +import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import com.fr.workspace.server.vcs.git.config.GcConfig; @@ -181,27 +182,9 @@ public class VcsHelper implements JTemplateActionListener { private String getEditingFilename() { JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); String editingFilePath = jt.getEditingFILE().getPath(); - return dealWithFilePath(editingFilePath); + return VcsFileUtils.dealWithFilePath(editingFilePath); } - /** - * 处理传入的文件名,使其符合Vcs规范 - * - * @param filePath 文件路径 - * @return 处理完的文件 - */ - public String dealWithFilePath(String filePath) { - String vcsCacheDir = VcsFileSystem.getInstance().getVcsCacheRelativePath(); - if (filePath.startsWith(ProjectConstants.REPORTLETS_NAME)) { - filePath = filePath.replaceFirst(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY); - } else if (filePath.startsWith(vcsCacheDir)) { - filePath = filePath.replaceFirst(vcsCacheDir, StringUtils.EMPTY); - } - if (filePath.startsWith(VCS_FILE_SLASH)) { - filePath = filePath.substring(1); - } - return filePath; - } private boolean needDeleteVersion(VcsEntity entity) { VcsConfigManager configManager = DesignerEnvManager.getEnvManager().getVcsConfigManager(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java index 3a949b85d6..baafe56868 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java @@ -18,6 +18,7 @@ import com.fr.file.filetree.FileNode; import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import com.fr.workspace.server.vcs.VcsFileUtils; import com.fr.workspace.server.vcs.VcsOperator; import javax.swing.Icon; @@ -267,7 +268,7 @@ public class VcsNewPane extends RecyclePane { @Override protected List getTableList() { - List entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsHelper.getInstance().dealWithFilePath(filePath)); + List entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsFileUtils.dealWithFilePath(filePath)); List tableEntities = new ArrayList<>(); for (VcsEntity entity : entityList) { tableEntities.add(new VcsTableEntity(entity));