From: Eric S. Raymond Date: Mon, 1 Dec 2014 15:47:27 +0000 (-0500) Subject: Finish vc-stay-local containment. X-Git-Tag: emacs-25.0.90~2635^2~255 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=185320a5fe050da1058181503952b55e581d674b;p=emacs.git Finish vc-stay-local containment. * vc/vc.el, vc-hooks.el, and all backends: API simplification; vc-stay-local-p and repository-hostname are no longer public methods. Only the CVS and SVN backends used these, and the SVN support was conditioned out because svn status -v is too slow. The CVS back end retaiin this machibery and the vc-stay-local configuration variable now only affects it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 41b3ddbc3aa..0ec62db5010 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-12-01 Eric S. Raymond + + * vc/vc.el, vc-hooks.el, and all backends: API simplification; + vc-stay-local-p and repository-hostname are no longer public + methods. Only the CVS and SVN backends used these, and the SVN + support was conditioned out because svn status -v is too slow. + The CVS back end retaiin this machibery and the vc-stay-local + configuration variable now only affects it. + 2014-12-01 Stefan Monnier * emacs-lisp/inline.el: New file. diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 28da328db71..a09909a8353 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -110,7 +110,7 @@ This is only meaningful if you don't use the implicit checkout model :version "21.1" :group 'vc-cvs) -(defcustom vc-cvs-stay-local 'only-file +(defcustom vc-stay-local 'only-file "Non-nil means use local operations when possible for remote repositories. This avoids slow queries over the network and instead uses heuristics and past information to determine the current status of a file. @@ -222,7 +222,7 @@ See also variable `vc-cvs-sticky-date-format-string'." (defun vc-cvs-state (file) "CVS-specific version of `vc-state'." - (if (vc-stay-local-p file 'CVS) + (if (vc-cvs-stay-local-p file) (let ((state (vc-file-getprop file 'vc-state))) ;; If we should stay local, use the heuristic but only if ;; we don't have a more precise state already available. @@ -527,7 +527,7 @@ Remaining arguments are ignored." ;; It's just the catenation of the individual logs. (vc-cvs-command buffer - (if (vc-stay-local-p files 'CVS) 'async 0) + (if (vc-cvs-stay-local-p files) 'async 0) files "log") (with-current-buffer buffer (vc-run-delayed (vc-rcs-print-log-cleanup))) @@ -544,7 +544,7 @@ Remaining arguments are ignored." "Get a difference report using CVS between two revisions of FILE." (let* (process-file-side-effects (async (and (not vc-disable-async-diff) - (vc-stay-local-p files 'CVS))) + (vc-cvs-stay-local-p files))) (invoke-cvs-diff-list nil) status) ;; Look through the file list and see if any files have backups @@ -596,7 +596,7 @@ Remaining arguments are ignored." "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER. Optional arg REVISION is a revision to annotate from." (vc-cvs-command buffer - (if (vc-stay-local-p file 'CVS) + (if (vc-cvs-stay-local-p file) 'async 0) file "annotate" (if revision (concat "-r" revision))) @@ -733,7 +733,7 @@ If UPDATE is non-nil, then update (resynch) any affected buffers." (defun vc-cvs-make-version-backups-p (file) "Return non-nil if version backups should be made for FILE." - (vc-stay-local-p file 'CVS)) + (vc-cvs-stay-local-p file)) (defun vc-cvs-check-headers () "Check if the current file has any headers in it." @@ -757,8 +757,34 @@ and that it passes `vc-cvs-global-switches' to it before FLAGS." (append vc-cvs-global-switches flags)))) -(defun vc-cvs-stay-local-p (file) ;Back-compatibility. - (vc-stay-local-p file 'CVS)) +(defun vc-cvs-stay-local-p (file) + "Return non-nil if VC should stay local when handling FILE. +If FILE is a list of files, return non-nil if any of them +individually should stay local." + (if (listp file) + (delq nil (mapcar (lambda (arg) (vc-cvs-stay-local-p arg)) file)) + (let* ((sym (vc-make-backend-sym 'CVS 'stay-local)) + (stay-local (if (boundp sym) (symbol-value sym) vc-stay-local))) + (if (symbolp stay-local) stay-local + (let ((dirname (if (file-directory-p file) + (directory-file-name file) + (file-name-directory file)))) + (eq 'yes + (or (vc-file-getprop dirname 'vc-cvs-stay-local-p) + (vc-file-setprop + dirname 'vc-cvs-stay-local-p + (let ((hostname (vc-cvs-repository-hostname dirname))) + (if (not hostname) + 'no + (let ((default t)) + (if (eq (car-safe stay-local) 'except) + (setq default nil stay-local (cdr stay-local))) + (when (consp stay-local) + (setq stay-local + (mapconcat 'identity stay-local "\\|"))) + (if (if (string-match stay-local hostname) + default (not default)) + 'yes 'no)))))))))))) (defun vc-cvs-repository-hostname (dirname) "Hostname of the CVS server associated to workarea DIRNAME." @@ -1018,7 +1044,7 @@ state." (defun vc-cvs-dir-status (dir update-function) "Create a list of conses (file . state) for DIR." ;; FIXME check all files in DIR instead? - (let ((local (vc-stay-local-p dir 'CVS))) + (let ((local (vc-cvs-stay-local-p dir))) (if (and local (not (eq local 'only-file))) (vc-cvs-dir-status-heuristic dir update-function) (vc-cvs-command (current-buffer) 'async dir "-f" "status") diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 55bae67c4d6..6d45f7fdb0d 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -581,6 +581,10 @@ ;; CVS leaves no alternative (which was not gated by this variable). The ;; only affected back ends were SCCS and RCS. ;; +;; - vc-stay-local-p and repository-hostname are no longer part +;; of the public API. The vc-stay-local configuration variable +;; remains but only affects the CVS back end. +;; ;; - The init-revision function and the default-initial-revision ;; variable are gone. These have't made sense on anything shipped ;; since RCS, and using them was a dumb stunt even on RCS.