| 1 |
package org.iwakura.larcjb.rollback |
| 2 |
|
| 3 |
import com.intellij.openapi.diagnostic.Logger |
| 4 |
import com.intellij.openapi.project.Project |
| 5 |
import com.intellij.openapi.vcs.FilePath |
| 6 |
import com.intellij.openapi.vcs.VcsException |
| 7 |
import com.intellij.openapi.vcs.changes.Change |
| 8 |
import com.intellij.openapi.vcs.rollback.RollbackEnvironment |
| 9 |
import com.intellij.openapi.vcs.rollback.RollbackProgressListener |
| 10 |
import com.intellij.openapi.vfs.VirtualFile |
| 11 |
import org.iwakura.larcjb.LarcExecutable |
| 12 |
|
| 13 |
/** |
| 14 |
* Handles revert/rollback operations for Larc VCS. |
| 15 |
*/ |
| 16 |
class LarcRollbackEnvironment( |
| 17 |
private val project: Project, |
| 18 |
private val executable: LarcExecutable |
| 19 |
) : RollbackEnvironment { |
| 20 |
|
| 21 |
private val log = Logger.getInstance(LarcRollbackEnvironment::class.java) |
| 22 |
|
| 23 |
override fun getRollbackOperationName(): String = "Revert" |
| 24 |
|
| 25 |
override fun rollbackChanges( |
| 26 |
changes: MutableList<out Change>, |
| 27 |
exceptions: MutableList<VcsException>, |
| 28 |
listener: RollbackProgressListener |
| 29 |
) { |
| 30 |
/* |
| 31 |
* TODO(kroot): implement rollback/revert functionality |
| 32 |
* |
| 33 |
* This requires larc to support a revert command like: |
| 34 |
* larc revert <file> |
| 35 |
* or |
| 36 |
* larc checkout <file> |
| 37 |
* |
| 38 |
* For now, we'll just log that this isn't implemented yet |
| 39 |
*/ |
| 40 |
log.warn("Rollback not yet implemented for Larc VCS") |
| 41 |
exceptions.add(VcsException("Rollback is not yet implemented for Larc VCS")) |
| 42 |
} |
| 43 |
|
| 44 |
override fun rollbackMissingFileDeletion( |
| 45 |
files: List<FilePath>, |
| 46 |
exceptions: MutableList<in VcsException>, |
| 47 |
listener: RollbackProgressListener |
| 48 |
) { |
| 49 |
/* TODO(kroot): restore deleted files from last revision */ |
| 50 |
log.warn("Rollback missing file deletion not implemented") |
| 51 |
} |
| 52 |
|
| 53 |
override fun rollbackModifiedWithoutCheckout( |
| 54 |
files: List<VirtualFile>, |
| 55 |
exceptions: MutableList<in VcsException>, |
| 56 |
listener: RollbackProgressListener |
| 57 |
) { |
| 58 |
/* TODO(kroot): implement modified file rollback */ |
| 59 |
log.warn("Rollback modified without checkout not implemented") |
| 60 |
} |
| 61 |
} |
| 62 |
|