comparison lisp/packages/vc.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 56c54cf7c5b6
children 54cc21c15cbb
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
112 112
113 (defconst vc-maximum-comment-ring-size 32 113 (defconst vc-maximum-comment-ring-size 32
114 "Maximum number of saved comments in the comment ring.") 114 "Maximum number of saved comments in the comment ring.")
115 115
116 ;;; XEmacs - This is dumped into loaddefs.el already. 116 ;;; XEmacs - This is dumped into loaddefs.el already.
117 ;(defvar diff-switches "-c" 117 ;; (defvar diff-switches "-c"
118 ; "*A string or list of strings specifying switches to be passed to diff.") 118 ;; "*A string or list of strings specifying switches to be passed to diff.")
119 119
120 ;;;###autoload 120 ;;;###autoload
121 (defvar vc-checkin-hook nil 121 (defvar vc-checkin-hook nil
122 "*List of functions called after a checkin is done. See `run-hooks'.") 122 "*List of functions called after a checkin is done. See `run-hooks'.")
123
124 ;;;###autoload
125 (defvar vc-before-checkin-hook nil
126 "*List of functions called before a checkin is done. See `run-hooks'.")
127 123
128 (defvar vc-make-buffer-writable-hook nil 124 (defvar vc-make-buffer-writable-hook nil
129 "*List of functions called when a buffer is made writable. See `run-hooks.' 125 "*List of functions called when a buffer is made writable. See `run-hooks.'
130 This hook is only used when the version control system is CVS. It 126 This hook is only used when the version control system is CVS. It
131 might be useful for sites who uses locking with CVS, or who uses link 127 might be useful for sites who uses locking with CVS, or who uses link
682 (vc-mode-line buffer-file-name)) 678 (vc-mode-line buffer-file-name))
683 (progn 679 (progn
684 (delete-window) 680 (delete-window)
685 (kill-buffer (current-buffer)))))) 681 (kill-buffer (current-buffer))))))
686 682
687 (defun vc-start-entry (file rev comment msg action &optional after-hook before-hook) 683 (defun vc-start-entry (file rev comment msg action &optional after-hook)
688 ;; Accept a comment for an operation on FILE revision REV. If COMMENT 684 ;; Accept a comment for an operation on FILE revision REV. If COMMENT
689 ;; is nil, pop up a VC-log buffer, emit MSG, and set the 685 ;; is nil, pop up a VC-log buffer, emit MSG, and set the
690 ;; action on close to ACTION; otherwise, do action immediately. 686 ;; action on close to ACTION; otherwise, do action immediately.
691 ;; Remember the file's buffer in vc-parent-buffer (current one if no file). 687 ;; Remember the file's buffer in vc-parent-buffer (current one if no file).
692 ;; AFTER-HOOK specifies the local value for vc-log-operation-hook. 688 ;; AFTER-HOOK specifies the local value for vc-log-operation-hook.
693 ;; BEFORE-HOOK specifies a hook to run before even asking for the
694 ;; checkin comments.
695 (let ((parent (if file (find-file-noselect file) (current-buffer)))) 689 (let ((parent (if file (find-file-noselect file) (current-buffer))))
696 (when before-hook
697 (save-excursion
698 (set-buffer parent)
699 (run-hooks before-hook)))
700 (if comment 690 (if comment
701 (set-buffer (get-buffer-create "*VC-log*")) 691 (set-buffer (get-buffer-create "*VC-log*"))
702 (pop-to-buffer (get-buffer-create "*VC-log*"))) 692 (pop-to-buffer (get-buffer-create "*VC-log*")))
703 (set (make-local-variable 'vc-parent-buffer) parent) 693 (set (make-local-variable 'vc-parent-buffer) parent)
704 (set (make-local-variable 'vc-parent-buffer-name) 694 (set (make-local-variable 'vc-parent-buffer-name)
725 FILE is the unmodified name of the file. REV should be the base version 715 FILE is the unmodified name of the file. REV should be the base version
726 level to check it in under. COMMENT, if specified, is the checkin comment." 716 level to check it in under. COMMENT, if specified, is the checkin comment."
727 (vc-start-entry file rev 717 (vc-start-entry file rev
728 (or comment (not vc-initial-comment)) 718 (or comment (not vc-initial-comment))
729 "Enter initial comment." 'vc-backend-admin 719 "Enter initial comment." 'vc-backend-admin
730 nil 'vc-before-checkin-hook)) 720 nil))
731 721
732 (defun vc-checkout (file &optional writable) 722 (defun vc-checkout (file &optional writable)
733 "Retrieve a copy of the latest version of the given file." 723 "Retrieve a copy of the latest version of the given file."
734 ;; XEmacs - ftp is suppressed by the check for a filename handler in 724 ;; XEmacs - ftp is suppressed by the check for a filename handler in
735 ;; vc-registered, so this is needless surplussage 725 ;; vc-registered, so this is needless surplussage
783 If the back-end is CVS, a writable workfile is always kept. 773 If the back-end is CVS, a writable workfile is always kept.
784 COMMENT is a comment string; if omitted, a buffer is 774 COMMENT is a comment string; if omitted, a buffer is
785 popped up to accept a comment." 775 popped up to accept a comment."
786 (vc-start-entry file rev comment 776 (vc-start-entry file rev comment
787 "Enter a change comment." 'vc-backend-checkin 777 "Enter a change comment." 'vc-backend-checkin
788 'vc-checkin-hook 'vc-before-checkin-hook)) 778 'vc-checkin-hook))
789 779
790 ;;; Here is a checkin hook that may prove useful to sites using the 780 ;;; Here is a checkin hook that may prove useful to sites using the
791 ;;; ChangeLog facility supported by Emacs. 781 ;;; ChangeLog facility supported by Emacs.
792 (defun vc-comment-to-change-log (&optional whoami file-name) 782 (defun vc-comment-to-change-log (&optional whoami file-name)
793 "Enter last VC comment into change log file for current buffer's file. 783 "Enter last VC comment into change log file for current buffer's file.
1158 (let ((default-directory dir)) 1148 (let ((default-directory dir))
1159 (if nested 1149 (if nested
1160 (vc-file-tree-walk subfunction) 1150 (vc-file-tree-walk subfunction)
1161 (vc-dir-all-files subfunction))) 1151 (vc-dir-all-files subfunction)))
1162 (save-excursion 1152 (save-excursion
1163 (dired (cons dir (nreverse filelist)) 1153 (dired (make-string-stringlist (cons dir (nreverse filelist)))
1164 dired-listing-switches) 1154 dired-listing-switches)
1165 (rename-buffer (generate-new-buffer-name "VC-DIRED")) 1155 (rename-buffer (generate-new-buffer-name "VC-DIRED"))
1166 (setq dired-buf (current-buffer)) 1156 (setq dired-buf (current-buffer))
1167 (setq nonempty (not (zerop (buffer-size))))) 1157 (setq nonempty (not (zerop (buffer-size)))))
1168 (if nonempty 1158 (if nonempty
1169 (progn 1159 (progn
1422 nil ;RCS 1412 nil ;RCS
1423 nil ;CVS 1413 nil ;CVS
1424 nil ;CC 1414 nil ;CC
1425 ) 1415 )
1426 ) 1416 )
1427
1428 ;;;###autoload
1429 (defun vc-rename-this-file (new)
1430 (interactive "FVC rename file to: ")
1431 (vc-rename-file buffer-file-name new))
1432 1417
1433 ;;;###autoload 1418 ;;;###autoload
1434 (defun vc-update-change-log (&rest args) 1419 (defun vc-update-change-log (&rest args)
1435 "Find change log file and add entries from recent RCS logs. 1420 "Find change log file and add entries from recent RCS logs.
1436 The mark is left at the end of the text prepended to the change log. 1421 The mark is left at the end of the text prepended to the change log.
2028 ;; Print change log associated with FILE to buffer *vc*. 2013 ;; Print change log associated with FILE to buffer *vc*.
2029 (vc-backend-dispatch 2014 (vc-backend-dispatch
2030 file 2015 file
2031 (vc-do-command 0 "prs" file 'MASTER) 2016 (vc-do-command 0 "prs" file 'MASTER)
2032 (vc-do-command 0 "rlog" file 'MASTER) 2017 (vc-do-command 0 "rlog" file 'MASTER)
2033 (vc-do-command 0 "cvs" file 'WORKFILE "log") 2018 (vc-do-command 0 "cvs" file 'WORKFILE "rlog")
2034 (vc-do-command 0 "cleartool" file 'WORKFILE "lshistory"))) 2019 (vc-do-command 0 "cleartool" file 'WORKFILE "lshistory")))
2035 2020
2036 (defun vc-backend-assign-name (file name) 2021 (defun vc-backend-assign-name (file name)
2037 ;; Assign to a FILE's latest version a given NAME. 2022 ;; Assign to a FILE's latest version a given NAME.
2038 (vc-backend-dispatch file 2023 (vc-backend-dispatch file