Browse Source

REPORT-101578 【版本管理三期】删除文件夹失败

new-design
Destiny.Lin 1 year ago
parent
commit
157069c230
  1. 11
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 21
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  3. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

11
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);

21
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();

3
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<VcsTableEntity> getTableList() {
List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsHelper.getInstance().dealWithFilePath(filePath));
List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsFileUtils.dealWithFilePath(filePath));
List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entityList) {
tableEntities.add(new VcsTableEntity(entity));

Loading…
Cancel
Save