[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 0ab892a3b4 7/7: magit-git-mergetool: New comman
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 0ab892a3b4 7/7: magit-git-mergetool: New command |
Date: |
Tue, 1 Mar 2022 08:58:18 -0500 (EST) |
branch: elpa/git-commit
commit 0ab892a3b45f5ad7e7f335348c8276f8f8c525e1
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-git-mergetool: New command
Closes #4128.
---
docs/magit.org | 16 +++++++++++
docs/magit.texi | 18 ++++++++++++
lisp/magit-ediff.el | 3 +-
lisp/magit-extras.el | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++
lisp/magit.el | 3 +-
5 files changed, 118 insertions(+), 2 deletions(-)
diff --git a/docs/magit.org b/docs/magit.org
index 0d3c477cbf..bc33f2b67e 100644
--- a/docs/magit.org
+++ b/docs/magit.org
@@ -1922,6 +1922,13 @@ These suffix commands start external gui tools.
This command runs ~git gui~ in the current repository.
+- Key: ! m (magit-git-mergetool) ::
+
+ This command runs =git mergetool --gui= in the current repository.
+
+ With a prefix argument this acts as a transient prefix command,
+ allowing the user to select the mergetool and change some settings.
+
*** Git Executable
When Magit calls Git, then it may do so using the absolute path to the
@@ -3477,6 +3484,15 @@ information on how to use Ediff itself, see info:ediff.
including those already resolved by Git, use
~ediff-merge-revisions-with-ancestor~.
+- Key: E t (magit-git-mergetool) ::
+
+ This command does not actually use Ediff. While it serves the same
+ purpose as =magit-ediff-resolve=, it uses =git mergetool --gui= to
+ resolve conflicts.
+
+ With a prefix argument this acts as a transient prefix command,
+ allowing the user to select the mergetool and change some settings.
+
- Key: E s (magit-ediff-stage) ::
Stage and unstage changes to a file using Ediff, defaulting to the
diff --git a/docs/magit.texi b/docs/magit.texi
index cf771d1eaa..fde3650684 100644
--- a/docs/magit.texi
+++ b/docs/magit.texi
@@ -2474,6 +2474,14 @@ This command runs @code{gitk --branches} in the current
repository.
@kindex ! g
@findex magit-run-git-gui
This command runs @code{git gui} in the current repository.
+
+@item @kbd{! m} (@code{magit-git-mergetool})
+@kindex ! m
+@findex magit-git-mergetool
+This command runs @samp{git mergetool --gui} in the current repository.
+
+With a prefix argument this acts as a transient prefix command,
+allowing the user to select the mergetool and change some settings.
@end table
@node Git Executable
@@ -4344,6 +4352,16 @@ In the rare event that you want to manually resolve all
conflicts,
including those already resolved by Git, use
@code{ediff-merge-revisions-with-ancestor}.
+@item @kbd{E t} (@code{magit-git-mergetool})
+@kindex E t
+@findex magit-git-mergetool
+This command does not actually use Ediff. While it serves the same
+purpose as @samp{magit-ediff-resolve}, it uses @samp{git mergetool --gui} to
+resolve conflicts.
+
+With a prefix argument this acts as a transient prefix command,
+allowing the user to select the mergetool and change some settings.
+
@item @kbd{E s} (@code{magit-ediff-stage})
@kindex E s
@findex magit-ediff-stage
diff --git a/lisp/magit-ediff.el b/lisp/magit-ediff.el
index 2cafef9535..114793efa2 100644
--- a/lisp/magit-ediff.el
+++ b/lisp/magit-ediff.el
@@ -118,7 +118,8 @@ tree at the time of stashing."
["Ediff"
[("E" "Dwim" magit-ediff-dwim)
("s" "Stage" magit-ediff-stage)
- ("m" "Resolve" magit-ediff-resolve)]
+ ("m" "Resolve" magit-ediff-resolve)
+ ("t" "Resolve using mergetool" magit-git-mergetool)]
[("u" "Show unstaged" magit-ediff-show-unstaged)
("i" "Show staged" magit-ediff-show-staged)
("w" "Show worktree" magit-ediff-show-working-tree)]
diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el
index 18f99da3cf..024e763585 100644
--- a/lisp/magit-extras.el
+++ b/lisp/magit-extras.el
@@ -48,6 +48,86 @@
:group 'magit-extensions)
;;; Git Tools
+;;;; Git-Mergetool
+
+;;;###autoload (autoload 'magit-git-mergetool "magit-extras" nil t)
+(transient-define-prefix magit-git-mergetool (file args &optional transient)
+ "Resolve conflicts in FILE using \"git mergetool --gui\".
+With a prefix argument allow changing ARGS using a transient
+popup."
+ :man-page "git-mergetool"
+ ["Settings"
+ ("-t" magit-git-mergetool:--tool)
+ ("=t" magit-merge.guitool)
+ ("=T" magit-merge.tool)
+ ("-r" magit-mergetool.hideResolved)
+ ("-b" magit-mergetool.keepBackup)
+ ("-k" magit-mergetool.keepTemporaries)
+ ("-w" magit-mergetool.writeToTemp)]
+ ["Actions"
+ (" m" "Invoke mergetool" magit-git-mergetool)]
+ (interactive
+ (if (and (not (eq transient-current-prefix 'magit-git-mergetool))
+ current-prefix-arg)
+ (list nil nil t)
+ (list (magit-read-unmerged-file "Resolve")
+ (transient-args 'magit-git-mergetool))))
+ (if transient
+ (transient-setup 'magit-git-mergetool)
+ (magit-run-git-async "mergetool" "--gui" args "--" file)))
+
+(transient-define-infix magit-git-mergetool:--tool ()
+ :description "Override mergetool"
+ :class 'transient-option
+ :shortarg "-t"
+ :argument "--tool="
+ :reader 'magit--read-mergetool)
+
+(transient-define-infix magit-merge.guitool ()
+ :class 'magit--git-variable
+ :variable "merge.guitool"
+ :global t
+ :reader 'magit--read-mergetool)
+
+(transient-define-infix magit-merge.tool ()
+ :class 'magit--git-variable
+ :variable "merge.tool"
+ :global t
+ :reader 'magit--read-mergetool)
+
+(defun magit--read-mergetool (prompt _initial-input history)
+ (let ((choices nil)
+ (lines (cdr (magit-git-lines "mergetool" "--tool-help"))))
+ (while (string-prefix-p "\t\t" (car lines))
+ (push (substring (pop lines) 2) choices))
+ (setq choices (nreverse choices))
+ (magit-completing-read (or prompt "Select mergetool")
+ choices nil t nil history)))
+
+(transient-define-infix magit-mergetool.hideResolved ()
+ :class 'magit--git-variable:boolean
+ :variable "mergetool.hideResolved"
+ :default "false"
+ :global t)
+
+(transient-define-infix magit-mergetool.keepBackup ()
+ :class 'magit--git-variable:boolean
+ :variable "mergetool.keepBackup"
+ :default "true"
+ :global t)
+
+(transient-define-infix magit-mergetool.keepTemporaries ()
+ :class 'magit--git-variable:boolean
+ :variable "mergetool.keepTemporaries"
+ :default "false"
+ :global t)
+
+(transient-define-infix magit-mergetool.writeToTemp ()
+ :class 'magit--git-variable:boolean
+ :variable "mergetool.writeToTemp"
+ :default "false"
+ :global t)
+
;;;; Git-Gui
;;;###autoload
diff --git a/lisp/magit.el b/lisp/magit.el
index 99374af4c6..08e9c6d502 100644
--- a/lisp/magit.el
+++ b/lisp/magit.el
@@ -403,7 +403,8 @@ This affects `magit-git-command',
`magit-git-command-topdir',
("k" "gitk" magit-run-gitk)
("a" "gitk --all" magit-run-gitk-all)
("b" "gitk --branches" magit-run-gitk-branches)
- ("g" "git gui" magit-run-git-gui)]])
+ ("g" "git gui" magit-run-git-gui)
+ ("m" "git mergetool --gui" magit-git-mergetool)]])
;;;###autoload
(defun magit-git-command (command)
- [nongnu] elpa/git-commit updated (0f96d39834 -> 0ab892a3b4), ELPA Syncer, 2022/03/01
- [nongnu] elpa/git-commit b5c0882a4f 2/7: magit-get-boolean: Support using scope argument, ELPA Syncer, 2022/03/01
- [nongnu] elpa/git-commit 064a047932 1/7: transient-infix-read: Use same macros as default around method, ELPA Syncer, 2022/03/01
- [nongnu] elpa/git-commit 72ee06c7ea 5/7: magit-read-unmerged-file: New function, ELPA Syncer, 2022/03/01
- [nongnu] elpa/git-commit 9c056d41a6 3/7: magit--git-variable:choices: Support changing global value, ELPA Syncer, 2022/03/01
- [nongnu] elpa/git-commit a2ef67a415 4/7: magit--git-variable:boolean: New class, ELPA Syncer, 2022/03/01
- [nongnu] elpa/git-commit 630ada42cb 6/7: magit-extras.el: Rearrange a bit, ELPA Syncer, 2022/03/01
- [nongnu] elpa/git-commit 0ab892a3b4 7/7: magit-git-mergetool: New command,
ELPA Syncer <=