comparison lisp/packages/vc.el @ 30:ec9a17fef872 r19-15b98

Import from CVS: tag r19-15b98
author cvs
date Mon, 13 Aug 2007 08:52:29 +0200
parents 4103f0995bd7
children e04119814345
comparison
equal deleted inserted replaced
29:7976500f47f9 30:ec9a17fef872
120 120
121 ;;;###autoload 121 ;;;###autoload
122 (defvar vc-checkin-hook nil 122 (defvar vc-checkin-hook nil
123 "*List of functions called after a checkin is done. See `run-hooks'.") 123 "*List of functions called after a checkin is done. See `run-hooks'.")
124 124
125 ;;;###autoload
126 (defvar vc-before-checkin-hook nil
127 "*List of functions called before a checkin is done. See `run-hooks'.")
128
125 (defvar vc-make-buffer-writable-hook nil 129 (defvar vc-make-buffer-writable-hook nil
126 "*List of functions called when a buffer is made writable. See `run-hooks.' 130 "*List of functions called when a buffer is made writable. See `run-hooks.'
127 This hook is only used when the version control system is CVS. It 131 This hook is only used when the version control system is CVS. It
128 might be useful for sites who uses locking with CVS, or who uses link 132 might be useful for sites who uses locking with CVS, or who uses link
129 farms to gold trees.") 133 farms to gold trees.")
679 (vc-mode-line buffer-file-name)) 683 (vc-mode-line buffer-file-name))
680 (progn 684 (progn
681 (delete-window) 685 (delete-window)
682 (kill-buffer (current-buffer)))))) 686 (kill-buffer (current-buffer))))))
683 687
684 (defun vc-start-entry (file rev comment msg action &optional after-hook) 688 (defun vc-start-entry (file rev comment msg action &optional after-hook before-hook)
685 ;; Accept a comment for an operation on FILE revision REV. If COMMENT 689 ;; Accept a comment for an operation on FILE revision REV. If COMMENT
686 ;; is nil, pop up a VC-log buffer, emit MSG, and set the 690 ;; is nil, pop up a VC-log buffer, emit MSG, and set the
687 ;; action on close to ACTION; otherwise, do action immediately. 691 ;; action on close to ACTION; otherwise, do action immediately.
688 ;; Remember the file's buffer in vc-parent-buffer (current one if no file). 692 ;; Remember the file's buffer in vc-parent-buffer (current one if no file).
689 ;; AFTER-HOOK specifies the local value for vc-log-operation-hook. 693 ;; AFTER-HOOK specifies the local value for vc-log-operation-hook.
694 ;; BEFORE-HOOK specifies a hook to run before even asking for the
695 ;; checkin comments.
690 (let ((parent (if file (find-file-noselect file) (current-buffer)))) 696 (let ((parent (if file (find-file-noselect file) (current-buffer))))
697 (when before-hook
698 (save-excursion
699 (set-buffer parent)
700 (run-hooks before-hook)))
691 (if comment 701 (if comment
692 (set-buffer (get-buffer-create "*VC-log*")) 702 (set-buffer (get-buffer-create "*VC-log*"))
693 (pop-to-buffer (get-buffer-create "*VC-log*"))) 703 (pop-to-buffer (get-buffer-create "*VC-log*")))
694 (set (make-local-variable 'vc-parent-buffer) parent) 704 (set (make-local-variable 'vc-parent-buffer) parent)
695 (set (make-local-variable 'vc-parent-buffer-name) 705 (set (make-local-variable 'vc-parent-buffer-name)
716 FILE is the unmodified name of the file. REV should be the base version 726 FILE is the unmodified name of the file. REV should be the base version
717 level to check it in under. COMMENT, if specified, is the checkin comment." 727 level to check it in under. COMMENT, if specified, is the checkin comment."
718 (vc-start-entry file rev 728 (vc-start-entry file rev
719 (or comment (not vc-initial-comment)) 729 (or comment (not vc-initial-comment))
720 "Enter initial comment." 'vc-backend-admin 730 "Enter initial comment." 'vc-backend-admin
721 nil)) 731 nil 'vc-before-checkin-hook))
722 732
723 (defun vc-checkout (file &optional writable) 733 (defun vc-checkout (file &optional writable)
724 "Retrieve a copy of the latest version of the given file." 734 "Retrieve a copy of the latest version of the given file."
725 ;; XEmacs - ftp is suppressed by the check for a filename handler in 735 ;; XEmacs - ftp is suppressed by the check for a filename handler in
726 ;; vc-registered, so this is needless surplussage 736 ;; vc-registered, so this is needless surplussage
774 If the back-end is CVS, a writable workfile is always kept. 784 If the back-end is CVS, a writable workfile is always kept.
775 COMMENT is a comment string; if omitted, a buffer is 785 COMMENT is a comment string; if omitted, a buffer is
776 popped up to accept a comment." 786 popped up to accept a comment."
777 (vc-start-entry file rev comment 787 (vc-start-entry file rev comment
778 "Enter a change comment." 'vc-backend-checkin 788 "Enter a change comment." 'vc-backend-checkin
779 'vc-checkin-hook)) 789 'vc-checkin-hook 'vc-before-checkin-hook))
780 790
781 ;;; Here is a checkin hook that may prove useful to sites using the 791 ;;; Here is a checkin hook that may prove useful to sites using the
782 ;;; ChangeLog facility supported by Emacs. 792 ;;; ChangeLog facility supported by Emacs.
783 (defun vc-comment-to-change-log (&optional whoami file-name) 793 (defun vc-comment-to-change-log (&optional whoami file-name)
784 "Enter last VC comment into change log file for current buffer's file. 794 "Enter last VC comment into change log file for current buffer's file.