mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
'C-x v v' on a diff buffer commits it as a patch (bug#52349)
* lisp/vc/diff-mode.el (diff-vc-deduce-fileset): New function. * lisp/vc/log-edit.el (log-edit-diff-patch): New function. * lisp/vc/vc-dispatcher.el (vc-log-edit): Set log-edit-diff-function to log-edit-diff-patch when vc-patch-string is non-nil. (vc-start-logentry): New optional arg 'patch-string'. Set buffer-local 'vc-patch-string' to 'patch-string'. (vc-dispatcher-browsing): Add (derived-mode-p 'diff-mode). * lisp/vc/vc-git.el (vc-git-checkin-patch): New function. (vc-git-checkin): When vc-git-patch-string is non-nil, use `git apply --cached` to add the patch to the index, then commit the staged changes. * lisp/vc/vc.el: New backend function 'checkin-patch'. (vc-deduce-fileset-1): Call diff-vc-deduce-fileset in diff-mode. (vc-next-action): For model 'patch' call vc-checkin with the diff buffer string. (vc-checkin): New optional arg 'patch-string'. Call backend function 'checkin-patch' when 'patch-string' is non-nil. Call vc-start-logentry with 'patch-string'. (vc-diff-patch-string): New function.
This commit is contained in:
parent
35af917f18
commit
4803fba487
6 changed files with 91 additions and 12 deletions
|
|
@ -664,6 +664,12 @@ comment history, see `log-edit-comment-ring', and hides `log-edit-files-buf'."
|
|||
(indent-rigidly (point) (point-max)
|
||||
(- log-edit-common-indent common)))))
|
||||
|
||||
(defvar vc-patch-string)
|
||||
|
||||
(autoload 'vc-diff-patch-string "vc")
|
||||
(defun log-edit-diff-patch ()
|
||||
(vc-diff-patch-string vc-patch-string))
|
||||
|
||||
(defun log-edit-show-diff ()
|
||||
"Show the diff for the files to be committed."
|
||||
(interactive)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue