|
|
|
@ -25,6 +25,7 @@ import com.fr.workspace.server.vcs.filesystem.VcsFileSystem;
|
|
|
|
|
import com.fr.workspace.server.vcs.git.config.GcConfig; |
|
|
|
|
|
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import javax.swing.border.EmptyBorder; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.util.List; |
|
|
|
@ -137,20 +138,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<VcsEntity> 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(); |
|
|
|
|