comparison lisp/vc-dispatcher.el @ 107430:1918e70c8b37

Add special markup processing for commit logs. * log-edit.el (log-edit-extra-flags): New variable. (log-edit): Add new argument MODE. Use that mode when non-nil instead of the log-view-mode. (log-view-process-buffer): New function. * vc.el: Document that the checkin method takes optional arguments. Document new backend specific method: log-view-mode. (vc-default-log-edit-mode): New function. (vc-checkin): Use a backend specific log-view-mode. Pass extra arguments to the checkin method. (vc-modify-change-comment): Pass a dummy extra argument. * vc-dispatcher.el (vc-log-edit): Add a mode argument, pass it to log-edit. (vc-start-logentry): Add a mode argument, pass it to vc-log-edit. (vc-finish-logentry): Process the log buffer before passing it down. Pass log-edit-extra-flags. * vc-bzr.el (vc-bzr-checkin): Pass extra arguments to the commit command. (log-edit-extra-flags, log-edit-before-checkin-process): New declarations. * vc-hg.el (vc-hg-checkin): Pass extra arguments to the commit command. (log-edit-extra-flags, log-edit-before-checkin-process): New declarations. (vc-hg-log-edit-mode): New derived mode. * vc-arch.el (vc-arch-checkin): * vc-cvs.el (vc-cvs-checkin): * vc-git.el (vc-git-checkin): * vc-mtn.el (vc-mtn-checkin): * vc-rcs.el (vc-rcs-checkin): * vc-sccs.el (vc-sccs-checkin): * vc-svn.el (vc-svn-checkin): Add an optional ignored argument.
author Dan Nicolaescu <dann@ics.uci.edu>
date Fri, 19 Mar 2010 02:37:41 -0700
parents 6427b60ed4f2
children 11244653958e
comparison
equal deleted inserted replaced
107429:024cba2776d2 107430:1918e70c8b37
520 520
521 ;; Command closures 521 ;; Command closures
522 522
523 ;; Set up key bindings for use while editing log messages 523 ;; Set up key bindings for use while editing log messages
524 524
525 (defun vc-log-edit (fileset) 525 (defun vc-log-edit (fileset mode)
526 "Set up `log-edit' for use on FILE." 526 "Set up `log-edit' for use on FILE."
527 (setq default-directory 527 (setq default-directory
528 (with-current-buffer vc-parent-buffer default-directory)) 528 (with-current-buffer vc-parent-buffer default-directory))
529 (log-edit 'vc-finish-logentry 529 (log-edit 'vc-finish-logentry
530 nil 530 nil
531 `((log-edit-listfun . (lambda () ',fileset)) 531 `((log-edit-listfun . (lambda () ',fileset))
532 (log-edit-diff-function . (lambda () (vc-diff nil))))) 532 (log-edit-diff-function . (lambda () (vc-diff nil))))
533 nil
534 mode)
533 (set (make-local-variable 'vc-log-fileset) fileset) 535 (set (make-local-variable 'vc-log-fileset) fileset)
534 (make-local-variable 'vc-log-extra) 536 (make-local-variable 'vc-log-extra)
535 (set-buffer-modified-p nil) 537 (set-buffer-modified-p nil)
536 (setq buffer-file-name nil)) 538 (setq buffer-file-name nil))
537 539
538 (defun vc-start-logentry (files extra comment initial-contents msg logbuf action &optional after-hook) 540 (defun vc-start-logentry (files extra comment initial-contents msg logbuf mode action &optional after-hook)
539 "Accept a comment for an operation on FILES with extra data EXTRA. 541 "Accept a comment for an operation on FILES with extra data EXTRA.
540 If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the 542 If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
541 action on close to ACTION. If COMMENT is a string and 543 action on close to ACTION. If COMMENT is a string and
542 INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial 544 INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial
543 contents of the log entry buffer. If COMMENT is a string and 545 contents of the log entry buffer. If COMMENT is a string and
558 (set-buffer (get-buffer-create logbuf)) 560 (set-buffer (get-buffer-create logbuf))
559 (pop-to-buffer (get-buffer-create logbuf))) 561 (pop-to-buffer (get-buffer-create logbuf)))
560 (set (make-local-variable 'vc-parent-buffer) parent) 562 (set (make-local-variable 'vc-parent-buffer) parent)
561 (set (make-local-variable 'vc-parent-buffer-name) 563 (set (make-local-variable 'vc-parent-buffer-name)
562 (concat " from " (buffer-name vc-parent-buffer))) 564 (concat " from " (buffer-name vc-parent-buffer)))
563 (vc-log-edit files) 565 (vc-log-edit files mode)
564 (make-local-variable 'vc-log-after-operation-hook) 566 (make-local-variable 'vc-log-after-operation-hook)
565 (when after-hook 567 (when after-hook
566 (setq vc-log-after-operation-hook after-hook)) 568 (setq vc-log-after-operation-hook after-hook))
567 (setq vc-log-operation action) 569 (setq vc-log-operation action)
568 (setq vc-log-extra extra) 570 (setq vc-log-extra extra)
588 ;; But not if it is a vc-dir buffer. 590 ;; But not if it is a vc-dir buffer.
589 (with-current-buffer vc-parent-buffer 591 (with-current-buffer vc-parent-buffer
590 (or (vc-dispatcher-browsing) (vc-buffer-sync))) 592 (or (vc-dispatcher-browsing) (vc-buffer-sync)))
591 (unless vc-log-operation 593 (unless vc-log-operation
592 (error "No log operation is pending")) 594 (error "No log operation is pending"))
595
596 (log-view-process-buffer)
597
593 ;; save the parameters held in buffer-local variables 598 ;; save the parameters held in buffer-local variables
594 (let ((logbuf (current-buffer)) 599 (let ((logbuf (current-buffer))
595 (log-operation vc-log-operation) 600 (log-operation vc-log-operation)
596 (log-fileset vc-log-fileset) 601 (log-fileset vc-log-fileset)
597 (log-extra vc-log-extra) 602 (log-extra vc-log-extra)
598 (log-entry (buffer-string)) 603 (log-entry (buffer-string))
604 (extra-flags log-edit-extra-flags)
599 (after-hook vc-log-after-operation-hook) 605 (after-hook vc-log-after-operation-hook)
600 (tmp-vc-parent-buffer vc-parent-buffer)) 606 (tmp-vc-parent-buffer vc-parent-buffer))
601 (pop-to-buffer vc-parent-buffer) 607 (pop-to-buffer vc-parent-buffer)
602 ;; OK, do it to it 608 ;; OK, do it to it
603 (save-excursion 609 (save-excursion
604 (funcall log-operation 610 (funcall log-operation
605 log-fileset 611 log-fileset
606 log-extra 612 log-extra
607 log-entry)) 613 log-entry
614 extra-flags
615 ))
608 ;; Remove checkin window (after the checkin so that if that fails 616 ;; Remove checkin window (after the checkin so that if that fails
609 ;; we don't zap the log buffer and the typing therein). 617 ;; we don't zap the log buffer and the typing therein).
610 ;; -- IMO this should be replaced with quit-window 618 ;; -- IMO this should be replaced with quit-window
611 (cond ((and logbuf vc-delete-logbuf-window) 619 (cond ((and logbuf vc-delete-logbuf-window)
612 (delete-windows-on logbuf (selected-frame)) 620 (delete-windows-on logbuf (selected-frame))