update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-bisect.el --- bisect support for Magit -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2011-2020 The Magit Project Contributors
|
||||
;; Copyright (C) 2011-2021 The Magit Project Contributors
|
||||
;;
|
||||
;; You should have received a copy of the AUTHORS.md file which
|
||||
;; lists all contributors. If not, see http://magit.vc/authors.
|
||||
@@ -58,25 +58,48 @@
|
||||
(transient-define-prefix magit-bisect ()
|
||||
"Narrow in on the commit that introduced a bug."
|
||||
:man-page "git-bisect"
|
||||
["Actions"
|
||||
[:class transient-subgroups
|
||||
:if-not magit-bisect-in-progress-p
|
||||
("B" "Start" magit-bisect-start)
|
||||
("s" "Start script" magit-bisect-run)]
|
||||
["Arguments"
|
||||
("-n" "Don't checkout commits" "--no-checkout")
|
||||
("-p" "Follow only first parent of a merge" "--first-parent"
|
||||
:if (lambda () (version<= "2.29" (magit-git-version))))
|
||||
(6 magit-bisect:--term-old
|
||||
:if (lambda () (version<= "2.7" (magit-git-version))))
|
||||
(6 magit-bisect:--term-new
|
||||
:if (lambda () (version<= "2.7" (magit-git-version))))]
|
||||
["Actions"
|
||||
("B" "Start" magit-bisect-start)
|
||||
("s" "Start script" magit-bisect-run)]]
|
||||
["Actions"
|
||||
:if magit-bisect-in-progress-p
|
||||
("B" "Bad" magit-bisect-bad)
|
||||
("g" "Good" magit-bisect-good)
|
||||
(6 "m" "Mark" magit-bisect-mark
|
||||
:if (lambda () (version<= "2.7" (magit-git-version))))
|
||||
("k" "Skip" magit-bisect-skip)
|
||||
("r" "Reset" magit-bisect-reset)
|
||||
("s" "Run script" magit-bisect-run)])
|
||||
|
||||
(transient-define-argument magit-bisect:--term-old ()
|
||||
:description "Old/good term"
|
||||
:class 'transient-option
|
||||
:key "=o"
|
||||
:argument "--term-old=")
|
||||
|
||||
(transient-define-argument magit-bisect:--term-new ()
|
||||
:description "New/bad term"
|
||||
:class 'transient-option
|
||||
:key "=n"
|
||||
:argument "--term-new=")
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-bisect-start (bad good)
|
||||
(defun magit-bisect-start (bad good args)
|
||||
"Start a bisect session.
|
||||
|
||||
Bisecting a bug means to find the commit that introduced it.
|
||||
This command starts such a bisect session by asking for a know
|
||||
good and a bad commit. To move the session forward use the
|
||||
This command starts such a bisect session by asking for a known
|
||||
good and a known bad commit. To move the session forward use the
|
||||
other actions from the bisect transient command (\
|
||||
\\<magit-status-mode-map>\\[magit-bisect])."
|
||||
(interactive (if (magit-bisect-in-progress-p)
|
||||
@@ -84,15 +107,27 @@ other actions from the bisect transient command (\
|
||||
(magit-bisect-start-read-args)))
|
||||
(unless (magit-rev-ancestor-p good bad)
|
||||
(user-error
|
||||
"The good revision (%s) has to be an ancestor of the bad one (%s)"
|
||||
good bad))
|
||||
"The %s revision (%s) has to be an ancestor of the %s one (%s)"
|
||||
(or (transient-arg-value "--term-old=" args) "good")
|
||||
good
|
||||
(or (transient-arg-value "--term-new=" args) "bad")
|
||||
bad))
|
||||
(when (magit-anything-modified-p)
|
||||
(user-error "Cannot bisect with uncommitted changes"))
|
||||
(magit-git-bisect "start" (list bad good) t))
|
||||
(magit-git-bisect "start" (list args bad good) t))
|
||||
|
||||
(defun magit-bisect-start-read-args ()
|
||||
(let ((b (magit-read-branch-or-commit "Start bisect with bad revision")))
|
||||
(list b (magit-read-other-branch-or-commit "Good revision" b))))
|
||||
(let* ((args (transient-args 'magit-bisect))
|
||||
(bad (magit-read-branch-or-commit
|
||||
(format "Start bisect with %s revision"
|
||||
(or (transient-arg-value "--term-new=" args)
|
||||
"bad")))))
|
||||
(list bad
|
||||
(magit-read-other-branch-or-commit
|
||||
(format "%s revision" (or (transient-arg-value "--term-old=" args)
|
||||
"Good"))
|
||||
bad)
|
||||
args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-bisect-reset ()
|
||||
@@ -108,7 +143,8 @@ other actions from the bisect transient command (\
|
||||
Use this after you have asserted that the commit does not contain
|
||||
the bug in question."
|
||||
(interactive)
|
||||
(magit-git-bisect "good"))
|
||||
(magit-git-bisect (or (cadr (magit-bisect-terms))
|
||||
(user-error "Not bisecting"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-bisect-bad ()
|
||||
@@ -116,7 +152,28 @@ the bug in question."
|
||||
Use this after you have asserted that the commit does contain the
|
||||
bug in question."
|
||||
(interactive)
|
||||
(magit-git-bisect "bad"))
|
||||
(magit-git-bisect (or (car (magit-bisect-terms))
|
||||
(user-error "Not bisecting"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-bisect-mark ()
|
||||
"While bisecting, mark the current commit with a bisect term.
|
||||
During a bisect using alternate terms, commits can still be
|
||||
marked with `magit-bisect-good' and `magit-bisect-bad', as those
|
||||
commands map to the correct term (\"good\" to --term-old's value
|
||||
and \"bad\" to --term-new's). However, in some cases, it can be
|
||||
difficult to keep that mapping straight in your head; this
|
||||
command provides an interface that exposes the underlying terms."
|
||||
(interactive)
|
||||
(magit-git-bisect
|
||||
(pcase-let ((`(,term-new ,term-old) (or (magit-bisect-terms)
|
||||
(user-error "Not bisecting"))))
|
||||
(pcase (read-char-choice
|
||||
(format "Mark HEAD as %s ([n]ew) or %s ([o]ld)"
|
||||
term-new term-old)
|
||||
(list ?n ?o))
|
||||
(?n term-new)
|
||||
(?o term-old)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-bisect-skip ()
|
||||
@@ -127,7 +184,7 @@ to test. This command lets Git choose a different one."
|
||||
(magit-git-bisect "skip"))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-bisect-run (cmdline &optional bad good)
|
||||
(defun magit-bisect-run (cmdline &optional bad good args)
|
||||
"Bisect automatically by running commands after each step.
|
||||
|
||||
Unlike `git bisect run' this can be used before bisecting has
|
||||
@@ -137,7 +194,7 @@ bisect run'."
|
||||
(magit-bisect-start-read-args))))
|
||||
(cons (read-shell-command "Bisect shell command: ") args)))
|
||||
(when (and bad good)
|
||||
(magit-bisect-start bad good))
|
||||
(magit-bisect-start bad good args))
|
||||
(magit-git-bisect "run" (list shell-file-name shell-command-switch cmdline)))
|
||||
|
||||
(defun magit-git-bisect (subcommand &optional args no-assert)
|
||||
@@ -170,6 +227,9 @@ bisect run'."
|
||||
(defun magit-bisect-in-progress-p ()
|
||||
(file-exists-p (magit-git-dir "BISECT_LOG")))
|
||||
|
||||
(defun magit-bisect-terms ()
|
||||
(magit-file-lines (magit-git-dir "BISECT_TERMS")))
|
||||
|
||||
(defun magit-insert-bisect-output ()
|
||||
"While bisecting, insert section with output from `git bisect'."
|
||||
(when (magit-bisect-in-progress-p)
|
||||
|
||||
Reference in New Issue
Block a user