comparison lisp/vc-svn.el @ 103553:af4ee0cb7fb7

* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision): Add an optional argument for the backend, use it instead of calling vc-backend. (vc-mode-line): Add an optional argument for the backend. Pass the backend to vc-state and vc-working-revision. Move code for special handling for vc-state being a buffer to ... * vc-rcs.el (vc-rcs-find-file-hook): * vc-sccs.el (vc-sccs-find-file-hook): ... here. New functions. * vc-svn.el (vc-svn-state, vc-svn-dir-status, vc-svn-checkout) (vc-svn-print-log, vc-svn-diff): Pass 'SVN to vc-state, vc-stay-local-p and vc-mode-line calls. * vc-cvs.el (vc-cvs-state, vc-cvs-checkout, vc-cvs-print-log) (vc-cvs-diff, vc-cvs-annotate-command) (vc-cvs-make-version-backups-p, vc-cvs-stay-local-p) (vc-cvs-dir-status): Pass 'CVS to vc-state, vc-stay-local-p and vc-mode-line calls. * vc.el (vc-deduce-fileset): Use vc-deduce-fileset instead of direct comparison. (vc-next-action, vc-transfer-file, vc-rename-file): Also pass the backend when calling vc-mode-line. (vc-register): Do not create a closure for calling the vc register function, call it directly.
author Dan Nicolaescu <dann@ics.uci.edu>
date Tue, 23 Jun 2009 06:35:40 +0000
parents 276b0724ed86
children 2209bd027daa
comparison
equal deleted inserted replaced
103552:0d7c31bf0a29 103553:af4ee0cb7fb7
140 (let ((parsed (vc-svn-parse-status file))) 140 (let ((parsed (vc-svn-parse-status file)))
141 (and parsed (not (memq parsed '(ignored unregistered)))))))))) 141 (and parsed (not (memq parsed '(ignored unregistered))))))))))
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"))
149 (vc-svn-parse-status file))) 149 (vc-svn-parse-status file)))
150 150
187 ;; FIXME should this rather be all the files in dir? 187 ;; FIXME should this rather be all the files in dir?
188 ;; FIXME: the vc-stay-local-p logic below is disabled, it ends up 188 ;; FIXME: the vc-stay-local-p logic below is disabled, it ends up
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"))
196 (vc-exec-after 196 (vc-exec-after
197 `(vc-svn-after-dir-status (quote ,callback) ,remote)))) 197 `(vc-svn-after-dir-status (quote ,callback) ,remote))))
314 314
315 (defun vc-svn-checkout (file &optional editable rev) 315 (defun vc-svn-checkout (file &optional editable rev)
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)
323 (if (and (file-exists-p file) (not rev)) 323 (if (and (file-exists-p file) (not rev))
324 ;; If no revision was specified, there's nothing to do. 324 ;; If no revision was specified, there's nothing to do.
468 (dolist (file files) 468 (dolist (file files)
469 (insert "Working file: " file "\n") 469 (insert "Working file: " file "\n")
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
477 ;; working revision, whereas we also want the log of the 477 ;; working revision, whereas we also want the log of the
478 ;; subsequent commits. At least that's what the 478 ;; subsequent commits. At least that's what the
500 (if vc-svn-diff-switches 500 (if vc-svn-diff-switches
501 (vc-switches 'SVN 'diff) 501 (vc-switches 'SVN 'diff)
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)
509 files "diff" 509 files "diff"
510 (append 510 (append
541 ;;; 541 ;;;
542 ;;; Miscellaneous 542 ;;; Miscellaneous
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."
551 (save-excursion 552 (save-excursion
552 (goto-char (point-min)) 553 (goto-char (point-min))