diff options
| author | Eric S. Raymond | 2014-12-01 09:08:26 -0500 |
|---|---|---|
| committer | Eric S. Raymond | 2014-12-01 09:08:26 -0500 |
| commit | 33b4235db671a6c5644a9ce73a8901f073cb0ecc (patch) | |
| tree | 384d5fdc375028bb5cf2a5eb0434f06746f83139 | |
| parent | f82f3f1f177c1a9cc2c2236f51acd1be1809ae1f (diff) | |
| download | emacs-33b4235db671a6c5644a9ce73a8901f073cb0ecc.tar.gz emacs-33b4235db671a6c5644a9ce73a8901f073cb0ecc.zip | |
The vc-mistrust-permissions configuration variable is gone.
* vc/vc-cvs.el, vc/vc-hooks.el, vc/vc-rcs.el, vc/vc-sccs.el: Eliminate
vc-mistrust-permissions. It was only relevant to the RCS and SCCS
back ends and defaulted to t. Code now always mistrusts permissions -
by actual measurement the effect on performance is negligible. As a
side effect bug#11490 is now irrelevant.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/vc/vc-cvs.el | 6 | ||||
| -rw-r--r-- | lisp/vc/vc-hooks.el | 16 | ||||
| -rw-r--r-- | lisp/vc/vc-rcs.el | 77 | ||||
| -rw-r--r-- | lisp/vc/vc-sccs.el | 23 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 5 |
6 files changed, 21 insertions, 113 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 66b671a6300..6f5bb465c31 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2014-12-01 Eric S. Raymond <esr@snark.thyrsus.com> | 1 | 2014-12-01 Eric S. Raymond <esr@snark.thyrsus.com> |
| 2 | 2 | ||
| 3 | * vc/vc-cvs.el, vc/vc-hooks.el, vc/vc-rcs.el, vc/vc-sccs.el: | ||
| 4 | Eliminate vc-mistrust-permissions. It was only relevant to the | ||
| 5 | RCS and SCCS back ends and defaulted to t. Code now always | ||
| 6 | mistrusts permissions - by actual measurement the effect on | ||
| 7 | performance is negligible. As a side effect bug#11490 is now | ||
| 8 | irrelevant. | ||
| 9 | |||
| 3 | * vc/vc.el, vc-hooks.el, and all backends: API simplification; | 10 | * vc/vc.el, vc-hooks.el, and all backends: API simplification; |
| 4 | vc-workfile-unchanged-p is no longer a public method (but the RCS | 11 | vc-workfile-unchanged-p is no longer a public method (but the RCS |
| 5 | and SCCS back ends retain it as a private method used in state | 12 | and SCCS back ends retain it as a private method used in state |
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index c938899a530..28da328db71 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el | |||
| @@ -48,9 +48,9 @@ | |||
| 48 | ;; If the file is not writable (despite CVSREAD being | 48 | ;; If the file is not writable (despite CVSREAD being |
| 49 | ;; undefined), this is probably because the file is being | 49 | ;; undefined), this is probably because the file is being |
| 50 | ;; "watched" by other developers. | 50 | ;; "watched" by other developers. |
| 51 | ;; (If vc-mistrust-permissions was t, we actually shouldn't | 51 | ;; (We actually shouldn't trust this, but there is |
| 52 | ;; trust this, but there is no other way to learn this from | 52 | ;; no other way to learn this from CVS at the |
| 53 | ;; CVS at the moment (version 1.9).) | 53 | ;; moment (version 1.9).) |
| 54 | (string-match "r-..-..-." (nth 8 attrib))) | 54 | (string-match "r-..-..-." (nth 8 attrib))) |
| 55 | 'announce | 55 | 'announce |
| 56 | 'implicit)))))) | 56 | 'implicit)))))) |
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 7224aeeb5b3..46a6b3194b9 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el | |||
| @@ -170,22 +170,6 @@ control systems." | |||
| 170 | :type 'boolean | 170 | :type 'boolean |
| 171 | :group 'vc) | 171 | :group 'vc) |
| 172 | 172 | ||
| 173 | ;; If you fix bug#11490, probably you can set this back to nil. | ||
| 174 | (defcustom vc-mistrust-permissions t | ||
| 175 | "If non-nil, don't assume permissions/ownership track version-control status. | ||
| 176 | If nil, do rely on the permissions. | ||
| 177 | See also variable `vc-consult-headers'." | ||
| 178 | :version "24.3" ; nil->t, bug#11490 | ||
| 179 | :type 'boolean | ||
| 180 | :group 'vc) | ||
| 181 | |||
| 182 | (defun vc-mistrust-permissions (file) | ||
| 183 | "Internal access function to variable `vc-mistrust-permissions' for FILE." | ||
| 184 | (or (eq vc-mistrust-permissions 't) | ||
| 185 | (and vc-mistrust-permissions | ||
| 186 | (funcall vc-mistrust-permissions | ||
| 187 | (vc-backend-subdirectory-name file))))) | ||
| 188 | |||
| 189 | (defcustom vc-stay-local 'only-file | 173 | (defcustom vc-stay-local 'only-file |
| 190 | "Non-nil means use local operations when possible for remote repositories. | 174 | "Non-nil means use local operations when possible for remote repositories. |
| 191 | This avoids slow queries over the network and instead uses heuristics | 175 | This avoids slow queries over the network and instead uses heuristics |
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 3028d7e7b87..96ae5836f42 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el | |||
| @@ -155,51 +155,6 @@ For a description of possible values, see `vc-check-master-templates'." | |||
| 155 | 'unlocked-changes | 155 | 'unlocked-changes |
| 156 | 'edited)))))) | 156 | 'edited)))))) |
| 157 | 157 | ||
| 158 | (defun vc-rcs-state-heuristic (file) | ||
| 159 | "State heuristic for RCS." | ||
| 160 | (let (vc-rcs-headers-result) | ||
| 161 | (if (and vc-consult-headers | ||
| 162 | (setq vc-rcs-headers-result | ||
| 163 | (vc-rcs-consult-headers file)) | ||
| 164 | (eq vc-rcs-headers-result 'rev-and-lock)) | ||
| 165 | (let ((state (vc-file-getprop file 'vc-state))) | ||
| 166 | ;; If the headers say that the file is not locked, the | ||
| 167 | ;; permissions can tell us whether locking is used for | ||
| 168 | ;; the file or not. | ||
| 169 | (if (and (eq state 'up-to-date) | ||
| 170 | (not (vc-mistrust-permissions file)) | ||
| 171 | (file-exists-p file)) | ||
| 172 | (cond | ||
| 173 | ((string-match ".rw..-..-." (nth 8 (file-attributes file))) | ||
| 174 | (vc-file-setprop file 'vc-checkout-model 'implicit) | ||
| 175 | (setq state | ||
| 176 | (if (vc-rcs-workfile-is-newer file) | ||
| 177 | 'edited | ||
| 178 | 'up-to-date))) | ||
| 179 | ((string-match ".r-..-..-." (nth 8 (file-attributes file))) | ||
| 180 | (vc-file-setprop file 'vc-checkout-model 'locking)))) | ||
| 181 | state) | ||
| 182 | (if (not (vc-mistrust-permissions file)) | ||
| 183 | (let* ((attributes (file-attributes file 'string)) | ||
| 184 | (owner-name (nth 2 attributes)) | ||
| 185 | (permissions (nth 8 attributes))) | ||
| 186 | (cond ((and permissions (string-match ".r-..-..-." permissions)) | ||
| 187 | (vc-file-setprop file 'vc-checkout-model 'locking) | ||
| 188 | 'up-to-date) | ||
| 189 | ((and permissions (string-match ".rw..-..-." permissions)) | ||
| 190 | (if (eq (vc-rcs-checkout-model file) 'locking) | ||
| 191 | (if (file-ownership-preserved-p file) | ||
| 192 | 'edited | ||
| 193 | owner-name) | ||
| 194 | (if (vc-rcs-workfile-is-newer file) | ||
| 195 | 'edited | ||
| 196 | 'up-to-date))) | ||
| 197 | (t | ||
| 198 | ;; Strange permissions. Fall through to | ||
| 199 | ;; expensive state computation. | ||
| 200 | (vc-rcs-state file)))) | ||
| 201 | (vc-rcs-state file))))) | ||
| 202 | |||
| 203 | (autoload 'vc-expand-dirs "vc") | 158 | (autoload 'vc-expand-dirs "vc") |
| 204 | 159 | ||
| 205 | (defun vc-rcs-dir-status (dir update-function) | 160 | (defun vc-rcs-dir-status (dir update-function) |
| @@ -1098,7 +1053,7 @@ Returns: nil if no headers were found | |||
| 1098 | 'rev-and-lock if revision and lock info was found" | 1053 | 'rev-and-lock if revision and lock info was found" |
| 1099 | (cond | 1054 | (cond |
| 1100 | ((not (get-file-buffer file)) nil) | 1055 | ((not (get-file-buffer file)) nil) |
| 1101 | ((let (status version locking-user) | 1056 | ((let (status version) |
| 1102 | (with-current-buffer (get-file-buffer file) | 1057 | (with-current-buffer (get-file-buffer file) |
| 1103 | (save-excursion | 1058 | (save-excursion |
| 1104 | (goto-char (point-min)) | 1059 | (goto-char (point-min)) |
| @@ -1124,11 +1079,11 @@ Returns: nil if no headers were found | |||
| 1124 | (cond | 1079 | (cond |
| 1125 | ;; unlocked revision | 1080 | ;; unlocked revision |
| 1126 | ((looking-at "\\$") | 1081 | ((looking-at "\\$") |
| 1127 | (setq locking-user 'none) | 1082 | ;;(setq locking-user 'none) |
| 1128 | (setq status 'rev-and-lock)) | 1083 | (setq status 'rev-and-lock)) |
| 1129 | ;; revision is locked by some user | 1084 | ;; revision is locked by some user |
| 1130 | ((looking-at "\\([^ ]+\\) \\$") | 1085 | ((looking-at "\\([^ ]+\\) \\$") |
| 1131 | (setq locking-user (match-string-no-properties 1)) | 1086 | ;;(setq locking-user (match-string-no-properties 1)) |
| 1132 | (setq status 'rev-and-lock)) | 1087 | (setq status 'rev-and-lock)) |
| 1133 | ;; everything else: false | 1088 | ;; everything else: false |
| 1134 | (nil))) | 1089 | (nil))) |
| @@ -1146,39 +1101,19 @@ Returns: nil if no headers were found | |||
| 1146 | (goto-char (point-min)) | 1101 | (goto-char (point-min)) |
| 1147 | (if (re-search-forward (concat "\\$" "Locker:") nil t) | 1102 | (if (re-search-forward (concat "\\$" "Locker:") nil t) |
| 1148 | (cond ((looking-at " \\([^ ]+\\) \\$") | 1103 | (cond ((looking-at " \\([^ ]+\\) \\$") |
| 1149 | (setq locking-user (match-string-no-properties 1)) | 1104 | ;;(setq locking-user (match-string-no-properties 1)) |
| 1150 | (setq status 'rev-and-lock)) | 1105 | (setq status 'rev-and-lock)) |
| 1151 | ((looking-at " *\\$") | 1106 | ((looking-at " *\\$") |
| 1152 | (setq locking-user 'none) | 1107 | ;;(setq locking-user 'none) |
| 1153 | (setq status 'rev-and-lock)) | 1108 | (setq status 'rev-and-lock)) |
| 1154 | (t | 1109 | (t |
| 1155 | (setq locking-user 'none) | 1110 | ;;(setq locking-user 'none) |
| 1156 | (setq status 'rev-and-lock))) | 1111 | (setq status 'rev-and-lock))) |
| 1157 | (setq status 'rev))) | 1112 | (setq status 'rev))) |
| 1158 | ;; else: nothing found | 1113 | ;; else: nothing found |
| 1159 | ;; ------------------- | 1114 | ;; ------------------- |
| 1160 | (t nil)))) | 1115 | (t nil)))) |
| 1161 | (if status (vc-file-setprop file 'vc-working-revision version)) | 1116 | (if status (vc-file-setprop file 'vc-working-revision version)) |
| 1162 | (and (eq status 'rev-and-lock) | ||
| 1163 | (vc-file-setprop file 'vc-state | ||
| 1164 | (cond | ||
| 1165 | ((eq locking-user 'none) 'up-to-date) | ||
| 1166 | ((string= locking-user (vc-user-login-name file)) | ||
| 1167 | 'edited) | ||
| 1168 | (t locking-user))) | ||
| 1169 | ;; If the file has headers, we don't want to query the | ||
| 1170 | ;; master file, because that would eliminate all the | ||
| 1171 | ;; performance gain the headers brought us. We therefore | ||
| 1172 | ;; use a heuristic now to find out whether locking is used | ||
| 1173 | ;; for this file. If we trust the file permissions, and the | ||
| 1174 | ;; file is not locked, then if the file is read-only we | ||
| 1175 | ;; assume that locking is used for the file, otherwise | ||
| 1176 | ;; locking is not used. | ||
| 1177 | (not (vc-mistrust-permissions file)) | ||
| 1178 | (vc-up-to-date-p file) | ||
| 1179 | (if (string-match ".r-..-..-." (nth 8 (file-attributes file))) | ||
| 1180 | (vc-file-setprop file 'vc-checkout-model 'locking) | ||
| 1181 | (vc-file-setprop file 'vc-checkout-model 'implicit))) | ||
| 1182 | status)))) | 1117 | status)))) |
| 1183 | 1118 | ||
| 1184 | (defun vc-release-greater-or-equal (r1 r2) | 1119 | (defun vc-release-greater-or-equal (r1 r2) |
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index 8c9595a7461..cd4c054b07d 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el | |||
| @@ -132,29 +132,6 @@ For a description of possible values, see `vc-check-master-templates'." | |||
| 132 | locking-user))) | 132 | locking-user))) |
| 133 | 'up-to-date)))) | 133 | 'up-to-date)))) |
| 134 | 134 | ||
| 135 | (defun vc-sccs-state-heuristic (file) | ||
| 136 | "SCCS-specific state heuristic." | ||
| 137 | (if (not (vc-mistrust-permissions file)) | ||
| 138 | ;; This implementation assumes that any file which is under version | ||
| 139 | ;; control and has -rw-r--r-- is locked by its owner. This is true | ||
| 140 | ;; for both RCS and SCCS, which keep unlocked files at -r--r--r--. | ||
| 141 | ;; We have to be careful not to exclude files with execute bits on; | ||
| 142 | ;; scripts can be under version control too. Also, we must ignore the | ||
| 143 | ;; group-read and other-read bits, since paranoid users turn them off. | ||
| 144 | (let* ((attributes (file-attributes file 'string)) | ||
| 145 | (owner-name (nth 2 attributes)) | ||
| 146 | (permissions (nth 8 attributes))) | ||
| 147 | (if (string-match ".r-..-..-." permissions) | ||
| 148 | 'up-to-date | ||
| 149 | (if (string-match ".rw..-..-." permissions) | ||
| 150 | (if (file-ownership-preserved-p file) | ||
| 151 | 'edited | ||
| 152 | owner-name) | ||
| 153 | ;; Strange permissions. | ||
| 154 | ;; Fall through to real state computation. | ||
| 155 | (vc-sccs-state file)))) | ||
| 156 | (vc-sccs-state file))) | ||
| 157 | |||
| 158 | (autoload 'vc-expand-dirs "vc") | 135 | (autoload 'vc-expand-dirs "vc") |
| 159 | 136 | ||
| 160 | (defun vc-sccs-dir-status (dir update-function) | 137 | (defun vc-sccs-dir-status (dir update-function) |
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 1ae334683c1..0d0639ba86c 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -590,6 +590,11 @@ | |||
| 590 | ;; moves closer to emulating modern non-locking behavior even on very | 590 | ;; moves closer to emulating modern non-locking behavior even on very |
| 591 | ;; old VCSes. | 591 | ;; old VCSes. |
| 592 | ;; | 592 | ;; |
| 593 | ;; - the vc-mistrust-permissions configuration variable is gone; the | ||
| 594 | ;; code no longer relies on permissions except in one corner case where | ||
| 595 | ;; CVS leaves no alternative (which was not gated by this variable). The | ||
| 596 | ;; only affected back ends were SCCS and RCS. | ||
| 597 | ;; | ||
| 593 | ;; - The init-revision function and the default-initial-revision | 598 | ;; - The init-revision function and the default-initial-revision |
| 594 | ;; variable are gone. These have't made sense on anything shipped | 599 | ;; variable are gone. These have't made sense on anything shipped |
| 595 | ;; since RCS, and using them was a dumb stunt even on RCS. | 600 | ;; since RCS, and using them was a dumb stunt even on RCS. |