|
|
@ -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.filesystem.VcsFileSystem; |
|
|
|
import com.fr.workspace.server.vcs.git.config.GcConfig; |
|
|
|
import com.fr.workspace.server.vcs.git.config.GcConfig; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.border.EmptyBorder; |
|
|
|
import javax.swing.border.EmptyBorder; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
@ -137,20 +137,18 @@ public class VcsHelper implements JTemplateActionListener { |
|
|
|
String fileName = getEditingFilename(); |
|
|
|
String fileName = getEditingFilename(); |
|
|
|
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); |
|
|
|
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); |
|
|
|
VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); |
|
|
|
VcsEntity entity = operator.getFileVersionByIndex(fileName, 0); |
|
|
|
|
|
|
|
boolean replace = needDeleteVersion(entity); |
|
|
|
int latestFileVersion = 0; |
|
|
|
int latestFileVersion = 0; |
|
|
|
if (entity != null) { |
|
|
|
if (entity != null) { |
|
|
|
latestFileVersion = entity.getVersion(); |
|
|
|
latestFileVersion = entity.getVersion(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { |
|
|
|
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(); |
|
|
|
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); |
|
|
|
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY))); |
|
|
|
List<VcsEntity> updatedList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY)); |
|
|
|
|
|
|
|
SwingUtilities.invokeLater(() -> FileVersionTable.getInstance().updateModel(1, updatedList)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1); |
|
|
|
operator.saveVersion(getCurrentUsername(), fileName, StringUtils.EMPTY, latestFileVersion + 1, replace); |
|
|
|
} |
|
|
|
|
|
|
|
VcsEntity oldEntity = WorkContext.getCurrent().get(VcsOperator.class).getFileVersionByIndexAndUsername(fileName, getCurrentUsername(), 1); |
|
|
|
|
|
|
|
if (needDeleteVersion(oldEntity)) { |
|
|
|
|
|
|
|
operator.deleteVersion(oldEntity.getFilename(), oldEntity.getVersion()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (GcConfig.getInstance().isGcEnable()) { |
|
|
|
if (GcConfig.getInstance().isGcEnable()) { |
|
|
|
operator.gc(); |
|
|
|
operator.gc(); |
|
|
|