Compare commits

...

2 Commits

Author SHA1 Message Date
fa9db19bdc Add sort File list by importance 2025-08-24 20:44:58 +02:00
f8fc232de6 improvement AddRemoteRepo 2025-08-24 18:32:37 +02:00

643
main.pb
View File

@@ -12,190 +12,190 @@
#EnableDebug=#True #EnableDebug=#True
Global GitIgnoreHelpHTML.s = ~"<!DOCTYPE html>" + #LF$ + Global GitIgnoreHelpHTML.s = ~"<!DOCTYPE html>" + #LF$ +
~"<html lang=\"fr\">" + #LF$ + ~"<html lang=\"fr\">" + #LF$ +
~"<head>" + #LF$ + ~"<head>" + #LF$ +
~" <meta charset=\"UTF-8\">" + #LF$ + ~" <meta charset=\"UTF-8\">" + #LF$ +
~" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" + #LF$ + ~" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" + #LF$ +
~" <title>Aide .gitignore</title>" + #LF$ + ~" <title>Aide .gitignore</title>" + #LF$ +
~" <style>" + #LF$ + ~" <style>" + #LF$ +
~" body {" + #LF$ + ~" body {" + #LF$ +
~" font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;" + #LF$ + ~" font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;" + #LF$ +
~" margin: 0;" + #LF$ + ~" margin: 0;" + #LF$ +
~" padding: 20px;" + #LF$ + ~" padding: 20px;" + #LF$ +
~" background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);" + #LF$ + ~" background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);" + #LF$ +
~" color: #333;" + #LF$ + ~" color: #333;" + #LF$ +
~" line-height: 1.6;" + #LF$ + ~" line-height: 1.6;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" .container {" + #LF$ + ~" .container {" + #LF$ +
~" max-width: 900px;" + #LF$ + ~" max-width: 900px;" + #LF$ +
~" margin: 0 auto;" + #LF$ + ~" margin: 0 auto;" + #LF$ +
~" background: white;" + #LF$ + ~" background: white;" + #LF$ +
~" border-radius: 15px;" + #LF$ + ~" border-radius: 15px;" + #LF$ +
~" padding: 30px;" + #LF$ + ~" padding: 30px;" + #LF$ +
~" box-shadow: 0 20px 40px rgba(0,0,0,0.1);" + #LF$ + ~" box-shadow: 0 20px 40px rgba(0,0,0,0.1);" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" h1 {" + #LF$ + ~" h1 {" + #LF$ +
~" color: #2c3e50;" + #LF$ + ~" color: #2c3e50;" + #LF$ +
~" text-align: center;" + #LF$ + ~" text-align: center;" + #LF$ +
~" margin-bottom: 30px;" + #LF$ + ~" margin-bottom: 30px;" + #LF$ +
~" font-size: 2.5em;" + #LF$ + ~" font-size: 2.5em;" + #LF$ +
~" background: linear-gradient(45deg, #667eea, #764ba2);" + #LF$ + ~" background: linear-gradient(45deg, #667eea, #764ba2);" + #LF$ +
~" -webkit-background-clip: text;" + #LF$ + ~" -webkit-background-clip: text;" + #LF$ +
~" -webkit-text-fill-color: transparent;" + #LF$ + ~" -webkit-text-fill-color: transparent;" + #LF$ +
~" background-clip: text;" + #LF$ + ~" background-clip: text;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" h2 {" + #LF$ + ~" h2 {" + #LF$ +
~" color: #34495e;" + #LF$ + ~" color: #34495e;" + #LF$ +
~" border-left: 4px solid #667eea;" + #LF$ + ~" border-left: 4px solid #667eea;" + #LF$ +
~" padding-left: 15px;" + #LF$ + ~" padding-left: 15px;" + #LF$ +
~" margin-top: 30px;" + #LF$ + ~" margin-top: 30px;" + #LF$ +
~" font-size: 1.4em;" + #LF$ + ~" font-size: 1.4em;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" .syntax-box {" + #LF$ + ~" .syntax-box {" + #LF$ +
~" background: #f8f9fa;" + #LF$ + ~" background: #f8f9fa;" + #LF$ +
~" border: 1px solid #e9ecef;" + #LF$ + ~" border: 1px solid #e9ecef;" + #LF$ +
~" border-radius: 8px;" + #LF$ + ~" border-radius: 8px;" + #LF$ +
~" padding: 15px;" + #LF$ + ~" padding: 15px;" + #LF$ +
~" margin: 15px 0;" + #LF$ + ~" margin: 15px 0;" + #LF$ +
~" font-family: 'Consolas', 'Monaco', monospace;" + #LF$ + ~" font-family: 'Consolas', 'Monaco', monospace;" + #LF$ +
~" font-size: 0.9em;" + #LF$ + ~" font-size: 0.9em;" + #LF$ +
~" overflow-x: auto;" + #LF$ + ~" overflow-x: auto;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" .example {" + #LF$ + ~" .example {" + #LF$ +
~" background: linear-gradient(135deg, #667eea20, #764ba220);" + #LF$ + ~" background: linear-gradient(135deg, #667eea20, #764ba220);" + #LF$ +
~" border-left: 4px solid #667eea;" + #LF$ + ~" border-left: 4px solid #667eea;" + #LF$ +
~" padding: 15px;" + #LF$ + ~" padding: 15px;" + #LF$ +
~" margin: 15px 0;" + #LF$ + ~" margin: 15px 0;" + #LF$ +
~" border-radius: 0 8px 8px 0;" + #LF$ + ~" border-radius: 0 8px 8px 0;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" .tip {" + #LF$ + ~" .tip {" + #LF$ +
~" background: #e8f5e8;" + #LF$ + ~" background: #e8f5e8;" + #LF$ +
~" border: 1px solid #4caf50;" + #LF$ + ~" border: 1px solid #4caf50;" + #LF$ +
~" border-radius: 8px;" + #LF$ + ~" border-radius: 8px;" + #LF$ +
~" padding: 15px;" + #LF$ + ~" padding: 15px;" + #LF$ +
~" margin: 15px 0;" + #LF$ + ~" margin: 15px 0;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" .warning {" + #LF$ + ~" .warning {" + #LF$ +
~" background: #fff3e0;" + #LF$ + ~" background: #fff3e0;" + #LF$ +
~" border: 1px solid #ff9800;" + #LF$ + ~" border: 1px solid #ff9800;" + #LF$ +
~" border-radius: 8px;" + #LF$ + ~" border-radius: 8px;" + #LF$ +
~" padding: 15px;" + #LF$ + ~" padding: 15px;" + #LF$ +
~" margin: 15px 0;" + #LF$ + ~" margin: 15px 0;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" code {" + #LF$ + ~" code {" + #LF$ +
~" background: #f1f3f4;" + #LF$ + ~" background: #f1f3f4;" + #LF$ +
~" padding: 2px 6px;" + #LF$ + ~" padding: 2px 6px;" + #LF$ +
~" border-radius: 4px;" + #LF$ + ~" border-radius: 4px;" + #LF$ +
~" font-family: 'Consolas', 'Monaco', monospace;" + #LF$ + ~" font-family: 'Consolas', 'Monaco', monospace;" + #LF$ +
~" color: #d73a49;" + #LF$ + ~" color: #d73a49;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" ul {" + #LF$ + ~" ul {" + #LF$ +
~" padding-left: 20px;" + #LF$ + ~" padding-left: 20px;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" li {" + #LF$ + ~" li {" + #LF$ +
~" margin: 8px 0;" + #LF$ + ~" margin: 8px 0;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" .pattern {" + #LF$ + ~" .pattern {" + #LF$ +
~" display: inline-block;" + #LF$ + ~" display: inline-block;" + #LF$ +
~" background: #667eea;" + #LF$ + ~" background: #667eea;" + #LF$ +
~" color: white;" + #LF$ + ~" color: white;" + #LF$ +
~" padding: 3px 8px;" + #LF$ + ~" padding: 3px 8px;" + #LF$ +
~" border-radius: 4px;" + #LF$ + ~" border-radius: 4px;" + #LF$ +
~" font-family: 'Consolas', 'Monaco', monospace;" + #LF$ + ~" font-family: 'Consolas', 'Monaco', monospace;" + #LF$ +
~" font-size: 0.9em;" + #LF$ + ~" font-size: 0.9em;" + #LF$ +
~" margin: 2px;" + #LF$ + ~" margin: 2px;" + #LF$ +
~" }" + #LF$ + ~" }" + #LF$ +
~" </style>" + #LF$ + ~" </style>" + #LF$ +
~"</head>" + #LF$ + ~"</head>" + #LF$ +
~"<body>" + #LF$ + ~"<body>" + #LF$ +
~" <div class=\"container\">" + #LF$ + ~" <div class=\"container\">" + #LF$ +
~" <h1>📁 Guide .gitignore</h1>" + #LF$ + ~" <h1>📁 Guide .gitignore</h1>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <p>Le fichier <code>.gitignore</code> permet de spécifier quels fichiers et dossiers Git doit ignorer lors du versioning.</p>" + #LF$ + ~" <p>Le fichier <code>.gitignore</code> permet de spécifier quels fichiers et dossiers Git doit ignorer lors du versioning.</p>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <h2>🎯 Syntaxe de base</h2>" + #LF$ + ~" <h2>🎯 Syntaxe de base</h2>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <div class=\"example\">" + #LF$ + ~" <div class=\"example\">" + #LF$ +
~" <strong>Ignorer des fichiers spécifiques :</strong>" + #LF$ + ~" <strong>Ignorer des fichiers spécifiques :</strong>" + #LF$ +
~" <div class=\"syntax-box\">" + #LF$ + ~" <div class=\"syntax-box\">" + #LF$ +
~"config.txt # Ignore le fichier config.txt<br>" + #LF$ + ~"config.txt # Ignore le fichier config.txt<br>" + #LF$ +
~"*.log # Ignore tous les fichiers .log<br>" + #LF$ + ~"*.log # Ignore tous les fichiers .log<br>" + #LF$ +
~"temp/ # Ignore le dossier temp et tout son contenu" + #LF$ + ~"temp/ # Ignore le dossier temp et tout son contenu" + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <h2>🔧 Patterns et wildcards</h2>" + #LF$ + ~" <h2>🔧 Patterns et wildcards</h2>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <ul>" + #LF$ + ~" <ul>" + #LF$ +
~" <li><span class=\"pattern\">*</span> : correspond à n'importe quelle chaîne (sauf <code>/</code>)</li>" + #LF$ + ~" <li><span class=\"pattern\">*</span> : correspond à n'importe quelle chaîne (sauf <code>/</code>)</li>" + #LF$ +
~" <li><span class=\"pattern\">**</span> : correspond à n'importe quel nombre de répertoires</li>" + #LF$ + ~" <li><span class=\"pattern\">**</span> : correspond à n'importe quel nombre de répertoires</li>" + #LF$ +
~" <li><span class=\"pattern\">?</span> : correspond à un seul caractère</li>" + #LF$ + ~" <li><span class=\"pattern\">?</span> : correspond à un seul caractère</li>" + #LF$ +
~" <li><span class=\"pattern\">[abc]</span> : correspond à a, b ou c</li>" + #LF$ + ~" <li><span class=\"pattern\">[abc]</span> : correspond à a, b ou c</li>" + #LF$ +
~" </ul>" + #LF$ + ~" </ul>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <h2>🚫 Négation avec !</h2>" + #LF$ + ~" <h2>🚫 Négation avec !</h2>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <div class=\"syntax-box\">" + #LF$ + ~" <div class=\"syntax-box\">" + #LF$ +
~"*.log<br>" + #LF$ + ~"*.log<br>" + #LF$ +
~"!important.log # Inclut ce fichier malgré la règle précédente" + #LF$ + ~"!important.log # Inclut ce fichier malgré la règle précédente" + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <h2>📍 Chemins</h2>" + #LF$ + ~" <h2>📍 Chemins</h2>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <div class=\"example\">" + #LF$ + ~" <div class=\"example\">" + #LF$ +
~" <div class=\"syntax-box\">" + #LF$ + ~" <div class=\"syntax-box\">" + #LF$ +
~"/build # Ignore build à la racine uniquement<br>" + #LF$ + ~"/build # Ignore build à la racine uniquement<br>" + #LF$ +
~"build/ # Ignore tous les dossiers build<br>" + #LF$ + ~"build/ # Ignore tous les dossiers build<br>" + #LF$ +
~"docs/**/*.pdf # Ignore tous les PDF dans docs et ses sous-dossiers" + #LF$ + ~"docs/**/*.pdf # Ignore tous les PDF dans docs et ses sous-dossiers" + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <h2>💡 Exemples courants</h2>" + #LF$ + ~" <h2>💡 Exemples courants</h2>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <div class=\"syntax-box\">" + #LF$ + ~" <div class=\"syntax-box\">" + #LF$ +
~"# Fichiers de build<br>" + #LF$ + ~"# Fichiers de build<br>" + #LF$ +
~"dist/<br>" + #LF$ + ~"dist/<br>" + #LF$ +
~"build/<br>" + #LF$ + ~"build/<br>" + #LF$ +
~"<br>" + #LF$ + ~"<br>" + #LF$ +
~"# Dépendances<br>" + #LF$ + ~"# Dépendances<br>" + #LF$ +
~"node_modules/<br>" + #LF$ + ~"node_modules/<br>" + #LF$ +
~"vendor/<br>" + #LF$ + ~"vendor/<br>" + #LF$ +
~"<br>" + #LF$ + ~"<br>" + #LF$ +
~"# Configuration locale<br>" + #LF$ + ~"# Configuration locale<br>" + #LF$ +
~".env<br>" + #LF$ + ~".env<br>" + #LF$ +
~"config.local.json<br>" + #LF$ + ~"config.local.json<br>" + #LF$ +
~"<br>" + #LF$ + ~"<br>" + #LF$ +
~"# Logs et caches<br>" + #LF$ + ~"# Logs et caches<br>" + #LF$ +
~"*.log<br>" + #LF$ + ~"*.log<br>" + #LF$ +
~".cache/<br>" + #LF$ + ~".cache/<br>" + #LF$ +
~"<br>" + #LF$ + ~"<br>" + #LF$ +
~"# Fichiers d'IDE<br>" + #LF$ + ~"# Fichiers d'IDE<br>" + #LF$ +
~".vscode/<br>" + #LF$ + ~".vscode/<br>" + #LF$ +
~".idea/<br>" + #LF$ + ~".idea/<br>" + #LF$ +
~"<br>" + #LF$ + ~"<br>" + #LF$ +
~"# Fichiers système<br>" + #LF$ + ~"# Fichiers système<br>" + #LF$ +
~".DS_Store<br>" + #LF$ + ~".DS_Store<br>" + #LF$ +
~"Thumbs.db" + #LF$ + ~"Thumbs.db" + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <div class=\"tip\">" + #LF$ + ~" <div class=\"tip\">" + #LF$ +
~" <strong>💡 Conseil :</strong> Utilisez des commentaires avec <code>#</code> pour documenter vos règles." + #LF$ + ~" <strong>💡 Conseil :</strong> Utilisez des commentaires avec <code>#</code> pour documenter vos règles." + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <div class=\"warning\">" + #LF$ + ~" <div class=\"warning\">" + #LF$ +
~" <strong>⚠️ Important :</strong> Le .gitignore ne s'applique qu'aux fichiers non-trackés. Pour ignorer des fichiers déjà versionnés, utilisez <code>git rm --cached &lt;fichier&gt;</code>." + #LF$ + ~" <strong>⚠️ Important :</strong> Le .gitignore ne s'applique qu'aux fichiers non-trackés. Pour ignorer des fichiers déjà versionnés, utilisez <code>git rm --cached &lt;fichier&gt;</code>." + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <h2>🔍 Tester vos règles</h2>" + #LF$ + ~" <h2>🔍 Tester vos règles</h2>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" <div class=\"syntax-box\">" + #LF$ + ~" <div class=\"syntax-box\">" + #LF$ +
~"git check-ignore -v &lt;fichier&gt; # Vérifie si un fichier est ignoré<br>" + #LF$ + ~"git check-ignore -v &lt;fichier&gt; # Vérifie si un fichier est ignoré<br>" + #LF$ +
~"git status --ignored # Affiche les fichiers ignorés" + #LF$ + ~"git status --ignored # Affiche les fichiers ignorés" + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~" " + #LF$ + ~" " + #LF$ +
~" </div>" + #LF$ + ~" </div>" + #LF$ +
~"</body>" + #LF$ + ~"</body>" + #LF$ +
~"</html>" ~"</html>"
; ============================================================================= ; =============================================================================
@@ -401,6 +401,7 @@ Structure listFilesGit
statusDescription.s statusDescription.s
indexStatus.s indexStatus.s
workingTreeStatus.s workingTreeStatus.s
importance.i
EndStructure EndStructure
Structure GitStatus Structure GitStatus
@@ -451,6 +452,8 @@ UseModule Translate
;-FUNCTION DECLARATIONS / DÉCLARATIONS DE FONCTIONS ;-FUNCTION DECLARATIONS / DÉCLARATIONS DE FONCTIONS
; ============================================================================= ; =============================================================================
Declare RefreshFileList(null.i) Declare RefreshFileList(null.i)
Declare.i StatusImportance(status.s)
Procedure.i RunExe(*call.RunProgramCall) Procedure.i RunExe(*call.RunProgramCall)
Protected prg.i, line$, lineError$, out$, err$ Protected prg.i, line$, lineError$, out$, err$
@@ -507,13 +510,56 @@ EndProcedure
; ---- Helpers --------------------------------------------------------------- ; ---- Helpers ---------------------------------------------------------------
; --- Importance par statut Gitpour le trie de
Procedure.i StatusImportance(status.s)
Protected x.s = Left(status, 1)
Protected y.s = Mid(status, 2, 1)
Protected score.i = 0
; Conflits d'abord
Select status
Case "DD","AU","UD","UA","DU","AA","UU"
ProcedureReturn 1000
EndSelect
If x = "U" Or y = "U" : ProcedureReturn 1000 : EndIf
; Cas simples
If status = "??" : ProcedureReturn 300 : EndIf ; Non suivis
If status = "!!" : ProcedureReturn 50 : EndIf ; Ignorés
If status = " " : ProcedureReturn 0 : EndIf ; Propres
; Index > Worktree
If x <> " " : score + 700 : EndIf
If y <> " " And y <> "?" And y <> "!" : score + 600 : EndIf
; Raffinement (X puis Y)
Select x
Case "D" : score + 80
Case "R" : score + 70
Case "A" : score + 60
Case "M" : score + 50
Case "C" : score + 40
Case "T" : score + 30
EndSelect
Select y
Case "D" : score + 40
Case "R" : score + 35
Case "A" : score + 30
Case "M" : score + 25
Case "C" : score + 20
Case "T" : score + 15
EndSelect
ProcedureReturn score
EndProcedure
Procedure.s _SupTrim(text.s) Procedure.s _SupTrim(text.s)
If text = "" : ProcedureReturn "" : EndIf If text = "" : ProcedureReturn "" : EndIf
Protected i.i = 1 Protected i.i = 1
Protected j.i = Len(text) Protected j.i = Len(text)
Protected c.l Protected c.l
; Trim gauche : avancer tant que <= 32 ; Trim gauche : avancer tant que <= 32
While i <= j While i <= j
c = Asc(Mid(text, i, 1)) c = Asc(Mid(text, i, 1))
@@ -523,7 +569,7 @@ Procedure.s _SupTrim(text.s)
Break Break
EndIf EndIf
Wend Wend
; Trim droite : reculer tant que <= 32 ; Trim droite : reculer tant que <= 32
While j >= i While j >= i
c = Asc(Mid(text, j, 1)) c = Asc(Mid(text, j, 1))
@@ -533,7 +579,7 @@ Procedure.s _SupTrim(text.s)
Break Break
EndIf EndIf
Wend Wend
If j < i If j < i
ProcedureReturn "" ProcedureReturn ""
Else Else
@@ -595,11 +641,11 @@ EndProcedure
Procedure _ScanAndFillAllFiles(dir$, root$) Procedure _ScanAndFillAllFiles(dir$, root$)
Protected did.i = ExamineDirectory(#PB_Any, dir$, "*") Protected did.i = ExamineDirectory(#PB_Any, dir$, "*")
If did = 0 : ProcedureReturn : EndIf If did = 0 : ProcedureReturn : EndIf
While NextDirectoryEntry(did) While NextDirectoryEntry(did)
Protected name$ = DirectoryEntryName(did) Protected name$ = DirectoryEntryName(did)
If name$ = "." Or name$ = ".." : Continue : EndIf If name$ = "." Or name$ = ".." : Continue : EndIf
Protected full$ = dir$ + name$ Protected full$ = dir$ + name$
Debug full$ Debug full$
If DirectoryEntryType(did) = #PB_DirectoryEntry_Directory If DirectoryEntryType(did) = #PB_DirectoryEntry_Directory
@@ -612,7 +658,7 @@ Procedure _ScanAndFillAllFiles(dir$, root$)
; Fichier : on ajoute une ligne dans main\listFilesGit() ; Fichier : on ajoute une ligne dans main\listFilesGit()
Protected rel$ = Mid(full$, Len(root$) + 1) Protected rel$ = Mid(full$, Len(root$) + 1)
rel$ = ReplaceString(rel$, "\", "/") ; chemins normalisés rel$ = ReplaceString(rel$, "\", "/") ; chemins normalisés
AddElement(main\listFilesGit()) AddElement(main\listFilesGit())
main\listFilesGit()\name = rel$ main\listFilesGit()\name = rel$
main\listFilesGit()\status = " " ; 2 espaces = clean main\listFilesGit()\status = " " ; 2 espaces = clean
@@ -621,22 +667,22 @@ Procedure _ScanAndFillAllFiles(dir$, root$)
main\listFilesGit()\statusDescription = "Unmodified" main\listFilesGit()\statusDescription = "Unmodified"
EndIf EndIf
Wend Wend
FinishDirectory(did) FinishDirectory(did)
EndProcedure EndProcedure
; --- API publique : appelle ceci pour remplir la liste ; --- API publique : appelle ceci pour remplir la liste
Procedure.i FillAllFilesRecursively() Procedure.i FillAllFilesRecursively()
root$ = GetCurrentDirectory() root$ = GetCurrentDirectory()
; Normalise avec un séparateur de fin ; Normalise avec un séparateur de fin
If Right(root$, 1) <> "\" And Right(root$, 1) <> "/" : root$ + "/" : EndIf If Right(root$, 1) <> "\" And Right(root$, 1) <> "/" : root$ + "/" : EndIf
; On n'efface pas ici pour laisser le choix à l'appelant ; On n'efface pas ici pour laisser le choix à l'appelant
_ScanAndFillAllFiles(root$, root$) _ScanAndFillAllFiles(root$, root$)
ProcedureReturn ListSize(main\listFilesGit()) ProcedureReturn ListSize(main\listFilesGit())
EndProcedure EndProcedure
@@ -842,35 +888,35 @@ EndProcedure
Procedure GetGitStatus() Procedure GetGitStatus()
; Ne PAS vider la liste ici : on veut pouvoir mettre à jour des entrées existantes ; Ne PAS vider la liste ici : on veut pouvoir mettre à jour des entrées existantes
; ClearList(main\listFilesGit()) ; <-- laissé intentionnellement commenté ; ClearList(main\listFilesGit()) ; <-- laissé intentionnellement commenté
; Configuration pour git status --porcelain --ignored ; Configuration pour git status --porcelain --ignored
main\Gitcall\args = "status --porcelain --ignored" main\Gitcall\args = "status --porcelain --ignored"
code = RunExe(@main\Gitcall) code = RunExe(@main\Gitcall)
If code = 0 If code = 0
; Parser la sortie ligne par ligne ; Parser la sortie ligne par ligne
output$ = main\Gitcall\output output$ = main\Gitcall\output
; Diviser en lignes ; Diviser en lignes
Dim lines.s(0) Dim lines.s(0)
lineCount = 0 lineCount = 0
currentPos = 1 currentPos = 1
; Compter les lignes ; Compter les lignes
For i = 1 To Len(output$) For i = 1 To Len(output$)
If Mid(output$, i, 1) = #LF$ Or Mid(output$, i, 1) = #CR$ If Mid(output$, i, 1) = #LF$ Or Mid(output$, i, 1) = #CR$
lineCount + 1 lineCount + 1
EndIf EndIf
Next Next
; Redimensionner le tableau ; Redimensionner le tableau
If lineCount > 0 If lineCount > 0
ReDim lines.s(lineCount) ReDim lines.s(lineCount)
; Remplir le tableau avec les lignes ; Remplir le tableau avec les lignes
lineIndex = 0 lineIndex = 0
startPos = 1 startPos = 1
For i = 1 To Len(output$) For i = 1 To Len(output$)
If Mid(output$, i, 1) = #LF$ Or Mid(output$, i, 1) = #CR$ If Mid(output$, i, 1) = #LF$ Or Mid(output$, i, 1) = #CR$
If i > startPos If i > startPos
@@ -885,13 +931,13 @@ Procedure GetGitStatus()
EndIf EndIf
EndIf EndIf
Next Next
; Traiter la dernière ligne si elle n'a pas de retour à la ligne ; Traiter la dernière ligne si elle n'a pas de retour à la ligne
If startPos <= Len(output$) If startPos <= Len(output$)
lines(lineIndex) = Mid(output$, startPos) lines(lineIndex) = Mid(output$, startPos)
EndIf EndIf
EndIf EndIf
; Parser chaque ligne ; Parser chaque ligne
For i = 0 To ArraySize(lines()) For i = 0 To ArraySize(lines())
line$ = lines(i) line$ = lines(i)
@@ -904,7 +950,7 @@ Procedure GetGitStatus()
worktree$ = Mid(line$, 2, 1) worktree$ = Mid(line$, 2, 1)
name$ = Mid(line$, 4) ; chemin tel que renvoyé par Git name$ = Mid(line$, 4) ; chemin tel que renvoyé par Git
name$ = ReplaceString(name$, "\", "/") ; normalisation (par sécurité) name$ = ReplaceString(name$, "\", "/") ; normalisation (par sécurité)
; ----- MODIF: chercher si l'entrée existe déjà ----- ; ----- MODIF: chercher si l'entrée existe déjà -----
found.b = #False found.b = #False
ForEach main\listFilesGit() ForEach main\listFilesGit()
@@ -918,7 +964,7 @@ Procedure GetGitStatus()
Break Break
EndIf EndIf
Next Next
; Si non trouvée, on l'ajoute ; Si non trouvée, on l'ajoute
If Not found If Not found
AddElement(main\listFilesGit()) AddElement(main\listFilesGit())
@@ -932,10 +978,10 @@ Procedure GetGitStatus()
EndIf EndIf
EndIf EndIf
Next Next
Debug "Récupération des status Git réussie. " + Str(ListSize(main\listFilesGit())) + " fichiers (maj/ajout)." Debug "Récupération des status Git réussie. " + Str(ListSize(main\listFilesGit())) + " fichiers (maj/ajout)."
ProcedureReturn #True ProcedureReturn #True
Else Else
Debug "Erreur Git ("+Str(code)+") "+main\GitCall\errors Debug "Erreur Git ("+Str(code)+") "+main\GitCall\errors
ProcedureReturn #False ProcedureReturn #False
@@ -1261,23 +1307,30 @@ EndProcedure
Procedure AddRemoteRepo(Url.s,name.s="origin") Procedure AddRemoteRepo(Url.s,name.s="origin")
Url=_SupTrim(Url) Url=_SupTrim(Url)
name=_SupTrim(name) name=_SupTrim(name)
Debug "Url="+Url Protected add.b=#False
Debug "name="+name
;Check if this remote already exists ;Check if this remote already exists
main\Gitcall\args = "remote get-url "+name main\Gitcall\args = "remote get-url "+name
If RunExe(@main\Gitcall) = 0 If RunExe(@main\Gitcall) = 0
;if yes we remove it ;if yes we remove it
main\Gitcall\args = "remote remove "+name If Url<>_SupTrim(main\Gitcall\output)
RunExe(@main\Gitcall) main\Gitcall\args = "remote remove "+name
RunExe(@main\Gitcall)
add=#True
EndIf
Else
add=#True
EndIf EndIf
; We add a new remote ; We add a new remote
main\Gitcall\args = "remote add "+name+" "+Url If add=#True
If RunExe(@main\Gitcall) = 0 main\Gitcall\args = "remote add "+name+" "+Url
MessageRequester("Git Remote", "OK:" + #LF$ + main\Gitcall\output, #PB_MessageRequester_Info) If RunExe(@main\Gitcall) = 0
;MessageRequester("Git Remote", "OK:" + #LF$ + main\Gitcall\output, #PB_MessageRequester_Info)
ProcedureReturn #True
Else
MessageRequester("Git config", "Échec: " + #LF$ + main\Gitcall\errors, #PB_MessageRequester_Error)
ProcedureReturn #False
EndIf
ProcedureReturn #True ProcedureReturn #True
Else
MessageRequester("Git config", "Échec: " + #LF$ + main\Gitcall\errors, #PB_MessageRequester_Error)
ProcedureReturn #False
EndIf EndIf
EndProcedure EndProcedure
@@ -1351,7 +1404,7 @@ Procedure.s GetParentPath(path.s)
; Supprimer le séparateur final si présent ; Supprimer le séparateur final si présent
If Right(Path, 1) = "\" Or Right(Path, 1) = "/" If Right(Path, 1) = "\" Or Right(Path, 1) = "/"
Path = Left(Path, Len(Path) - 1) Path = Left(Path, Len(Path) - 1)
EndIf EndIf
; Utiliser GetPathPart() qui retourne le chemin sans le fichier/dossier final ; Utiliser GetPathPart() qui retourne le chemin sans le fichier/dossier final
@@ -1378,13 +1431,13 @@ Procedure DoClone()
; Demander à l'utilisateur où cloner ; Demander à l'utilisateur où cloner
choice = MessageRequester("Git Clone - Destination", choice = MessageRequester("Git Clone - Destination",
"Où voulez-vous cloner le dépôt ?" + #LF$ + #LF$ + "Où voulez-vous cloner le dépôt ?" + #LF$ + #LF$ +
"OUI: Créer un répertoire '" + repoName + "' dans le répertoire courant" + #LF$ + "OUI: Créer un répertoire '" + repoName + "' dans le répertoire courant" + #LF$ +
" → " + currentDir + repoName + "/" + #LF$ + #LF$ + " → " + currentDir + repoName + "/" + #LF$ + #LF$ +
"NON: Cloner directement dans le répertoire courant" + #LF$ + "NON: Cloner directement dans le répertoire courant" + #LF$ +
" → " + currentDir + #LF$ + #LF$ + " → " + currentDir + #LF$ + #LF$ +
"ANNULER: Annuler l'opération", "ANNULER: Annuler l'opération",
#PB_MessageRequester_YesNoCancel) #PB_MessageRequester_YesNoCancel)
Select choice Select choice
Case #PB_MessageRequester_Yes Case #PB_MessageRequester_Yes
@@ -1408,12 +1461,12 @@ Procedure DoClone()
If RunExe(@main\Gitcall) = 0 If RunExe(@main\Gitcall) = 0
If targetFolder = "." If targetFolder = "."
MessageRequester("Git Clone", "Succès:" + #LF$ + MessageRequester("Git Clone", "Succès:" + #LF$ +
"Dépôt cloné dans le répertoire courant" + #LF$ + #LF$ + "Dépôt cloné dans le répertoire courant" + #LF$ + #LF$ +
main\Gitcall\output, #PB_MessageRequester_Info) main\Gitcall\output, #PB_MessageRequester_Info)
Else Else
MessageRequester("Git Clone", "Succès:" + #LF$ + MessageRequester("Git Clone", "Succès:" + #LF$ +
"Dépôt cloné dans le répertoire: " + targetFolder + "/" + #LF$ + #LF$ + "Dépôt cloné dans le répertoire: " + targetFolder + "/" + #LF$ + #LF$ +
main\Gitcall\output, #PB_MessageRequester_Info) main\Gitcall\output, #PB_MessageRequester_Info)
EndIf EndIf
AddRemoteRepo(remoteUrl) AddRemoteRepo(remoteUrl)
SetCurrentDirectory(GetGadgetText(#GgtFieldRepo)) SetCurrentDirectory(GetGadgetText(#GgtFieldRepo))
@@ -1811,6 +1864,13 @@ Procedure RefreshFileList(null.i)
GetGitStatus() GetGitStatus()
ForEach main\listFilesGit()
main\listFilesGit()\importance = StatusImportance(main\listFilesGit()\status)
Next
; --- Tri par importance (du plus important au moins important)
SortStructuredList(main\listFilesGit(), #PB_Sort_Descending, OffsetOf(listFilesGit\importance), #PB_Integer)
Protected n.l=n-1 Protected n.l=n-1
ForEach main\listFilesGit() ForEach main\listFilesGit()
n=n+1 n=n+1
@@ -1819,10 +1879,13 @@ Procedure RefreshFileList(null.i)
SetGadgetItemState(#GdtListStatus,n,#PB_ListIcon_Checked) SetGadgetItemState(#GdtListStatus,n,#PB_ListIcon_Checked)
EndIf EndIf
Next Next
DisableGadget(#GdtListStatus,#False) DisableGadget(#GdtListStatus,#False)
DisableGadget(#GdtBtnRefresh,#False) DisableGadget(#GdtBtnRefresh,#False)
GetBranchesList() GetBranchesList()
GetRemoteUrl() GetRemoteUrl()
GetCommitHistory()
EndProcedure EndProcedure
Procedure UpdateHelp(txt.s) Procedure UpdateHelp(txt.s)
@@ -1834,7 +1897,7 @@ Procedure _SetTooltips()
GadgetToolTip(#GdtBtnInit, T("tip.init", "Initialiser un dépôt Git ici")) GadgetToolTip(#GdtBtnInit, T("tip.init", "Initialiser un dépôt Git ici"))
GadgetToolTip(#GdtBtnRefresh, T("tip.refresh", "Rafraîchir la liste des fichiers et létat Git")) GadgetToolTip(#GdtBtnRefresh, T("tip.refresh", "Rafraîchir la liste des fichiers et létat Git"))
GadgetToolTip(#GgtFieldRepo, T("tip.repo.path", "Chemin du dossier projet (workdir)")) GadgetToolTip(#GgtFieldRepo, T("tip.repo.path", "Chemin du dossier projet (workdir)"))
; Remote / Branch ; Remote / Branch
GadgetToolTip(#GdtFieldRemote, T("tip.remote", "URL du remote (ex.: https://... ou git@host:org/repo.git)")) GadgetToolTip(#GdtFieldRemote, T("tip.remote", "URL du remote (ex.: https://... ou git@host:org/repo.git)"))
GadgetToolTip(#GdtSlctBranch, T("tip.branch.select","Choisir la branche active")) GadgetToolTip(#GdtSlctBranch, T("tip.branch.select","Choisir la branche active"))
@@ -1842,26 +1905,26 @@ Procedure _SetTooltips()
GadgetToolTip(#GdtBtnClone, T("tip.clone", "Cloner depuis lURL remote")) GadgetToolTip(#GdtBtnClone, T("tip.clone", "Cloner depuis lURL remote"))
GadgetToolTip(#GdtBtnPull, T("tip.pull", "Récupérer et fusionner depuis le remote")) GadgetToolTip(#GdtBtnPull, T("tip.pull", "Récupérer et fusionner depuis le remote"))
GadgetToolTip(#GdtBtnPush, T("tip.push", "Envoyer vos commits sur le remote")) GadgetToolTip(#GdtBtnPush, T("tip.push", "Envoyer vos commits sur le remote"))
; Fichiers & actions locales ; Fichiers & actions locales
GadgetToolTip(#GdtListStatus, T("tip.files.list", "Fichiers du dépôt : cochez pour préparer un commit, sélectionnez pour agir")) GadgetToolTip(#GdtListStatus, T("tip.files.list", "Fichiers du dépôt : cochez pour préparer un commit, sélectionnez pour agir"))
GadgetToolTip(#GdtBtnRestore, T("tip.restore", "Restaurer les fichiers sélectionnés")) GadgetToolTip(#GdtBtnRestore, T("tip.restore", "Restaurer les fichiers sélectionnés"))
GadgetToolTip(#GdtBtnRename, T("tip.rename", "Renommer les fichiers sélectionnés")) GadgetToolTip(#GdtBtnRename, T("tip.rename", "Renommer les fichiers sélectionnés"))
GadgetToolTip(#GdtBtnDelete, T("tip.delete", "Supprimer les fichiers sélectionnés")) GadgetToolTip(#GdtBtnDelete, T("tip.delete", "Supprimer les fichiers sélectionnés"))
GadgetToolTip(#GdtBtnIgnore, T("tip.ignore", "Ajouter/retirer les fichiers sélectionnés dans .gitignore")) GadgetToolTip(#GdtBtnIgnore, T("tip.ignore", "Ajouter/retirer les fichiers sélectionnés dans .gitignore"))
; Commit ; Commit
GadgetToolTip(#GdtFieldMessage,T("tip.message", "Message du commit")) GadgetToolTip(#GdtFieldMessage,T("tip.message", "Message du commit"))
GadgetToolTip(#GdtBtnCommit, T("tip.commit", "Committer tous les fichiers cochés avec le message")) GadgetToolTip(#GdtBtnCommit, T("tip.commit", "Committer tous les fichiers cochés avec le message"))
; History ; History
GadgetToolTip(#GdtListHistory, T("tip.history", "Historique des commits")) GadgetToolTip(#GdtListHistory, T("tip.history", "Historique des commits"))
GadgetToolTip(#GdtBtnRestoreCommit,T("tip.history.restore","Restaurer/checkout le commit sélectionné")) GadgetToolTip(#GdtBtnRestoreCommit,T("tip.history.restore","Restaurer/checkout le commit sélectionné"))
; .gitignore ; .gitignore
GadgetToolTip(#GdtTxtGitIgnore, T("tip.gitignore.edit","Éditeur du .gitignore")) GadgetToolTip(#GdtTxtGitIgnore, T("tip.gitignore.edit","Éditeur du .gitignore"))
GadgetToolTip(#GdtBtnSaveGitIgnore,T("tip.gitignore.save","Sauvegarder le .gitignore")) GadgetToolTip(#GdtBtnSaveGitIgnore,T("tip.gitignore.save","Sauvegarder le .gitignore"))
; Config ; Config
GadgetToolTip(#GdtFieldUserName, T("tip.cfg.username","Nom dutilisateur Git (user.name)")) GadgetToolTip(#GdtFieldUserName, T("tip.cfg.username","Nom dutilisateur Git (user.name)"))
GadgetToolTip(#GdtFieldUserEmail,T("tip.cfg.useremail","Email Git (user.email)")) GadgetToolTip(#GdtFieldUserEmail,T("tip.cfg.useremail","Email Git (user.email)"))
@@ -1882,47 +1945,47 @@ Procedure InitGadget()
Protected haveHistorySel.b = Bool(GetGadgetState(#GdtListHistory) >= 0) Protected haveHistorySel.b = Bool(GetGadgetState(#GdtListHistory) >= 0)
Protected userName$ = Trim(GetGadgetText(#GdtFieldUserName)) Protected userName$ = Trim(GetGadgetText(#GdtFieldUserName))
Protected userEmail$ = Trim(GetGadgetText(#GdtFieldUserEmail)) Protected userEmail$ = Trim(GetGadgetText(#GdtFieldUserEmail))
; Mémoriser létat init global ; Mémoriser létat init global
main\info\isInit = isInit main\info\isInit = isInit
; ---- Zone Dépôt ---------------------------------------------------------- ; ---- Zone Dépôt ----------------------------------------------------------
DisableGadget(#GdtBtnInit, Bool(Not (hasGit And repoDirOK And Not isInit))) DisableGadget(#GdtBtnInit, Bool(Not (hasGit And repoDirOK And Not isInit)))
DisableGadget(#GdtBtnRefresh, Bool(Not (hasGit And repoDirOK))) DisableGadget(#GdtBtnRefresh, Bool(Not (hasGit And repoDirOK)))
DisableGadget(#GgtFieldRepo, Bool(Not hasGit)) DisableGadget(#GgtFieldRepo, Bool(Not hasGit))
; ---- Remote / Branch ----------------------------------------------------- ; ---- Remote / Branch -----------------------------------------------------
DisableGadget(#GdtFieldRemote, Bool(Not (hasGit And repoDirOK))) DisableGadget(#GdtFieldRemote, Bool(Not (hasGit And repoDirOK)))
DisableGadget(#GdtSlctBranch, Bool(Not (hasGit And isInit))) DisableGadget(#GdtSlctBranch, Bool(Not (hasGit And isInit)))
DisableGadget(#GdtBtnNewBranch,Bool(Not (hasGit And isInit))) DisableGadget(#GdtBtnNewBranch,Bool(Not (hasGit And isInit)))
; Règle demandée : Clone/Pull/Push uniquement si une remote est définie ; Règle demandée : Clone/Pull/Push uniquement si une remote est définie
DisableGadget(#GdtBtnClone, Bool(Not (hasGit And repoDirOK And hasRemote))) DisableGadget(#GdtBtnClone, Bool(Not (hasGit And repoDirOK And hasRemote)))
DisableGadget(#GdtBtnPull, Bool(Not (hasGit And isInit And hasRemote))) DisableGadget(#GdtBtnPull, Bool(Not (hasGit And isInit And hasRemote)))
DisableGadget(#GdtBtnPush, Bool(Not (hasGit And isInit And hasRemote))) DisableGadget(#GdtBtnPush, Bool(Not (hasGit And isInit And hasRemote)))
; ---- Fichiers & actions locales ----------------------------------------- ; ---- Fichiers & actions locales -----------------------------------------
; Restaurer / Renommer / Supprimer / Ignorer : uniquement si des fichiers sont sélectionnés ; Restaurer / Renommer / Supprimer / Ignorer : uniquement si des fichiers sont sélectionnés
DisableGadget(#GdtBtnRestore, Bool(selCount = 0)) DisableGadget(#GdtBtnRestore, Bool(selCount = 0))
DisableGadget(#GdtBtnRename, Bool(selCount = 0)) DisableGadget(#GdtBtnRename, Bool(selCount = 0))
DisableGadget(#GdtBtnDelete, Bool(selCount = 0)) DisableGadget(#GdtBtnDelete, Bool(selCount = 0))
DisableGadget(#GdtBtnIgnore, Bool(selCount = 0)) DisableGadget(#GdtBtnIgnore, Bool(selCount = 0))
; Commit : uniquement si des fichiers sont cochés ; Commit : uniquement si des fichiers sont cochés
DisableGadget(#GdtBtnCommit, Bool(Not (hasGit And isInit And checkedCount > 0))) DisableGadget(#GdtBtnCommit, Bool(Not (hasGit And isInit And checkedCount > 0)))
; ---- Onglet History ------------------------------------------------------ ; ---- Onglet History ------------------------------------------------------
DisableGadget(#GdtBtnRestoreCommit, Bool(Not (hasGit And isInit And haveHistorySel))) DisableGadget(#GdtBtnRestoreCommit, Bool(Not (hasGit And isInit And haveHistorySel)))
; ---- .gitignore ---------------------------------------------------------- ; ---- .gitignore ----------------------------------------------------------
; On autorise la sauvegarde si le repo est initialisé (fichier créé si besoin) ; On autorise la sauvegarde si le repo est initialisé (fichier créé si besoin)
DisableGadget(#GdtBtnSaveGitIgnore, Bool(Not (hasGit And isInit))) DisableGadget(#GdtBtnSaveGitIgnore, Bool(Not (hasGit And isInit)))
; ---- Config -------------------------------------------------------------- ; ---- Config --------------------------------------------------------------
; Le bouton "Enregistrer" actif si au moins un champ non vide ; Le bouton "Enregistrer" actif si au moins un champ non vide
DisableGadget(#GdtBtnSaveCfg, Bool(userName$ = "" And userEmail$ = "")) DisableGadget(#GdtBtnSaveCfg, Bool(userName$ = "" And userEmail$ = ""))
EndProcedure EndProcedure
Macro RightGadget(GDT) Macro RightGadget(GDT)
@@ -2081,26 +2144,26 @@ Procedure OpenGUI()
; --- Fin des onglets --- ; --- Fin des onglets ---
CloseGadgetList() CloseGadgetList()
; ============================================================ ; ============================================================
; Aide à droite du Panel (sans splitter) ; Aide à droite du Panel (sans splitter)
; ============================================================ ; ============================================================
; On garde #PanelW / #PanelH tels quels ; On garde #PanelW / #PanelH tels quels
Define helpGap = 10 ; espace entre panel et aide Define helpGap = 10 ; espace entre panel et aide
Define helpX = #InPad + #PanelW + helpGap ; à droite du panel Define helpX = #InPad + #PanelW + helpGap ; à droite du panel
Define helpY = #InPad Define helpY = #InPad
Define helpW = WindowWidth(#WinMain)-GadgetWidth(#gdtPnl)- #InPad*4 ; reste de largeur jusqu'à la marge droite Define helpW = WindowWidth(#WinMain)-GadgetWidth(#gdtPnl)- #InPad*4 ; reste de largeur jusqu'à la marge droite
Define helpH = #PanelH ; même hauteur que le panel Define helpH = #PanelH ; même hauteur que le panel
; (Optionnel) borne minimale si besoin ; (Optionnel) borne minimale si besoin
If helpW < 100 : helpW = 100 : EndIf If helpW < 100 : helpW = 100 : EndIf
; Soit en direct : ; Soit en direct :
WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH) WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
; — ou, si tu veux un cadre : ; — ou, si tu veux un cadre :
; FrameGadget(#GdtFrmHelp, helpX, helpY, helpW, helpH, T("GdtFrmHelp","Aide")) ; FrameGadget(#GdtFrmHelp, helpX, helpY, helpW, helpH, T("GdtFrmHelp","Aide"))
; WebViewGadget(#GdtHelp, helpX + 10, helpY + 25, helpW - 20, helpH - 35) ; WebViewGadget(#GdtHelp, helpX + 10, helpY + 25, helpW - 20, helpH - 35)
SetGadgetText(#GgtFieldRepo,main\GitCall\workdir) SetGadgetText(#GgtFieldRepo,main\GitCall\workdir)
@@ -2108,13 +2171,13 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
InitGadget() InitGadget()
_SetTooltips() _SetTooltips()
If FileSize(".git")=-2:main\info\isInit=#True:EndIf If FileSize(".git")=-2:main\info\isInit=#True:EndIf
If main\info\isInit=#True ;If main\info\isInit=#True
GetRemoteUrl("origin") ; GetRemoteUrl("origin")
GetCommitHistory() ; GetCommitHistory()
EndIf ;;EndIf
GetBranchesList() GetBranchesList()
; =================== EVENT LOOP / BOUCLE ÉVÉNEMENTS =================== ; =================== EVENT LOOP / BOUCLE ÉVÉNEMENTS ===================
Quit=#False Quit=#False
Repeat Repeat
@@ -2124,7 +2187,8 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
Quit=#True Quit=#True
Case #PB_Event_Gadget Case #PB_Event_Gadget
Select EventGadget() Select EventGadget()
Case #gdtPnl Case #GdtPnl
Debug "Click>#gdtPnl"
If EventType()=#PB_EventType_Change If EventType()=#PB_EventType_Change
ReadGitIgnorefile() ReadGitIgnorefile()
Select GetGadgetState(#GdtPnl) Select GetGadgetState(#GdtPnl)
@@ -2134,17 +2198,22 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
EndIf EndIf
Case #GdtBtnInit Case #GdtBtnInit
Debug "Click>#GdtBtnInit"
DoInit() DoInit()
CreateThread(@RefreshFileList(),0) CreateThread(@RefreshFileList(),0)
Case #GdtBtnRefresh Case #GdtBtnRefresh
Debug "Click>#GdtBtnRefresh"
CreateThread(@RefreshFileList(),0) CreateThread(@RefreshFileList(),0)
Case #GgtFieldRepo Case #GgtFieldRepo
If EventType()=#PB_EventType_LostFocus If EventType()=#PB_EventType_LostFocus
Debug "Click>#GgtFieldRepo"
main\GitCall\workdir=GetGadgetText(#GgtFieldRepo) main\GitCall\workdir=GetGadgetText(#GgtFieldRepo)
CreateThread(@RefreshFileList(),0) CreateThread(@RefreshFileList(),0)
EndIf EndIf
Case #GdtBtnBrowseRepo Case #GdtBtnBrowseRepo
Debug "Click>#GdtBtnBrowseRepo"
Protected path.s=PathRequester("Select Folder",main\GitCall\workdir,WindowID(#WinMain)) Protected path.s=PathRequester("Select Folder",main\GitCall\workdir,WindowID(#WinMain))
If path<>"" And FileSize(path)=-2 If path<>"" And FileSize(path)=-2
main\GitCall\workdir=path main\GitCall\workdir=path
@@ -2158,15 +2227,21 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
; EndIf ; EndIf
Case #GdtBtnClone Case #GdtBtnClone
DoClone() Debug "Click>#GdtBtnClone"
DoClone()
Case #GdtBtnPush Case #GdtBtnPush
Debug "Click>#GdtBtnPush"
DoPush() DoPush()
Case #GdtBtnPull Case #GdtBtnPull
Debug "Click>#GdtBtnPull"
DoPull() DoPull()
Case #GdtListStatus Case #GdtListStatus
Debug "Click>#GdtListStatus"
Case #GdtBtnIgnore Case #GdtBtnIgnore
Debug "Click>#GdtBtnIgnore"
ToggleGitIgnoreForSelection() ToggleGitIgnoreForSelection()
Case #GdtBtnSaveGitIgnore Case #GdtBtnSaveGitIgnore
Debug "Click>#GdtBtnSaveGitIgnore"
Protected hf.i=CreateFile(#PB_Any,".gitignore") Protected hf.i=CreateFile(#PB_Any,".gitignore")
If hf If hf
WriteString(hf,GetGadgetText(#GdtTxtGitIgnore)) WriteString(hf,GetGadgetText(#GdtTxtGitIgnore))
@@ -2174,18 +2249,26 @@ WebViewGadget(#GdtHelp, helpX, helpY, helpW, helpH)
EndIf EndIf
Case #GdtBtnCommit Case #GdtBtnCommit
Debug "Click>#GdtBtnCommit"
DoCommit() DoCommit()
SetGadgetText(#GdtFieldMessage,"")
CreateThread(@RefreshFileList(),0)
Case #GdtFieldRemote Case #GdtFieldRemote
Debug "Click>#GdtFieldRemote"
Case #GdtListHistory Case #GdtListHistory
Debug "Click>#GdtListHistory"
If EventType() = #PB_EventType_Change If EventType() = #PB_EventType_Change
ShowSelectedCommitInfo() ShowSelectedCommitInfo()
EndIf EndIf
Case #GdtSlctBranch Case #GdtSlctBranch
Debug "Click>#GdtSlctBranch"
Case #GdtSlctScope Case #GdtSlctScope
Debug "Click>#GdtSlctScope"
GetGitIdentity() GetGitIdentity()
Case #GdtBtnSaveCfg Case #GdtBtnSaveCfg
Debug "Click>#GdtBtnSaveCfg"
SetGitIdentity() SetGitIdentity()
@@ -2202,8 +2285,8 @@ OpenGUI()
; IDE Options = PureBasic 6.21 (Windows - x64) ; IDE Options = PureBasic 6.21 (Windows - x64)
; CursorPosition = 541 ; CursorPosition = 1871
; FirstLine = 509 ; FirstLine = 1867
; Folding = ---------- ; Folding = ----------
; Optimizer ; Optimizer
; EnableThread ; EnableThread