aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2014-12-01 07:39:15 -0500
committerEric S. Raymond2014-12-01 07:39:15 -0500
commit2532d74a5fb5168955aa900f597bf7efc14efb12 (patch)
treef9da3a72d253168a4b35bf79e1bcaa72c541a110
parent9e9e3432fa4e31731f4c058caf8f30b7a4552c1b (diff)
downloademacs-2532d74a5fb5168955aa900f597bf7efc14efb12.tar.gz
emacs-2532d74a5fb5168955aa900f597bf7efc14efb12.zip
Renove duplicate code.
-rw-r--r--lisp/vc/vc-filewise.el34
1 files changed, 0 insertions, 34 deletions
diff --git a/lisp/vc/vc-filewise.el b/lisp/vc/vc-filewise.el
index da8abc532fd..75ac2561e8b 100644
--- a/lisp/vc/vc-filewise.el
+++ b/lisp/vc/vc-filewise.el
@@ -81,38 +81,4 @@ 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-check-master-templates (file templates)
85 "Return non-nil if there is a master corresponding to FILE.
86
87TEMPLATES is a list of strings or functions. If an element is a
88string, it must be a control string as required by `format', with two
89string placeholders, such as \"%sRCS/%s,v\". The directory part of
90FILE is substituted for the first placeholder, the basename of FILE
91for the second. If a file with the resulting name exists, it is taken
92as the master of FILE, and returned.
93
94If an element of TEMPLATES is a function, it is called with the
95directory part and the basename of FILE as arguments. It should
96return non-nil if it finds a master; that value is then returned by
97this function."
98 (let ((dirname (or (file-name-directory file) ""))
99 (basename (file-name-nondirectory file)))
100 (catch 'found
101 (mapcar
102 (lambda (s)
103 (let ((trial (vc-possible-master s dirname basename)))
104 (when (and trial (file-exists-p trial)
105 ;; Make sure the file we found with name
106 ;; TRIAL is not the source file itself.
107 ;; That can happen with RCS-style names if
108 ;; the file name is truncated (e.g. to 14
109 ;; chars). See if either directory or
110 ;; attributes differ.
111 (or (not (string= dirname
112 (file-name-directory trial)))
113 (not (equal (file-attributes file)
114 (file-attributes trial)))))
115 (throw 'found trial))))
116 templates))))
117
118(provide 'vc-filewise) 84(provide 'vc-filewise)