public class GitGui
extends java.lang.Object
FileList
which contains the time stamp of all files.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
GitGui.RevisionEntry |
Modifier and Type | Field and Description |
---|---|
(package private) GralUserAction |
actionAdd
Action for show the version table for the given file.
|
(package private) GralUserAction |
actionCleanInfo |
(package private) GralUserAction |
actionCommit
Action for do commi.
|
(package private) GralUserAction |
actionDaylyBranch
Action for check the remote archive.
|
(package private) GralUserAction |
actionDiffCurrWork
Action for diff view of the current file to the workspace.
|
(package private) GralUserAction |
actionDiffVersion
Action for diff view of the current file to the workspace.
|
(package private) GralUserAction |
actionExecCmd |
(package private) GralUserAction |
actionFileBlame
Action for diff view of the current file between revisions.
|
(package private) GralUserAction |
actionFileDiffRev
Action for diff view of the current file between revisions.
|
(package private) GralUserAction |
actionMainBranch
Action for check the remote archive.
|
(package private) GralUserAction |
actionMove
Action for show the version table for the given file.
|
(package private) GralUserAction |
actionOnCloseWindow |
(package private) GralUserAction |
actionOpenCommitText |
(package private) GralUserAction |
actionOutputZip
Action for diff view of the current file to the workspace.
|
(package private) GralUserAction |
actionPull |
(package private) GralUserAction |
actionPush
Action for check the remote archive.
|
(package private) GralUserAction |
actionRefresh
Action for show the version table for the given file.
|
(package private) GralUserAction |
actionRestore
Action for mouse double to start view diff.
|
(package private) GralUserAction |
actionShowExec
Action for open the commit text.
|
(package private) GralUserAction |
actionTableFile
Action for mouse double to start view diff.
|
(package private) GralUserAction |
actionTableFileDiffView
Action for mouse double to start view diff.
|
(package private) GralUserAction |
actionTableFileLog
Action for show the version table for the given file.
|
(package private) GralUserAction |
actionTableFileRenMove |
(package private) GralUserAction |
actionTableLineVersion |
(package private) boolean |
bCmdThreadClose
If set to true, the
cmdThread should be aborted. |
(package private) java.lang.Thread |
cmdThread
This thread executes the git commands concurrently to the GUI.
|
(package private) GitGui.RevisionEntry |
cmpEntry
The current entry and the entry before, to the earlier commit.
|
(package private) GralTableLine_ifc<GitGui.RevisionEntry> |
cmpLine
The current line and the line before, to the earlier commit.
|
(package private) GitGui.RevisionEntry |
currentEntry
The current entry and the entry before, to the earlier commit.
|
(package private) GralTableLine_ifc<GitGui.RevisionEntry> |
currentLine
The current line and the line before, to the earlier commit.
|
(package private) int |
cursorPosInfo |
(package private) java.text.SimpleDateFormat |
dateFmtyyMMdd |
(package private) java.text.SimpleDateFormat |
dateFormat
The presentation of the time stamps.
|
(package private) CmdExecuter.ExecuteAfterFinish |
exec_CommitDone
This code snippet is executed after the 'git diff' command for 2 revisions are executed.
|
(package private) CmdExecuter.ExecuteAfterFinish |
exec_FileListDone
This code snippet is executed after the 'git diff' command for 2 revisions are executed.
|
(package private) CmdExecuter.ExecuteAfterFinish |
exec_fillFileTable4Revision
This code snippet is executed after the 'git diff' command for 2 revisions are executed.
|
(package private) CmdExecuter.ExecuteAfterFinish |
exec_fillRevisionTable
This code snippet is executed after the 'git diff' command for 2 revisions are executed.
|
(package private) CmdExecuter.ExecuteAfterFinish |
exec_ShowStatus
This code snippet is executed after the 'git diff' command for 2 revisions are executed.
|
(package private) CmdExecuter.ExecuteAfterFinish |
execShowCmdOutput |
(package private) CmdExecuter.ExecuteAfterFinish |
execShowCmdOutputDone |
(package private) GitGuiPaths |
exepath
The paths to the executables.
|
(package private) static java.io.File |
filePathRepository
The only one opened git repository. null if nothing is open or more as one is open.
|
(package private) CmdExecuter |
gitCmd |
(package private) StringPartAppend |
gitOut
Destination for output of all command line invocations.
|
protected GralMng |
gralMng |
(package private) java.util.List<java.lang.Appendable> |
listOut
The
CmdExecuter#execute(String[], boolean, String, List, List, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
needs a list of appendable, that is it. |
(package private) java.lang.String |
sFileList |
(package private) java.lang.String |
sGitDir
Stored arguments from
#startLog(String, String, String) . |
(package private) java.lang.String |
sLocalFile
If given the file which's log and diff should be shown.
|
(package private) java.lang.String |
sTypeOfImplementation |
java.lang.String |
sVersion
Version, history and license
2023-01-28 Hartmut
actionCommit Now an existing script "+buildTimestamps.sh" is called instead FileList#list()
because this script contains options which files should be placed in the list. |
(package private) java.lang.String |
sWorkingDir
Stored arguments from
#startLog(String, String, String) . |
(package private) GralButton |
wdgBtnAdd |
(package private) GralButton |
wdgBtnBlame |
(package private) GralButton |
wdgBtnCleanInfo |
(package private) GralButton |
wdgBtnCmd |
(package private) GralButton |
wdgBtnCommit |
(package private) GralButton |
wdgBtnCommitText |
(package private) GralButton |
wdgBtnDaylyBranch |
(package private) GralButton |
wdgBtnDaylyMain |
(package private) GralButton |
wdgBtnDiffCurrFile |
(package private) GralButton |
wdgBtnDiffCurrWork |
(package private) GralButton |
wdgBtnMove |
(package private) GralButton |
wdgBtnPull |
(package private) GralButton |
wdgBtnPush |
(package private) GralButton |
wdgBtnRefresh |
(package private) GralButton |
wdgBtnShowCmd |
(package private) GralTextField |
wdgCmd |
(package private) GralTextBox |
wdgInfo |
(package private) GralTextFieldUser_ifc |
wdgInfoSetSelection |
(package private) GralTable<java.lang.String> |
wdgTableFiles |
(package private) GralTable<GitGui.RevisionEntry> |
wdgTableVersion |
(package private) GralWindow |
window |
(package private) java.io.File |
workingDir |
Constructor and Description |
---|
GitGui(java.io.File startfile,
GitGuiCmd.CmdArgs cmdArgs) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addFileFromSelection() |
(package private) void |
detectGitArchive(java.io.File startfile,
java.lang.String[] files) |
void |
doSomethinginMainthreadTillCloseWindow() |
(package private) void |
execCmd(java.lang.String cmd,
CmdExecuter.ExecuteAfterFinish showCmd) |
(package private) void |
fillFileTable4Revision()
Fills the file table with the gotten output after git diff name-status command.
|
(package private) void |
fillRevisionTable()
Fills the
wdgTableVersion with the gotten output after git log command. |
void |
finalize() |
static java.io.File |
getFilePathRepository(java.io.File startFileSearchRepository)
Returns the opened repository or repoository linking file or searches the next .git or .gitRepository file
in the parent dir.
|
private java.lang.String |
getSelectedInfo() |
static void |
guiRepository(GitGuiPaths exepath,
JZtxtcmdFilepath repoFile)
Searches the git repository and the root of the working tree and opens the window for the git gui.
|
(package private) void |
initializeCmd(GitGuiCmd.CmdArgs cmdArgs) |
static void |
main(java.lang.String[] sCmdArgs)
For stand alone application: Call as doubleclick in windows:
The only one argument is the full path to a .git file directory or .git file or name.gitRepository file.
|
(package private) void |
moveFileListToSelection() |
(package private) void |
openNewFileSelector(java.lang.String sFile,
GitGui.RevisionEntry currRev) |
(package private) java.lang.String[] |
prepArgs(java.lang.String cmd) |
(package private) void |
restoreFile(java.lang.String sFile) |
static java.lang.String |
searchRepository(java.io.File startFile,
java.lang.String[] dst,
java.util.Map<java.lang.String,<any>> dstMap,
java.lang.String nameRepository,
java.lang.String nameBasedir,
java.lang.String nameLocalFile)
Search the base dir and the repository for a given path/to/file.
|
(package private) void |
showLog_startRevisionDiff4FileTable(GralTable.TableLineData line)
Starts the command 'git diff' to fill the
wdgTableFiles for the selected revision. |
static void |
showLog(java.io.File srcFile)
Searches the git repository and the root of the working tree and opens the window for the git gui.
|
(package private) void |
startBlame(java.lang.String sFile,
GitGui.RevisionEntry currRev,
GitGui.RevisionEntry cmpRev)
Gets the file from repository and writes to tmp directory, starts diff tool
|
(package private) void |
startDiffView(java.lang.String sFile,
GitGui.RevisionEntry currRev,
GitGui.RevisionEntry cmpRev)
Gets the file from repository and writes to tmp directory, starts diff tool
|
(package private) void |
startLog() |
public final java.lang.String sVersion
actionCommit
Now an existing script "+buildTimestamps.sh" is called instead FileList#list()
because this script contains options which files should be placed in the list. It is the same script callable by the user.
Hence the problem that the ".filelist" contains unnecessary (stupid) file, is solved.
#execCmd(String, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
using
exec_ShowStatus
is improved. It is now appended, to preserve a error message from some commands one after another.
For example on actionDiffVersion
startDiffView(String, RevisionEntry, RevisionEntry)
.
actionExecCmd
: If starts with !! then show only "done" on success, else show whole output
prepArgs(String)
) is new, gets the sh.exe call with -x -c completely from the -getsh option.
used on all gitCmd
.addCmd(...)
cmdThread
: possible to set a debug breakpoint if contains commands.
#startLog(String)
shows the working dir too.
wdgTableVersion
with fix width, wdgTableFiles
variable width on resizing of the window. Better for view.
#actionFetch
, actionPull
. actionPull
not ready yet.
actionExecCmd
, actionAdd
etc.: shows the cmd output via execShowCmdOutputDone
exec_CommitDone
: shows commit error
moveFileListToSelection()
improved creates one directory level on git working dir.
actionOutputZip
openNewFileSelector(String, RevisionEntry)
not ready yet.
diff --name-status instead diff --name-only
to build the input for the #wdgTableFiles to show different files. The table has an additional left row for the kind of difference
adequate the output of diff --name-status.
- 2018-10-10 Hartmut new
#guiRepository(JZtxtcmdFilepath)
as start operation. It checks whether "name.gitRepository" is given
and copies "name.gitignore" to ".gitignore" and uses "name.filelist" as filelist. It supports more as one component on one working dir.
- 2018-10-10 Hartmut new
getFilePathRepository(File)
. It is invoked in jzTc to get the opened repository by this GUI for add command.
- 2017-05-10 Hartmut bugfix
CmdExecuter#setCharsetForOutput(String)
to UTF-8 because git outputs cmd output in UTF-8
- 2016-12-02 Hartmut chg GitGui some improvements.
- 2016-09-23 Hartmut GitGui: ContextMenu in file table
- 2016-08-18 Hartmut this version is able to use to view the repository versions, the changed files per version, the changed file to the working tree.
It supports view diff with invocation of an external tool. It is the first productive version. But yet with some specific settings yet now.
TODO: read a config. Document it. Show the git command line for any action.
- 2016-08-24 Hartmut created
protected GralMng gralMng
GralUserAction actionShowExec
GralUserAction actionCleanInfo
GralUserAction actionOpenCommitText
CmdExecuter.ExecuteAfterFinish exec_FileListDone
CmdExecuter#execute(String[], boolean, String, List, List, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
and prepares the wdgTableFiles
.CmdExecuter.ExecuteAfterFinish exec_CommitDone
CmdExecuter#execute(String[], boolean, String, List, List, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
and prepares the wdgTableFiles
.GralUserAction actionCommit
GralUserAction actionRefresh
GralUserAction actionTableLineVersion
CmdExecuter.ExecuteAfterFinish exec_fillRevisionTable
CmdExecuter#execute(String[], boolean, String, List, List, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
and prepares the wdgTableFiles
.CmdExecuter.ExecuteAfterFinish exec_fillFileTable4Revision
CmdExecuter#execute(String[], boolean, String, List, List, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
and prepares the wdgTableFiles
.CmdExecuter.ExecuteAfterFinish exec_ShowStatus
CmdExecuter#execute(String[], boolean, String, List, List, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
and prepares the wdgTableFiles
.GralUserAction actionTableFile
GralUserAction actionRestore
GralUserAction actionTableFileDiffView
GralUserAction actionTableFileRenMove
GralUserAction actionDiffVersion
GralUserAction actionDiffCurrWork
GralUserAction actionFileDiffRev
GralUserAction actionFileBlame
GralUserAction actionTableFileLog
GralUserAction actionExecCmd
GralUserAction actionDaylyBranch
GralUserAction actionMainBranch
GralUserAction actionPull
GralUserAction actionPush
GralUserAction actionAdd
GralUserAction actionMove
CmdExecuter.ExecuteAfterFinish execShowCmdOutputDone
CmdExecuter.ExecuteAfterFinish execShowCmdOutput
GralTextFieldUser_ifc wdgInfoSetSelection
GralUserAction actionOutputZip
GitGuiPaths exepath
static java.io.File filePathRepository
java.lang.String sTypeOfImplementation
final GralWindow window
final GralTextField wdgCmd
final GralButton wdgBtnCmd
final GralTable<GitGui.RevisionEntry> wdgTableVersion
final GralTable<java.lang.String> wdgTableFiles
final GralTextBox wdgInfo
final GralButton wdgBtnDiffCurrWork
final GralButton wdgBtnDiffCurrFile
final GralButton wdgBtnPull
final GralButton wdgBtnPush
final GralButton wdgBtnBlame
final GralButton wdgBtnDaylyBranch
final GralButton wdgBtnDaylyMain
final GralButton wdgBtnAdd
final GralButton wdgBtnMove
final GralButton wdgBtnCommitText
final GralButton wdgBtnCommit
final GralButton wdgBtnRefresh
final GralButton wdgBtnCleanInfo
final GralButton wdgBtnShowCmd
boolean bCmdThreadClose
cmdThread
should be aborted.final CmdExecuter gitCmd
final StringPartAppend gitOut
final java.util.List<java.lang.Appendable> listOut
CmdExecuter#execute(String[], boolean, String, List, List, org.vishia.cmd.CmdExecuter.ExecuteAfterFinish)
needs a list of appendable, that is it.final java.lang.String sGitDir
#startLog(String, String, String)
.final java.lang.String sWorkingDir
#startLog(String, String, String)
.final java.io.File workingDir
final java.lang.String sFileList
java.lang.String sLocalFile
#startLog(String)
final java.text.SimpleDateFormat dateFormat
GralTableLine_ifc<GitGui.RevisionEntry> currentLine
GralTableLine_ifc<GitGui.RevisionEntry> cmpLine
GitGui.RevisionEntry currentEntry
GitGui.RevisionEntry cmpEntry
int cursorPosInfo
final java.text.SimpleDateFormat dateFmtyyMMdd
GralUserAction actionOnCloseWindow
java.lang.Thread cmdThread
CmdExecuter.ExecuteAfterFinish
operation, which changed the GUI. This execution is in this thread too, of course,
and inform the graphic as usual in the GRAL concept.public GitGui(java.io.File startfile, GitGuiCmd.CmdArgs cmdArgs)
public static void main(java.lang.String[] sCmdArgs)
sCmdArgs
- void detectGitArchive(java.io.File startfile, java.lang.String[] files) throws java.io.IOException
startfile
- files
- dst
- maybe null, elsewhere new String[2].
files[0] will be filled with the absolute path of the .git directory.
files[1] will be filled with the absolute path to the basic directory for the working tree where .git or .gitRepository were found.
files[2] will be filled with the local file path or null if the .git or .gitRepositiory is the startFile.java.io.IOException
public void finalize()
finalize
in class java.lang.Object
void initializeCmd(GitGuiCmd.CmdArgs cmdArgs)
public void doSomethinginMainthreadTillCloseWindow()
public static java.lang.String searchRepository(java.io.File startFile, java.lang.String[] dst, java.util.Map<java.lang.String,<any>> dstMap, java.lang.String nameRepository, java.lang.String nameBasedir, java.lang.String nameLocalFile)
startFile
- Any file path. Especially a ".git" directory or ".gitRepository*" file. In that case the local file path will be set to null,
because the whole repository is given.
A ".gitRepository*" file contains the path to the extern .git directory.dst
- maybe null, elsewhere new String[2].
dst[0] will be filled with the absolute path of the .git directory.
dst[1] will be filled with the absolute path to the basic directory for the working tree where .git or .gitRepository were found.
dst[2] will be filled with the local file path or null if the .git or .gitRepositiory is the startFile.dstMap
- maybe null, if not null it is a container maybe from JZcmd variables or an empty Map.nameRepository
- if dstMap !=null, the name of the key (variable) for the repository path.nameBasedir
- if dstMap !=null, the name of the key (variable) for the base directory.nameLocalFile
- if dstMap !=null, the name of the key (variable) for the local file.
That variables will be set. nameLocalFile will be set to null if .git or .gitRepository is the startFile.public static java.io.File getFilePathRepository(java.io.File startFileSearchRepository)
dir
- The dir where a file should be handled.public static void guiRepository(GitGuiPaths exepath, JZtxtcmdFilepath repoFile) throws java.lang.NoSuchFieldException
srcFile
- Any file to start searching the root of the working tree and the git repository inside this tree.
If it is a directory and that directory contains either ".git" or ".gitRepository", it is the root of the working tree.
Elsewhere the root will be searched backward to the root of the file system.
It means you can start this routine with any srcFile inside the working tree.
This file will be used as additional argument for example to show the history of that file.java.lang.NoSuchFieldException
public static void showLog(java.io.File srcFile)
srcFile
- Any file to start searching the root of the working tree and the git repository inside this tree.
If it is a directory and that directory contains either ".git" or ".gitRepository", it is the root of the working tree.
Elsewhere the root will be searched backward to the root of the file system.
It means you can start this routine with any srcFile inside the working tree.
This file will be used as additional argument for example to show the history of that file.java.lang.String[] prepArgs(java.lang.String cmd)
void startLog()
sLocalFile
- "*" for all files, else "path/in/loacal/tree/file.ext"void fillRevisionTable()
wdgTableVersion
with the gotten output after git log command. This routine is invoked as #execAfterCmdLog
.void showLog_startRevisionDiff4FileTable(GralTable.TableLineData line)
wdgTableFiles
for the selected revision.line
- void restoreFile(java.lang.String sFile)
void execCmd(java.lang.String cmd, CmdExecuter.ExecuteAfterFinish showCmd)
cmd
- if "git.. " or "+ ... " then call in sh.exeshowCmd
- The routine which evaluates the result.private java.lang.String getSelectedInfo()
void addFileFromSelection()
void moveFileListToSelection()
void startDiffView(java.lang.String sFile, GitGui.RevisionEntry currRev, GitGui.RevisionEntry cmpRev)
sFile
- The local path of the filecurrRev
- maybe null, then compare with working tree, elsewhere a selected revisioncmpRev
- the selected revision to compare.void startBlame(java.lang.String sFile, GitGui.RevisionEntry currRev, GitGui.RevisionEntry cmpRev)
sFile
- The local path of the filecurrRev
- maybe null, then compare with working tree, elsewhere a selected revisioncmpRev
- the selected revision to compare.void openNewFileSelector(java.lang.String sFile, GitGui.RevisionEntry currRev)
void fillFileTable4Revision()
exec_fillFileTable4Revision
.