Confine vc-stay-local to CVS, because it was unusable in SVN.

This commit is contained in:
Eric S. Raymond 2014-12-01 10:11:42 -05:00
parent c108372525
commit 2a81c5d94d
3 changed files with 1 additions and 83 deletions

View file

@ -170,64 +170,6 @@ control systems."
:type 'boolean
:group 'vc)
(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.
If value is the symbol `only-file', `vc-dir' will connect to the
server, but heuristics will be used to determine the status for
all other VC operations.
The value can also be a regular expression or list of regular
expressions to match against the host name of a repository; then VC
only stays local for hosts that match it. Alternatively, the value
can be a list of regular expressions where the first element is the
symbol `except'; then VC always stays local except for hosts matched
by these regular expressions."
:type '(choice
(const :tag "Always stay local" t)
(const :tag "Only for file operations" only-file)
(const :tag "Don't stay local" nil)
(list :format "\nExamine hostname and %v" :tag "Examine hostname ..."
(set :format "%v" :inline t (const :format "%t" :tag "don't" except))
(regexp :format " stay local,\n%t: %v" :tag "if it matches")
(repeat :format "%v%i\n" :inline t (regexp :tag "or"))))
:version "23.1"
:group 'vc)
(defun vc-stay-local-p (file &optional backend)
"Return non-nil if VC should stay local when handling FILE.
This uses the `repository-hostname' backend operation.
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-stay-local-p arg backend)) file))
(setq backend (or backend (vc-backend file)))
(let* ((sym (vc-make-backend-sym backend '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-stay-local-p)
(vc-file-setprop
dirname 'vc-stay-local-p
(let ((hostname (vc-call-backend
backend '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))))))))))))
;;; This is handled specially now.
;; Tell Emacs about this new kind of minor mode
;; (add-to-list 'minor-mode-alist '(vc-mode vc-mode))

View file

@ -511,7 +511,6 @@ If LIMIT is non-nil, show no more than this many entries."
'vc-svn-command
buffer
'async
;; (if (and (= (length files) 1) (vc-stay-local-p file 'SVN)) 'async 0)
(list file)
"log"
(append
@ -552,7 +551,6 @@ If LIMIT is non-nil, show no more than this many entries."
(list (concat "--diff-cmd=" diff-command) "-x"
(mapconcat 'identity (vc-switches nil 'diff) " "))))
(async (and (not vc-disable-async-diff)
(vc-stay-local-p files 'SVN)
(or oldvers newvers)))) ; Svn diffs those locally.
(apply 'vc-svn-command buffer
(if async 'async 0)
@ -595,7 +593,7 @@ NAME is assumed to be a URL."
;; Subversion makes backups for us, so don't bother.
;; (defun vc-svn-make-version-backups-p (file)
;; "Return non-nil if version backups should be made for FILE."
;; (vc-stay-local-p file 'SVN))
;; nil)
(defun vc-svn-check-headers ()
"Check if the current file has any headers in it."
@ -618,17 +616,6 @@ and that it passes `vc-svn-global-switches' to it before FLAGS."
(cons vc-svn-global-switches flags)
(append vc-svn-global-switches flags))))
(defun vc-svn-repository-hostname (dirname)
(with-temp-buffer
(let (process-file-side-effects)
(vc-svn-command t t dirname "info" "--xml"))
(goto-char (point-min))
(when (re-search-forward "<url>\\(.*\\)</url>" nil t)
;; This is not a hostname but a URL. This may actually be considered
;; as a feature since it allows vc-svn-stay-local to specify different
;; behavior for different modules on the same server.
(match-string 1))))
(defun vc-svn-resolve-when-done ()
"Call \"svn resolved\" if the conflict markers have been removed."
(save-excursion

View file

@ -481,14 +481,6 @@
;;
;; Return the root of the VC controlled hierarchy for file.
;;
;; - repository-hostname (dirname)
;;
;; Return the hostname that the backend will have to contact
;; in order to operate on a file in DIRNAME. If the return value
;; is nil, it means that the repository is local.
;; This function is used in `vc-stay-local-p' which backends can use
;; for their convenience.
;;
;; - ignore (file &optional directory)
;;
;; Ignore FILE under the VCS of DIRECTORY (default is `default-directory').
@ -630,9 +622,6 @@
;;
;;;; Internal cleanups:
;;
;; - backends that care about vc-stay-local should try to take it into
;; account for vc-dir. Is this likely to be useful??? YES!
;;
;; - vc-expand-dirs should take a backend parameter and only look for
;; files managed by that backend.
;;