aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2014-11-22 12:38:21 +0100
committerMichael Albinus2014-11-22 12:38:21 +0100
commitb559a60382a3e192250e533c4a9daecacabd4026 (patch)
tree5ccdc9b7c02aac1df8da5fb7f3a6bd4cd2e57eeb
parentcd22fd754b71ff64bbabd05bb6df2df8fa5a8915 (diff)
parentcec23966252b5f4d87c6c6b56c7660b8d578865c (diff)
downloademacs-b559a60382a3e192250e533c4a9daecacabd4026.tar.gz
emacs-b559a60382a3e192250e533c4a9daecacabd4026.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
-rw-r--r--lisp/vc/vc-filewise.el12
-rw-r--r--lisp/vc/vc-hooks.el51
-rw-r--r--lisp/vc/vc-rcs.el4
-rw-r--r--lisp/vc/vc-sccs.el4
-rw-r--r--lisp/vc/vc-src.el4
5 files changed, 55 insertions, 20 deletions
diff --git a/lisp/vc/vc-filewise.el b/lisp/vc/vc-filewise.el
index 9bdde5e5e31..bc8a8dec416 100644
--- a/lisp/vc/vc-filewise.el
+++ b/lisp/vc/vc-filewise.el
@@ -81,18 +81,6 @@ If the file is not registered, or the master name is not known, return nil."
81 (vc-file-setprop file 'vc-name result) 81 (vc-file-setprop file 'vc-name result)
82 nil)))) ; Not registered 82 nil)))) ; Not registered
83 83
84(defun vc-possible-master (s dirname basename)
85 (cond
86 ((stringp s) (format s dirname basename))
87 ((functionp s)
88 ;; The template is a function to invoke. If the
89 ;; function returns non-nil, that means it has found a
90 ;; master. For backward compatibility, we also handle
91 ;; the case that the function throws a 'found atom
92 ;; and a pair (cons MASTER-FILE BACKEND).
93 (let ((result (catch 'found (funcall s dirname basename))))
94 (if (consp result) (car result) result)))))
95
96(defun vc-check-master-templates (file templates) 84(defun vc-check-master-templates (file templates)
97 "Return non-nil if there is a master corresponding to FILE. 85 "Return non-nil if there is a master corresponding to FILE.
98 86
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 6f55a14b7ba..a084f9da73a 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -627,8 +627,7 @@ If FILE is not registered, this function always returns nil."
627 "`working-revision' not found: using the old `workfile-version' instead") 627 "`working-revision' not found: using the old `workfile-version' instead")
628 (vc-call-backend backend 'workfile-version file)) 628 (vc-call-backend backend 'workfile-version file))
629 629
630;;;autoload 630(defun vc-default-registered (backend file)
631(defun vc-master-registered (backend file)
632 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." 631 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates."
633 (let ((sym (vc-make-backend-sym backend 'master-templates))) 632 (let ((sym (vc-make-backend-sym backend 'master-templates)))
634 (unless (get backend 'vc-templates-grabbed) 633 (unless (get backend 'vc-templates-grabbed)
@@ -638,6 +637,54 @@ If FILE is not registered, this function always returns nil."
638 (vc-file-setprop file 'vc-master-name result) 637 (vc-file-setprop file 'vc-master-name result)
639 nil)))) ; Not registered 638 nil)))) ; Not registered
640 639
640;;;###autoload
641(defun vc-possible-master (s dirname basename)
642 (cond
643 ((stringp s) (format s dirname basename))
644 ((functionp s)
645 ;; The template is a function to invoke. If the
646 ;; function returns non-nil, that means it has found a
647 ;; master. For backward compatibility, we also handle
648 ;; the case that the function throws a 'found atom
649 ;; and a pair (cons MASTER-FILE BACKEND).
650 (let ((result (catch 'found (funcall s dirname basename))))
651 (if (consp result) (car result) result)))))
652
653(defun vc-check-master-templates (file templates)
654 "Return non-nil if there is a master corresponding to FILE.
655
656TEMPLATES is a list of strings or functions. If an element is a
657string, it must be a control string as required by `format', with two
658string placeholders, such as \"%sRCS/%s,v\". The directory part of
659FILE is substituted for the first placeholder, the basename of FILE
660for the second. If a file with the resulting name exists, it is taken
661as the master of FILE, and returned.
662
663If an element of TEMPLATES is a function, it is called with the
664directory part and the basename of FILE as arguments. It should
665return non-nil if it finds a master; that value is then returned by
666this function."
667 (let ((dirname (or (file-name-directory file) ""))
668 (basename (file-name-nondirectory file)))
669 (catch 'found
670 (mapcar
671 (lambda (s)
672 (let ((trial (vc-possible-master s dirname basename)))
673 (when (and trial (file-exists-p trial)
674 ;; Make sure the file we found with name
675 ;; TRIAL is not the source file itself.
676 ;; That can happen with RCS-style names if
677 ;; the file name is truncated (e.g. to 14
678 ;; chars). See if either directory or
679 ;; attributes differ.
680 (or (not (string= dirname
681 (file-name-directory trial)))
682 (not (equal (file-attributes file)
683 (file-attributes trial)))))
684 (throw 'found trial))))
685 templates))))
686
687
641;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made 688;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made
642;; obsolete earlier, it is ok for the latter to be an alias to the former, 689;; obsolete earlier, it is ok for the latter to be an alias to the former,
643;; since the latter will be removed first. We can't just make it 690;; since the latter will be removed first. We can't just make it
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 99019915490..0b839a622e1 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -90,7 +90,7 @@ to use --brief and sets this variable to remember whether it worked."
90 :group 'vc-rcs) 90 :group 'vc-rcs)
91 91
92;; This needs to be autoloaded because vc-rcs-registered uses it (via 92;; This needs to be autoloaded because vc-rcs-registered uses it (via
93;; vc-master-registered), and vc-hooks needs to be able to check 93;; vc-default-registered), and vc-hooks needs to be able to check
94;; for a registered backend without loading every backend. 94;; for a registered backend without loading every backend.
95;;;###autoload 95;;;###autoload
96(defcustom vc-rcs-master-templates 96(defcustom vc-rcs-master-templates
@@ -131,7 +131,7 @@ For a description of possible values, see `vc-check-master-templates'."
131;; every file that is visited. 131;; every file that is visited.
132;;;###autoload 132;;;###autoload
133(progn 133(progn
134(defun vc-rcs-registered (f) (vc-master-registered 'RCS f))) 134(defun vc-rcs-registered (f) (vc-default-registered 'RCS f)))
135 135
136(defun vc-rcs-state (file) 136(defun vc-rcs-state (file)
137 "Implementation of `vc-state' for RCS." 137 "Implementation of `vc-state' for RCS."
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index fc9c07277ae..780efc48e96 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -75,7 +75,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
75 :group 'vc-sccs) 75 :group 'vc-sccs)
76 76
77;; This needs to be autoloaded because vc-sccs-registered uses it (via 77;; This needs to be autoloaded because vc-sccs-registered uses it (via
78;; vc-master-registered), and vc-hooks needs to be able to check 78;; vc-default-registered), and vc-hooks needs to be able to check
79;; for a registered backend without loading every backend. 79;; for a registered backend without loading every backend.
80;;;###autoload 80;;;###autoload
81(defcustom vc-sccs-master-templates 81(defcustom vc-sccs-master-templates
@@ -112,7 +112,7 @@ For a description of possible values, see `vc-check-master-templates'."
112;; every file that is visited. 112;; every file that is visited.
113;;;###autoload 113;;;###autoload
114(progn 114(progn
115(defun vc-sccs-registered (f) (vc-master-registered 'SCCS f))) 115(defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)))
116 116
117(defun vc-sccs-state (file) 117(defun vc-sccs-state (file)
118 "SCCS-specific function to compute the version control state." 118 "SCCS-specific function to compute the version control state."
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index 56af2a5848c..520708c7eb0 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -123,7 +123,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
123 :group 'vc-src) 123 :group 'vc-src)
124 124
125;; This needs to be autoloaded because vc-src-registered uses it (via 125;; This needs to be autoloaded because vc-src-registered uses it (via
126;; vc-master-registered), and vc-hooks needs to be able to check 126;; vc-default-registered), and vc-hooks needs to be able to check
127;; for a registered backend without loading every backend. 127;; for a registered backend without loading every backend.
128;;;###autoload 128;;;###autoload
129(defcustom vc-src-master-templates 129(defcustom vc-src-master-templates
@@ -153,7 +153,7 @@ For a description of possible values, see `vc-check-master-templates'."
153;; every file that is visited. 153;; every file that is visited.
154;;;###autoload 154;;;###autoload
155(progn 155(progn
156(defun vc-src-registered (f) (vc-master-registered 'src f))) 156(defun vc-src-registered (f) (vc-default-registered 'src f)))
157 157
158(defun vc-src-state (file) 158(defun vc-src-state (file)
159 "SRC-specific version of `vc-state'." 159 "SRC-specific version of `vc-state'."