Editors and Mergetools with drracket

This commit is contained in:
2026-08-14 11:30:56 +02:00
parent 7d8a5cd599
commit e33ffb906a
7 changed files with 578 additions and 63 deletions
+31
View File
@@ -6,6 +6,8 @@
"private/diff.rkt"
"private/info-handler.rkt"
"private/utils.rkt"
"private/find-editor.rkt"
"private/find-mergetool.rkt"
simple-log
racket/string
net/sendurl
@@ -34,6 +36,7 @@
git-rebase
git-merge
git-cherry-pick
git-mergetool
git-clone
git-rev-list
git-diff
@@ -42,6 +45,11 @@
git-version
git-new-version
git-next-version
find-editor
set-editor!
find-mergetool
find-mergetool-path
set-mergetool!
default-git-authentication-handler
current-git-authentication-handler
exn:fail:git-auth?
@@ -625,6 +633,29 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def-cmd git-cherry-pick cmd-git-cherry-pick 'cherry-pick)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; goal : Resolve merge conflicts using a graphical Git merge tool.
; pre : The supplied arguments are valid for git mergetool.
; post : Git mergetool has completed successfully or an exception was raised.
; result : #t after a successful mergetool command.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def-cmd git-mergetool cmd-git-mergetool 'mergetool
(λ (args info)
(let ((tool-specified
(ormap
(λ (arg)
(let ((value (format "~a" arg)))
(or (string=? value "-t")
(regexp-match? #px"^--tool=" value)
(string=? value "--tool-help"))))
args)))
(if tool-specified
args
(let ((tool (find-mergetool)))
(if tool
(cons (format "--tool=~a" tool) args)
args))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; goal : Switch branches.
; pre : The supplied arguments are valid for git switch.