Package io.github.jbastgen.stemma.app.io
Class ExternalMergeTool
java.lang.Object
io.github.jbastgen.stemma.app.io.ExternalMergeTool
Starts an external merge tool for a conflicting file: the three versions are written to files in the
configuration folder (never to a system temp folder), the command line of the settings is filled in and run
without a shell, and the merged result is expected in the working-tree file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe files a tool is given. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanUp(ExternalMergeTool.Files4 files) Deletes the folder made byprepare(java.nio.file.Path, java.nio.file.Path, byte[], byte[], byte[]).command(String template, ExternalMergeTool.Files4 files) The command to run: the template's words with$BASE,$LOCAL,$REMOTE,$MERGEDreplaced.static StringThe program of a command, for messages (the arguments may be file names).static ExternalMergeTool.Files4Writes the three versions into a fresh folder belowtempRoot; the merged file is the working-tree file.static intRuns the tool and waits for it.Splits a command line into words: spaces separate, single or double quotes keep words together, a backslash escapes inside double quotes and outside quotes only before a quote or space (so Windows paths survive).
-
Method Details
-
tokenize
Splits a command line into words: spaces separate, single or double quotes keep words together, a backslash escapes inside double quotes and outside quotes only before a quote or space (so Windows paths survive). -
command
The command to run: the template's words with$BASE,$LOCAL,$REMOTE,$MERGEDreplaced. -
prepare
public static ExternalMergeTool.Files4 prepare(Path tempRoot, Path workTreeFile, byte[] base, byte[] ours, byte[] theirs) throws IOException Writes the three versions into a fresh folder belowtempRoot; the merged file is the working-tree file.- Throws:
IOException
-
cleanUp
Deletes the folder made byprepare(java.nio.file.Path, java.nio.file.Path, byte[], byte[], byte[]). -
run
Runs the tool and waits for it. @return its exit code- Throws:
IOExceptionInterruptedException
-
describe
The program of a command, for messages (the arguments may be file names).
-