aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog29
-rw-r--r--lisp/vc-cvs.el20
-rw-r--r--lisp/vc-hooks.el67
-rw-r--r--lisp/vc-rcs.el7
-rw-r--r--lisp/vc-sccs.el7
-rw-r--r--lisp/vc-svn.el15
-rw-r--r--lisp/vc.el61
7 files changed, 119 insertions, 87 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 99752b553ad..75b1048baca 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,32 @@
12009-06-22 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
4 Add an optional argument for the backend, use it instead of
5 calling vc-backend.
6 (vc-mode-line): Add an optional argument for the backend. Pass
7 the backend to vc-state and vc-working-revision. Move code for
8 special handling for vc-state being a buffer to ...
9
10 * vc-rcs.el (vc-rcs-find-file-hook):
11 * vc-sccs.el (vc-sccs-find-file-hook): ... here. New functions.
12
13 * vc-svn.el (vc-svn-state, vc-svn-dir-status, vc-svn-checkout)
14 (vc-svn-print-log, vc-svn-diff): Pass 'SVN to vc-state,
15 vc-stay-local-p and vc-mode-line calls.
16
17 * vc-cvs.el (vc-cvs-state, vc-cvs-checkout, vc-cvs-print-log)
18 (vc-cvs-diff, vc-cvs-annotate-command)
19 (vc-cvs-make-version-backups-p, vc-cvs-stay-local-p)
20 (vc-cvs-dir-status): Pass 'CVS to vc-state, vc-stay-local-p and
21 vc-mode-line calls.
22
23 * vc.el (vc-deduce-fileset): Use vc-deduce-fileset instead of
24 direct comparison.
25 (vc-next-action, vc-transfer-file, vc-rename-file): Also pass the
26 backend when calling vc-mode-line.
27 (vc-register): Do not create a closure for calling the vc register
28 function, call it directly.
29
12009-06-23 Dan Nicolaescu <dann@ics.uci.edu> 302009-06-23 Dan Nicolaescu <dann@ics.uci.edu>
2 31
3 * emacs-lisp/elp.el (elp-output-insert-symname): Add a link face 32 * emacs-lisp/elp.el (elp-output-insert-symname): Add a link face
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index 50a4e281d81..c3f94dc2a15 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -216,7 +216,7 @@ See also variable `vc-cvs-sticky-date-format-string'."
216 216
217(defun vc-cvs-state (file) 217(defun vc-cvs-state (file)
218 "CVS-specific version of `vc-state'." 218 "CVS-specific version of `vc-state'."
219 (if (vc-stay-local-p file) 219 (if (vc-stay-local-p file 'CVS)
220 (let ((state (vc-file-getprop file 'vc-state))) 220 (let ((state (vc-file-getprop file 'vc-state)))
221 ;; If we should stay local, use the heuristic but only if 221 ;; If we should stay local, use the heuristic but only if
222 ;; we don't have a more precise state already available. 222 ;; we don't have a more precise state already available.
@@ -402,7 +402,7 @@ REV is the revision to check out."
402 "-A" 402 "-A"
403 (concat "-r" rev)))) 403 (concat "-r" rev))))
404 (vc-switches 'CVS 'checkout))) 404 (vc-switches 'CVS 'checkout)))
405 (vc-mode-line file)) 405 (vc-mode-line file 'CVS))
406 (message "Checking out %s...done" file)) 406 (message "Checking out %s...done" file))
407 407
408(defun vc-cvs-delete-file (file) 408(defun vc-cvs-delete-file (file)
@@ -496,7 +496,7 @@ Will fail unless you have administrative privileges on the repo."
496 ;; It's just the catenation of the individual logs. 496 ;; It's just the catenation of the individual logs.
497 (vc-cvs-command 497 (vc-cvs-command
498 buffer 498 buffer
499 (if (vc-stay-local-p files) 'async 0) 499 (if (vc-stay-local-p files 'CVS) 'async 0)
500 files "log")) 500 files "log"))
501 501
502(defun vc-cvs-comment-history (file) 502(defun vc-cvs-comment-history (file)
@@ -506,7 +506,7 @@ Will fail unless you have administrative privileges on the repo."
506(defun vc-cvs-diff (files &optional oldvers newvers buffer) 506(defun vc-cvs-diff (files &optional oldvers newvers buffer)
507 "Get a difference report using CVS between two revisions of FILE." 507 "Get a difference report using CVS between two revisions of FILE."
508 (let* ((async (and (not vc-disable-async-diff) 508 (let* ((async (and (not vc-disable-async-diff)
509 (vc-stay-local-p files))) 509 (vc-stay-local-p files 'CVS)))
510 (invoke-cvs-diff-list nil) 510 (invoke-cvs-diff-list nil)
511 status) 511 status)
512 ;; Look through the file list and see if any files have backups 512 ;; Look through the file list and see if any files have backups
@@ -559,7 +559,7 @@ Will fail unless you have administrative privileges on the repo."
559 "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER. 559 "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER.
560Optional arg REVISION is a revision to annotate from." 560Optional arg REVISION is a revision to annotate from."
561 (vc-cvs-command buffer 561 (vc-cvs-command buffer
562 (if (vc-stay-local-p file) 562 (if (vc-stay-local-p file 'CVS)
563 'async 0) 563 'async 0)
564 file "annotate" 564 file "annotate"
565 (if revision (concat "-r" revision))) 565 (if revision (concat "-r" revision)))
@@ -681,8 +681,9 @@ If UPDATE is non-nil, then update (resynch) any affected buffers."
681;;; Miscellaneous 681;;; Miscellaneous
682;;; 682;;;
683 683
684(defalias 'vc-cvs-make-version-backups-p 'vc-stay-local-p 684(defun vc-cvs-make-version-backups-p (file)
685 "Return non-nil if version backups should be made for FILE.") 685 "Return non-nil if version backups should be made for FILE."
686 (vc-stay-local-p file 'CVS))
686 687
687(defun vc-cvs-check-headers () 688(defun vc-cvs-check-headers ()
688 "Check if the current file has any headers in it." 689 "Check if the current file has any headers in it."
@@ -706,7 +707,8 @@ and that it passes `vc-cvs-global-switches' to it before FLAGS."
706 (append vc-cvs-global-switches 707 (append vc-cvs-global-switches
707 flags)))) 708 flags))))
708 709
709(defalias 'vc-cvs-stay-local-p 'vc-stay-local-p) ;Back-compatibility. 710(defun vc-cvs-stay-local-p (file) ;Back-compatibility.
711 (vc-stay-local-p file 'CVS))
710 712
711(defun vc-cvs-repository-hostname (dirname) 713(defun vc-cvs-repository-hostname (dirname)
712 "Hostname of the CVS server associated to workarea DIRNAME." 714 "Hostname of the CVS server associated to workarea DIRNAME."
@@ -965,7 +967,7 @@ state."
965(defun vc-cvs-dir-status (dir update-function) 967(defun vc-cvs-dir-status (dir update-function)
966 "Create a list of conses (file . state) for DIR." 968 "Create a list of conses (file . state) for DIR."
967 ;; FIXME check all files in DIR instead? 969 ;; FIXME check all files in DIR instead?
968 (let ((local (vc-stay-local-p dir))) 970 (let ((local (vc-stay-local-p dir 'CVS)))
969 (if (and local (not (eq local 'only-file))) 971 (if (and local (not (eq local 'only-file)))
970 (vc-cvs-dir-status-heuristic dir update-function) 972 (vc-cvs-dir-status-heuristic dir update-function)
971 (vc-cvs-command (current-buffer) 'async dir "-f" "status") 973 (vc-cvs-command (current-buffer) 'async dir "-f" "status")
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index f9a73b21b2e..83d89027f8f 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -168,15 +168,15 @@ by these regular expressions."
168 :version "23.1" 168 :version "23.1"
169 :group 'vc) 169 :group 'vc)
170 170
171(defun vc-stay-local-p (file) 171(defun vc-stay-local-p (file &optional backend)
172 "Return non-nil if VC should stay local when handling FILE. 172 "Return non-nil if VC should stay local when handling FILE.
173This uses the `repository-hostname' backend operation. 173This uses the `repository-hostname' backend operation.
174If FILE is a list of files, return non-nil if any of them 174If FILE is a list of files, return non-nil if any of them
175individually should stay local." 175individually should stay local."
176 (if (listp file) 176 (if (listp file)
177 (delq nil (mapcar 'vc-stay-local-p file)) 177 (delq nil (mapcar (lambda (arg) (vc-stay-local-p arg backend)) file))
178 (let* ((backend (vc-backend file)) 178 (setq backend (or backend (vc-backend file)))
179 (sym (vc-make-backend-sym backend 'stay-local)) 179 (let* ((sym (vc-make-backend-sym backend 'stay-local))
180 (stay-local (if (boundp sym) (symbol-value sym) vc-stay-local))) 180 (stay-local (if (boundp sym) (symbol-value sym) vc-stay-local)))
181 (if (symbolp stay-local) stay-local 181 (if (symbolp stay-local) stay-local
182 (let ((dirname (if (file-directory-p file) 182 (let ((dirname (if (file-directory-p file)
@@ -449,7 +449,7 @@ For registered files, the possible values are:
449 ;; if user-login-name is nil, return the UID as a string 449 ;; if user-login-name is nil, return the UID as a string
450 (number-to-string (user-uid)))) 450 (number-to-string (user-uid))))
451 451
452(defun vc-state (file) 452(defun vc-state (file &optional backend)
453 "Return the version control state of FILE. 453 "Return the version control state of FILE.
454 454
455If FILE is not registered, this function always returns nil. 455If FILE is not registered, this function always returns nil.
@@ -514,11 +514,11 @@ status of this file."
514 ;; - `copied' and `moved' (might be handled by `removed' and `added') 514 ;; - `copied' and `moved' (might be handled by `removed' and `added')
515 (or (vc-file-getprop file 'vc-state) 515 (or (vc-file-getprop file 'vc-state)
516 (when (> (length file) 0) 516 (when (> (length file) 0)
517 (let ((backend (vc-backend file))) 517 (setq backend (or backend (vc-backend file)))
518 (when backend 518 (when backend
519 (vc-file-setprop 519 (vc-file-setprop
520 file 'vc-state 520 file 'vc-state
521 (vc-call-backend backend 'state-heuristic file))))))) 521 (vc-call-backend backend 'state-heuristic file))))))
522 522
523(defsubst vc-up-to-date-p (file) 523(defsubst vc-up-to-date-p (file)
524 "Convenience function that checks whether `vc-state' of FILE is `up-to-date'." 524 "Convenience function that checks whether `vc-state' of FILE is `up-to-date'."
@@ -563,14 +563,15 @@ Return non-nil if FILE is unchanged."
563 (signal (car err) (cdr err)) 563 (signal (car err) (cdr err))
564 (vc-call-backend backend 'diff (list file))))))) 564 (vc-call-backend backend 'diff (list file)))))))
565 565
566(defun vc-working-revision (file) 566(defun vc-working-revision (file &optional backend)
567 "Return the repository version from which FILE was checked out. 567 "Return the repository version from which FILE was checked out.
568If FILE is not registered, this function always returns nil." 568If FILE is not registered, this function always returns nil."
569 (or (vc-file-getprop file 'vc-working-revision) 569 (or (vc-file-getprop file 'vc-working-revision)
570 (let ((backend (vc-backend file))) 570 (progn
571 (when backend 571 (setq backend (or backend (vc-backend file)))
572 (vc-file-setprop file 'vc-working-revision 572 (when backend
573 (vc-call-backend backend 'working-revision file)))))) 573 (vc-file-setprop file 'vc-working-revision
574 (vc-call-backend backend 'working-revision file))))))
574 575
575;; Backward compatibility. 576;; Backward compatibility.
576(define-obsolete-function-alias 577(define-obsolete-function-alias
@@ -741,9 +742,9 @@ Before doing that, check if there are any old backups and get rid of them."
741 (vc-up-to-date-p file) 742 (vc-up-to-date-p file)
742 (eq (vc-checkout-model backend (list file)) 'implicit) 743 (eq (vc-checkout-model backend (list file)) 'implicit)
743 (vc-file-setprop file 'vc-state 'edited) 744 (vc-file-setprop file 'vc-state 'edited)
744 (vc-mode-line file) 745 (vc-mode-line file backend)
745 ;; Try to avoid unnecessary work, a *vc-dir* buffer is only 746 ;; Try to avoid unnecessary work, a *vc-dir* buffer is
746 ;; present if this is true. 747 ;; present if and only if this is true.
747 (when (memq 'vc-dir-resynch-file after-save-hook) 748 (when (memq 'vc-dir-resynch-file after-save-hook)
748 (vc-dir-resynch-file file))))) 749 (vc-dir-resynch-file file)))))
749 750
@@ -787,12 +788,6 @@ If BACKEND is passed use it as the VC backend when computing the result."
787 backend)) 788 backend))
788 "\nmouse-1: Version Control menu") 789 "\nmouse-1: Version Control menu")
789 'local-map vc-mode-line-map))))) 790 'local-map vc-mode-line-map)))))
790 ;; If the file is locked by some other user, make
791 ;; the buffer read-only. Like this, even root
792 ;; cannot modify a file that someone else has locked.
793 (and (equal file buffer-file-name)
794 (stringp (vc-state file))
795 (setq buffer-read-only t))
796 ;; If the user is root, and the file is not owner-writable, 791 ;; If the user is root, and the file is not owner-writable,
797 ;; then pretend that we can't write it 792 ;; then pretend that we can't write it
798 ;; even though we can (because root can write anything). 793 ;; even though we can (because root can write anything).
@@ -814,37 +809,37 @@ Format:
814 \"BACKEND:LOCKER:REV\" if the file is locked by somebody else 809 \"BACKEND:LOCKER:REV\" if the file is locked by somebody else
815 810
816This function assumes that the file is registered." 811This function assumes that the file is registered."
817 (setq backend (symbol-name backend)) 812 (let* ((backend-name (symbol-name backend))
818 (let ((state (vc-state file)) 813 (state (vc-state file backend))
819 (state-echo nil) 814 (state-echo nil)
820 (rev (vc-working-revision file))) 815 (rev (vc-working-revision file backend)))
821 (propertize 816 (propertize
822 (cond ((or (eq state 'up-to-date) 817 (cond ((or (eq state 'up-to-date)
823 (eq state 'needs-update)) 818 (eq state 'needs-update))
824 (setq state-echo "Up to date file") 819 (setq state-echo "Up to date file")
825 (concat backend "-" rev)) 820 (concat backend-name "-" rev))
826 ((stringp state) 821 ((stringp state)
827 (setq state-echo (concat "File locked by" state)) 822 (setq state-echo (concat "File locked by" state))
828 (concat backend ":" state ":" rev)) 823 (concat backend-name ":" state ":" rev))
829 ((eq state 'added) 824 ((eq state 'added)
830 (setq state-echo "Locally added file") 825 (setq state-echo "Locally added file")
831 (concat backend "@" rev)) 826 (concat backend-name "@" rev))
832 ((eq state 'conflict) 827 ((eq state 'conflict)
833 (setq state-echo "File contains conflicts after the last merge") 828 (setq state-echo "File contains conflicts after the last merge")
834 (concat backend "!" rev)) 829 (concat backend-name "!" rev))
835 ((eq state 'removed) 830 ((eq state 'removed)
836 (setq state-echo "File removed from the VC system") 831 (setq state-echo "File removed from the VC system")
837 (concat backend "!" rev)) 832 (concat backend-name "!" rev))
838 ((eq state 'missing) 833 ((eq state 'missing)
839 (setq state-echo "File tracked by the VC system, but missing from the file system") 834 (setq state-echo "File tracked by the VC system, but missing from the file system")
840 (concat backend "?" rev)) 835 (concat backend-name "?" rev))
841 (t 836 (t
842 ;; Not just for the 'edited state, but also a fallback 837 ;; Not just for the 'edited state, but also a fallback
843 ;; for all other states. Think about different symbols 838 ;; for all other states. Think about different symbols
844 ;; for 'needs-update and 'needs-merge. 839 ;; for 'needs-update and 'needs-merge.
845 (setq state-echo "Locally modified file") 840 (setq state-echo "Locally modified file")
846 (concat backend ":" rev))) 841 (concat backend-name ":" rev)))
847 'help-echo (concat state-echo " under the " backend 842 'help-echo (concat state-echo " under the " backend-name
848 " version control system")))) 843 " version control system"))))
849 844
850(defun vc-follow-link () 845(defun vc-follow-link ()
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el
index 5b35ad0e1cc..0a5ebe42eec 100644
--- a/lisp/vc-rcs.el
+++ b/lisp/vc-rcs.el
@@ -828,6 +828,13 @@ systime, or nil if there is none. Also, reposition point."
828 ;; Just move the master file (using vc-rcs-master-templates). 828 ;; Just move the master file (using vc-rcs-master-templates).
829 (vc-rename-master (vc-name old) new vc-rcs-master-templates)) 829 (vc-rename-master (vc-name old) new vc-rcs-master-templates))
830 830
831(defun vc-rcs-find-file-hook ()
832 ;; If the file is locked by some other user, make
833 ;; the buffer read-only. Like this, even root
834 ;; cannot modify a file that someone else has locked.
835 (stringp (vc-state buffer-file-name 'RCS))
836 (setq buffer-read-only t))
837
831 838
832;;; 839;;;
833;;; Internal functions 840;;; Internal functions
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el
index 7628a802677..6e9c2dd3fc6 100644
--- a/lisp/vc-sccs.el
+++ b/lisp/vc-sccs.el
@@ -391,6 +391,13 @@ revert all subfiles."
391 (basic-save-buffer) 391 (basic-save-buffer)
392 (kill-buffer (current-buffer)))) 392 (kill-buffer (current-buffer))))
393 393
394(defun vc-sccs-find-file-hook ()
395 ;; If the file is locked by some other user, make
396 ;; the buffer read-only. Like this, even root
397 ;; cannot modify a file that someone else has locked.
398 (stringp (vc-state buffer-file-name 'SCCS))
399 (setq buffer-read-only t))
400
394 401
395;;; 402;;;
396;;; Internal functions 403;;; Internal functions
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el
index 2d5c239e3b2..830e1582978 100644
--- a/lisp/vc-svn.el
+++ b/lisp/vc-svn.el
@@ -142,7 +142,7 @@ want to force an empty list of arguments, use t."
142 142
143(defun vc-svn-state (file &optional localp) 143(defun vc-svn-state (file &optional localp)
144 "SVN-specific version of `vc-state'." 144 "SVN-specific version of `vc-state'."
145 (setq localp (or localp (vc-stay-local-p file))) 145 (setq localp (or localp (vc-stay-local-p file 'SVN)))
146 (with-temp-buffer 146 (with-temp-buffer
147 (cd (file-name-directory file)) 147 (cd (file-name-directory file))
148 (vc-svn-command t 0 file "status" (if localp "-v" "-u")) 148 (vc-svn-command t 0 file "status" (if localp "-v" "-u"))
@@ -189,7 +189,7 @@ RESULT is a list of conses (FILE . STATE) for directory DIR."
189 ;; calling synchronously (vc-svn-registered DIR) => calling svn status -v DIR 189 ;; calling synchronously (vc-svn-registered DIR) => calling svn status -v DIR
190 ;; which is VERY SLOW for big trees and it makes emacs 190 ;; which is VERY SLOW for big trees and it makes emacs
191 ;; completely unresponsive during that time. 191 ;; completely unresponsive during that time.
192 (let* ((local (and nil (vc-stay-local-p dir))) 192 (let* ((local (and nil (vc-stay-local-p dir 'SVN)))
193 (remote (or t (not local) (eq local 'only-file)))) 193 (remote (or t (not local) (eq local 'only-file))))
194 (vc-svn-command (current-buffer) 'async nil "status" 194 (vc-svn-command (current-buffer) 'async nil "status"
195 (if remote "-u")) 195 (if remote "-u"))
@@ -316,7 +316,7 @@ This is only possible if SVN is responsible for FILE's directory.")
316 (message "Checking out %s..." file) 316 (message "Checking out %s..." file)
317 (with-current-buffer (or (get-file-buffer file) (current-buffer)) 317 (with-current-buffer (or (get-file-buffer file) (current-buffer))
318 (vc-svn-update file editable rev (vc-switches 'SVN 'checkout))) 318 (vc-svn-update file editable rev (vc-switches 'SVN 'checkout)))
319 (vc-mode-line file) 319 (vc-mode-line file 'SVN)
320 (message "Checking out %s...done" file)) 320 (message "Checking out %s...done" file))
321 321
322(defun vc-svn-update (file editable rev switches) 322(defun vc-svn-update (file editable rev switches)
@@ -470,7 +470,7 @@ or svn+ssh://."
470 (vc-svn-command 470 (vc-svn-command
471 buffer 471 buffer
472 'async 472 'async
473 ;; (if (and (= (length files) 1) (vc-stay-local-p file)) 'async 0) 473 ;; (if (and (= (length files) 1) (vc-stay-local-p file 'SVN)) 'async 0)
474 (list file) 474 (list file)
475 "log" 475 "log"
476 ;; By default Subversion only shows the log up to the 476 ;; By default Subversion only shows the log up to the
@@ -502,7 +502,7 @@ or svn+ssh://."
502 (list "--diff-cmd=diff" "-x" 502 (list "--diff-cmd=diff" "-x"
503 (mapconcat 'identity (vc-switches nil 'diff) " ")))) 503 (mapconcat 'identity (vc-switches nil 'diff) " "))))
504 (async (and (not vc-disable-async-diff) 504 (async (and (not vc-disable-async-diff)
505 (vc-stay-local-p files) 505 (vc-stay-local-p files 'SVN)
506 (or oldvers newvers)))) ; Svn diffs those locally. 506 (or oldvers newvers)))) ; Svn diffs those locally.
507 (apply 'vc-svn-command buffer 507 (apply 'vc-svn-command buffer
508 (if async 'async 0) 508 (if async 'async 0)
@@ -543,8 +543,9 @@ NAME is assumed to be a URL."
543;;; 543;;;
544 544
545;; Subversion makes backups for us, so don't bother. 545;; Subversion makes backups for us, so don't bother.
546;; (defalias 'vc-svn-make-version-backups-p 'vc-stay-local-p 546;; (defun vc-svn-make-version-backups-p (file)
547;; "Return non-nil if version backups should be made for FILE.") 547;; "Return non-nil if version backups should be made for FILE."
548;; (vc-stay-local-p file 'SVN))
548 549
549(defun vc-svn-check-headers () 550(defun vc-svn-check-headers ()
550 "Check if the current file has any headers in it." 551 "Check if the current file has any headers in it."
diff --git a/lisp/vc.el b/lisp/vc.el
index 3e8cdeeb585..a14e95f7b42 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -600,11 +600,6 @@
600;; the two branches. Or you locally add file FOO and then pull a 600;; the two branches. Or you locally add file FOO and then pull a
601;; change that also adds a new file FOO, ... 601;; change that also adds a new file FOO, ...
602;; 602;;
603;; - The use of vc-start-logentry in vc-register should be removed.
604;; It's a remnant from old times when vc-register had an opportunity
605;; to provide a message linked to the file's addition, but nowadays
606;; it's just extra baggage that makes the code less readable.
607;;
608;; - make it easier to write logs. Maybe C-x 4 a should add to the log 603;; - make it easier to write logs. Maybe C-x 4 a should add to the log
609;; buffer, if one is present, instead of adding to the ChangeLog. 604;; buffer, if one is present, instead of adding to the ChangeLog.
610;; 605;;
@@ -934,7 +929,7 @@ current buffer."
934 ;; FIXME: Why this test? --Stef 929 ;; FIXME: Why this test? --Stef
935 (or (buffer-file-name vc-parent-buffer) 930 (or (buffer-file-name vc-parent-buffer)
936 (with-current-buffer vc-parent-buffer 931 (with-current-buffer vc-parent-buffer
937 (eq major-mode 'vc-dir-mode)))) 932 (derived-mode-p 'vc-dir-mode))))
938 (progn ;FIXME: Why not `with-current-buffer'? --Stef. 933 (progn ;FIXME: Why not `with-current-buffer'? --Stef.
939 (set-buffer vc-parent-buffer) 934 (set-buffer vc-parent-buffer)
940 (vc-deduce-fileset observer allow-unregistered state-model-only-files))) 935 (vc-deduce-fileset observer allow-unregistered state-model-only-files)))
@@ -1172,7 +1167,7 @@ merge in the changes into your working copy."
1172 ;; show that the file is locked now. 1167 ;; show that the file is locked now.
1173 (vc-clear-headers file) 1168 (vc-clear-headers file)
1174 (write-file buffer-file-name) 1169 (write-file buffer-file-name)
1175 (vc-mode-line file)) 1170 (vc-mode-line file backend))
1176 (if (not (yes-or-no-p 1171 (if (not (yes-or-no-p
1177 "Revert to checked-in revision, instead? ")) 1172 "Revert to checked-in revision, instead? "))
1178 (error "Checkout aborted") 1173 (error "Checkout aborted")
@@ -1232,31 +1227,28 @@ first backend that could register the file is used."
1232 (not (file-exists-p buffer-file-name))) 1227 (not (file-exists-p buffer-file-name)))
1233 (set-buffer-modified-p t)) 1228 (set-buffer-modified-p t))
1234 (vc-buffer-sync))))) 1229 (vc-buffer-sync)))))
1235 (lexical-let ((backend backend) 1230 (message "Registering %s... " files)
1236 (files files)) 1231 (mapc 'vc-file-clearprops files)
1237 (vc-start-logentry 1232 (vc-call-backend backend 'register files
1238 files 1233 (if set-revision
1239 (if set-revision 1234 (read-string (format "Initial revision level for %s: " files))
1240 (read-string (format "Initial revision level for %s: " files)) 1235 (vc-call-backend backend 'init-revision))
1241 (vc-call-backend backend 'init-revision)) 1236 comment)
1242 (or comment (not vc-initial-comment)) 1237 (mapc
1243 nil 1238 (lambda (file)
1244 "Enter initial comment." 1239 (vc-file-setprop file 'vc-backend backend)
1245 "*VC-log*" 1240 ;; FIXME: This is wrong: it should set `backup-inhibited' in all
1246 (lambda (files rev comment) 1241 ;; the buffers visiting files affected by this `vc-register', not
1247 (message "Registering %s... " files) 1242 ;; in the current-buffer.
1248 (mapc 'vc-file-clearprops files) 1243 ;; (unless vc-make-backup-files
1249 (vc-call-backend backend 'register files rev comment) 1244 ;; (make-local-variable 'backup-inhibited)
1250 (dolist (file files) 1245 ;; (setq backup-inhibited t))
1251 (vc-file-setprop file 'vc-backend backend) 1246
1252 ;; FIXME: This is wrong: it should set `backup-inhibited' in all 1247 (vc-resynch-buffer file vc-keep-workfiles t))
1253 ;; the buffers visiting files affected by this `vc-register', not 1248 files)
1254 ;; in the current-buffer. 1249 (when (derived-mode-p 'vc-dir-mode)
1255 ;; (unless vc-make-backup-files 1250 (vc-dir-move-to-goal-column))
1256 ;; (make-local-variable 'backup-inhibited) 1251 (message "Registering %s... done" files)))
1257 ;; (setq backup-inhibited t))
1258 )
1259 (message "Registering %s... done" files))))))
1260 1252
1261(defun vc-register-with (backend) 1253(defun vc-register-with (backend)
1262 "Register the current file with a specified back end." 1254 "Register the current file with a specified back end."
@@ -2108,7 +2100,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
2108 (vc-switch-backend file new-backend) 2100 (vc-switch-backend file new-backend)
2109 (when (or move edited) 2101 (when (or move edited)
2110 (vc-file-setprop file 'vc-state 'edited) 2102 (vc-file-setprop file 'vc-state 'edited)
2111 (vc-mode-line file) 2103 (vc-mode-line file new-backend)
2112 (vc-checkin file new-backend nil comment (stringp comment))))) 2104 (vc-checkin file new-backend nil comment (stringp comment)))))
2113 2105
2114(defun vc-rename-master (oldmaster newfile templates) 2106(defun vc-rename-master (oldmaster newfile templates)
@@ -2208,8 +2200,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
2208 (with-current-buffer oldbuf 2200 (with-current-buffer oldbuf
2209 (let ((buffer-read-only buffer-read-only)) 2201 (let ((buffer-read-only buffer-read-only))
2210 (set-visited-file-name new)) 2202 (set-visited-file-name new))
2211 (vc-backend new) 2203 (vc-mode-line new (vc-backend new))
2212 (vc-mode-line new)
2213 (set-buffer-modified-p nil))))) 2204 (set-buffer-modified-p nil)))))
2214 2205
2215;;;###autoload 2206;;;###autoload