emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vc-got daae979 066/145: implement vc-got-stage-commit t


From: ELPA Syncer
Subject: [elpa] externals/vc-got daae979 066/145: implement vc-got-stage-commit to commit staged changes
Date: Thu, 9 Sep 2021 15:58:35 -0400 (EDT)

branch: externals/vc-got
commit daae979d49408c97d6ed40de4a1aad4c2304c91d
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>

    implement vc-got-stage-commit to commit staged changes
---
 vc-got-stage.el | 18 ++++++++++++++++++
 vc-got.el       |  4 ++++
 2 files changed, 22 insertions(+)

diff --git a/vc-got-stage.el b/vc-got-stage.el
index 489c18f..461b819 100644
--- a/vc-got-stage.el
+++ b/vc-got-stage.el
@@ -25,12 +25,14 @@
 
 ;;; Code:
 
+(require 'log-edit)
 (require 'rx)
 (require 'vc)
 
 (defvar vc-got-program)                 ;vc-got.el
 (declare-function vc-got--diff    "vc-got")
 (declare-function vc-got--unstage "vc-got" (file))
+(declare-function vc-got-checkin  "vc-got" (fileset comment))
 
 (defvar vc-got-stage--process nil
   "The got stage process.")
@@ -127,5 +129,21 @@ If FILESET is nil, show the diff for every staged hunks."
             (vc-got--diff "-s" file))
         (vc-got--diff "-s")))))
 
+(defun vc-got-stage-commit ()
+  "Commit staged hunks."
+  (interactive)
+  (let ((buf (get-buffer-create "*vc-got-stage-commit*")))
+    (pop-to-buffer buf)
+    (log-edit (lambda ()
+                (interactive)
+                (let ((msg (buffer-substring-no-properties (point-min)
+                                                           (point-max))))
+                  (kill-buffer)
+                  (vc-got-checkin nil msg)))
+              t
+              ;; TODO: add here an alist of
+              ;; '((vc-log-fileset . (staged-files)))
+              )))
+
 (provide 'vc-got-stage)
 ;;; vc-got-stage.el ends here
diff --git a/vc-got.el b/vc-got.el
index 32a11f7..f088f2d 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -447,6 +447,10 @@ tree."
 
 (defalias 'vc-got-responsible-p #'vc-got-root)
 
+;; XXX: generally speaking, files cannot be nil.  But we have to
+;; handle that case too, because vc-got-stage-commit will call
+;; vc-got-checking with fileset nil to commit the current staged
+;; hunks.
 (defun vc-got-checkin (files comment &optional _rev)
   "Commit FILES with COMMENT as commit message."
   (with-temp-buffer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]