aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2014-12-01 10:11:42 -0500
committerEric S. Raymond2014-12-01 10:11:42 -0500
commit2a81c5d94d4f01b8d23ffb52871e5ab1e863e09e (patch)
treea056a430e6cbd57099eb1c8d16d02a0d02f5ac84
parentc1083725258be6b4e7ae760a06368280fdf05302 (diff)
downloademacs-2a81c5d94d4f01b8d23ffb52871e5ab1e863e09e.tar.gz
emacs-2a81c5d94d4f01b8d23ffb52871e5ab1e863e09e.zip
Confine vc-stay-local to CVS, because it was unusable in SVN.
-rw-r--r--lisp/vc/vc-hooks.el58
-rw-r--r--lisp/vc/vc-svn.el15
-rw-r--r--lisp/vc/vc.el11
3 files changed, 1 insertions, 83 deletions
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 39c18d4b57b..c4acef95e9e 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -170,64 +170,6 @@ control systems."
170 :type 'boolean 170 :type 'boolean
171 :group 'vc) 171 :group 'vc)
172 172
173(defcustom vc-stay-local 'only-file
174 "Non-nil means use local operations when possible for remote repositories.
175This avoids slow queries over the network and instead uses heuristics
176and past information to determine the current status of a file.
177
178If value is the symbol `only-file', `vc-dir' will connect to the
179server, but heuristics will be used to determine the status for
180all other VC operations.
181
182The value can also be a regular expression or list of regular
183expressions to match against the host name of a repository; then VC
184only stays local for hosts that match it. Alternatively, the value
185can be a list of regular expressions where the first element is the
186symbol `except'; then VC always stays local except for hosts matched
187by these regular expressions."
188 :type '(choice
189 (const :tag "Always stay local" t)
190 (const :tag "Only for file operations" only-file)
191 (const :tag "Don't stay local" nil)
192 (list :format "\nExamine hostname and %v" :tag "Examine hostname ..."
193 (set :format "%v" :inline t (const :format "%t" :tag "don't" except))
194 (regexp :format " stay local,\n%t: %v" :tag "if it matches")
195 (repeat :format "%v%i\n" :inline t (regexp :tag "or"))))
196 :version "23.1"
197 :group 'vc)
198
199(defun vc-stay-local-p (file &optional backend)
200 "Return non-nil if VC should stay local when handling FILE.
201This uses the `repository-hostname' backend operation.
202If FILE is a list of files, return non-nil if any of them
203individually should stay local."
204 (if (listp file)
205 (delq nil (mapcar (lambda (arg) (vc-stay-local-p arg backend)) file))
206 (setq backend (or backend (vc-backend file)))
207 (let* ((sym (vc-make-backend-sym backend 'stay-local))
208 (stay-local (if (boundp sym) (symbol-value sym) vc-stay-local)))
209 (if (symbolp stay-local) stay-local
210 (let ((dirname (if (file-directory-p file)
211 (directory-file-name file)
212 (file-name-directory file))))
213 (eq 'yes
214 (or (vc-file-getprop dirname 'vc-stay-local-p)
215 (vc-file-setprop
216 dirname 'vc-stay-local-p
217 (let ((hostname (vc-call-backend
218 backend 'repository-hostname dirname)))
219 (if (not hostname)
220 'no
221 (let ((default t))
222 (if (eq (car-safe stay-local) 'except)
223 (setq default nil stay-local (cdr stay-local)))
224 (when (consp stay-local)
225 (setq stay-local
226 (mapconcat 'identity stay-local "\\|")))
227 (if (if (string-match stay-local hostname)
228 default (not default))
229 'yes 'no))))))))))))
230
231;;; This is handled specially now. 173;;; This is handled specially now.
232;; Tell Emacs about this new kind of minor mode 174;; Tell Emacs about this new kind of minor mode
233;; (add-to-list 'minor-mode-alist '(vc-mode vc-mode)) 175;; (add-to-list 'minor-mode-alist '(vc-mode vc-mode))
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 4381c8a8a15..c3efcc59b5a 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -511,7 +511,6 @@ If LIMIT is non-nil, show no more than this many entries."
511 'vc-svn-command 511 'vc-svn-command
512 buffer 512 buffer
513 'async 513 'async
514 ;; (if (and (= (length files) 1) (vc-stay-local-p file 'SVN)) 'async 0)
515 (list file) 514 (list file)
516 "log" 515 "log"
517 (append 516 (append
@@ -552,7 +551,6 @@ If LIMIT is non-nil, show no more than this many entries."
552 (list (concat "--diff-cmd=" diff-command) "-x" 551 (list (concat "--diff-cmd=" diff-command) "-x"
553 (mapconcat 'identity (vc-switches nil 'diff) " ")))) 552 (mapconcat 'identity (vc-switches nil 'diff) " "))))
554 (async (and (not vc-disable-async-diff) 553 (async (and (not vc-disable-async-diff)
555 (vc-stay-local-p files 'SVN)
556 (or oldvers newvers)))) ; Svn diffs those locally. 554 (or oldvers newvers)))) ; Svn diffs those locally.
557 (apply 'vc-svn-command buffer 555 (apply 'vc-svn-command buffer
558 (if async 'async 0) 556 (if async 'async 0)
@@ -595,7 +593,7 @@ NAME is assumed to be a URL."
595;; Subversion makes backups for us, so don't bother. 593;; Subversion makes backups for us, so don't bother.
596;; (defun vc-svn-make-version-backups-p (file) 594;; (defun vc-svn-make-version-backups-p (file)
597;; "Return non-nil if version backups should be made for FILE." 595;; "Return non-nil if version backups should be made for FILE."
598;; (vc-stay-local-p file 'SVN)) 596;; nil)
599 597
600(defun vc-svn-check-headers () 598(defun vc-svn-check-headers ()
601 "Check if the current file has any headers in it." 599 "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."
618 (cons vc-svn-global-switches flags) 616 (cons vc-svn-global-switches flags)
619 (append vc-svn-global-switches flags)))) 617 (append vc-svn-global-switches flags))))
620 618
621(defun vc-svn-repository-hostname (dirname)
622 (with-temp-buffer
623 (let (process-file-side-effects)
624 (vc-svn-command t t dirname "info" "--xml"))
625 (goto-char (point-min))
626 (when (re-search-forward "<url>\\(.*\\)</url>" nil t)
627 ;; This is not a hostname but a URL. This may actually be considered
628 ;; as a feature since it allows vc-svn-stay-local to specify different
629 ;; behavior for different modules on the same server.
630 (match-string 1))))
631
632(defun vc-svn-resolve-when-done () 619(defun vc-svn-resolve-when-done ()
633 "Call \"svn resolved\" if the conflict markers have been removed." 620 "Call \"svn resolved\" if the conflict markers have been removed."
634 (save-excursion 621 (save-excursion
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 54fb9cd5016..55bae67c4d6 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -481,14 +481,6 @@
481;; 481;;
482;; Return the root of the VC controlled hierarchy for file. 482;; Return the root of the VC controlled hierarchy for file.
483;; 483;;
484;; - repository-hostname (dirname)
485;;
486;; Return the hostname that the backend will have to contact
487;; in order to operate on a file in DIRNAME. If the return value
488;; is nil, it means that the repository is local.
489;; This function is used in `vc-stay-local-p' which backends can use
490;; for their convenience.
491;;
492;; - ignore (file &optional directory) 484;; - ignore (file &optional directory)
493;; 485;;
494;; Ignore FILE under the VCS of DIRECTORY (default is `default-directory'). 486;; Ignore FILE under the VCS of DIRECTORY (default is `default-directory').
@@ -630,9 +622,6 @@
630;; 622;;
631;;;; Internal cleanups: 623;;;; Internal cleanups:
632;; 624;;
633;; - backends that care about vc-stay-local should try to take it into
634;; account for vc-dir. Is this likely to be useful??? YES!
635;;
636;; - vc-expand-dirs should take a backend parameter and only look for 625;; - vc-expand-dirs should take a backend parameter and only look for
637;; files managed by that backend. 626;; files managed by that backend.
638;; 627;;