[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 33b4235: The vc-mistrust-permissions configuration
From: |
Eric S. Raymond |
Subject: |
[Emacs-diffs] master 33b4235: The vc-mistrust-permissions configuration variable is gone. |
Date: |
Mon, 01 Dec 2014 14:09:37 +0000 |
branch: master
commit 33b4235db671a6c5644a9ce73a8901f073cb0ecc
Author: Eric S. Raymond <address@hidden>
Commit: Eric S. Raymond <address@hidden>
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.
---
lisp/ChangeLog | 7 ++++
lisp/vc/vc-cvs.el | 6 ++--
lisp/vc/vc-hooks.el | 16 ----------
lisp/vc/vc-rcs.el | 77 ++++-----------------------------------------------
lisp/vc/vc-sccs.el | 23 ---------------
lisp/vc/vc.el | 5 +++
6 files changed, 21 insertions(+), 113 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 66b671a..6f5bb46 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
2014-12-01 Eric S. Raymond <address@hidden>
+ * 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.
+
* vc/vc.el, vc-hooks.el, and all backends: API simplification;
vc-workfile-unchanged-p is no longer a public method (but the RCS
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 c938899..28da328 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -48,9 +48,9 @@
;; If the file is not writable (despite CVSREAD being
;; undefined), this is probably because the file is being
;; "watched" by other developers.
- ;; (If vc-mistrust-permissions was t, we actually shouldn't
- ;; trust this, but there is no other way to learn this from
- ;; CVS at the moment (version 1.9).)
+ ;; (We actually shouldn't trust this, but there is
+ ;; no other way to learn this from CVS at the
+ ;; moment (version 1.9).)
(string-match "r-..-..-." (nth 8 attrib)))
'announce
'implicit))))))
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 7224aee..46a6b31 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -170,22 +170,6 @@ control systems."
:type 'boolean
:group 'vc)
-;; If you fix bug#11490, probably you can set this back to nil.
-(defcustom vc-mistrust-permissions t
- "If non-nil, don't assume permissions/ownership track version-control status.
-If nil, do rely on the permissions.
-See also variable `vc-consult-headers'."
- :version "24.3" ; nil->t, bug#11490
- :type 'boolean
- :group 'vc)
-
-(defun vc-mistrust-permissions (file)
- "Internal access function to variable `vc-mistrust-permissions' for FILE."
- (or (eq vc-mistrust-permissions 't)
- (and vc-mistrust-permissions
- (funcall vc-mistrust-permissions
- (vc-backend-subdirectory-name file)))))
-
(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
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 3028d7e..96ae583 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'."
'unlocked-changes
'edited))))))
-(defun vc-rcs-state-heuristic (file)
- "State heuristic for RCS."
- (let (vc-rcs-headers-result)
- (if (and vc-consult-headers
- (setq vc-rcs-headers-result
- (vc-rcs-consult-headers file))
- (eq vc-rcs-headers-result 'rev-and-lock))
- (let ((state (vc-file-getprop file 'vc-state)))
- ;; If the headers say that the file is not locked, the
- ;; permissions can tell us whether locking is used for
- ;; the file or not.
- (if (and (eq state 'up-to-date)
- (not (vc-mistrust-permissions file))
- (file-exists-p file))
- (cond
- ((string-match ".rw..-..-." (nth 8 (file-attributes file)))
- (vc-file-setprop file 'vc-checkout-model 'implicit)
- (setq state
- (if (vc-rcs-workfile-is-newer file)
- 'edited
- 'up-to-date)))
- ((string-match ".r-..-..-." (nth 8 (file-attributes file)))
- (vc-file-setprop file 'vc-checkout-model 'locking))))
- state)
- (if (not (vc-mistrust-permissions file))
- (let* ((attributes (file-attributes file 'string))
- (owner-name (nth 2 attributes))
- (permissions (nth 8 attributes)))
- (cond ((and permissions (string-match ".r-..-..-." permissions))
- (vc-file-setprop file 'vc-checkout-model 'locking)
- 'up-to-date)
- ((and permissions (string-match ".rw..-..-." permissions))
- (if (eq (vc-rcs-checkout-model file) 'locking)
- (if (file-ownership-preserved-p file)
- 'edited
- owner-name)
- (if (vc-rcs-workfile-is-newer file)
- 'edited
- 'up-to-date)))
- (t
- ;; Strange permissions. Fall through to
- ;; expensive state computation.
- (vc-rcs-state file))))
- (vc-rcs-state file)))))
-
(autoload 'vc-expand-dirs "vc")
(defun vc-rcs-dir-status (dir update-function)
@@ -1098,7 +1053,7 @@ Returns: nil if no headers were found
'rev-and-lock if revision and lock info was found"
(cond
((not (get-file-buffer file)) nil)
- ((let (status version locking-user)
+ ((let (status version)
(with-current-buffer (get-file-buffer file)
(save-excursion
(goto-char (point-min))
@@ -1124,11 +1079,11 @@ Returns: nil if no headers were found
(cond
;; unlocked revision
((looking-at "\\$")
- (setq locking-user 'none)
+ ;;(setq locking-user 'none)
(setq status 'rev-and-lock))
;; revision is locked by some user
((looking-at "\\([^ ]+\\) \\$")
- (setq locking-user (match-string-no-properties 1))
+ ;;(setq locking-user (match-string-no-properties 1))
(setq status 'rev-and-lock))
;; everything else: false
(nil)))
@@ -1146,39 +1101,19 @@ Returns: nil if no headers were found
(goto-char (point-min))
(if (re-search-forward (concat "\\$" "Locker:") nil t)
(cond ((looking-at " \\([^ ]+\\) \\$")
- (setq locking-user (match-string-no-properties 1))
+ ;;(setq locking-user (match-string-no-properties 1))
(setq status 'rev-and-lock))
((looking-at " *\\$")
- (setq locking-user 'none)
+ ;;(setq locking-user 'none)
(setq status 'rev-and-lock))
(t
- (setq locking-user 'none)
+ ;;(setq locking-user 'none)
(setq status 'rev-and-lock)))
(setq status 'rev)))
;; else: nothing found
;; -------------------
(t nil))))
(if status (vc-file-setprop file 'vc-working-revision version))
- (and (eq status 'rev-and-lock)
- (vc-file-setprop file 'vc-state
- (cond
- ((eq locking-user 'none) 'up-to-date)
- ((string= locking-user (vc-user-login-name file))
- 'edited)
- (t locking-user)))
- ;; If the file has headers, we don't want to query the
- ;; master file, because that would eliminate all the
- ;; performance gain the headers brought us. We therefore
- ;; use a heuristic now to find out whether locking is used
- ;; for this file. If we trust the file permissions, and the
- ;; file is not locked, then if the file is read-only we
- ;; assume that locking is used for the file, otherwise
- ;; locking is not used.
- (not (vc-mistrust-permissions file))
- (vc-up-to-date-p file)
- (if (string-match ".r-..-..-." (nth 8 (file-attributes file)))
- (vc-file-setprop file 'vc-checkout-model 'locking)
- (vc-file-setprop file 'vc-checkout-model 'implicit)))
status))))
(defun vc-release-greater-or-equal (r1 r2)
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 8c9595a..cd4c054 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'."
locking-user)))
'up-to-date))))
-(defun vc-sccs-state-heuristic (file)
- "SCCS-specific state heuristic."
- (if (not (vc-mistrust-permissions file))
- ;; This implementation assumes that any file which is under version
- ;; control and has -rw-r--r-- is locked by its owner. This is true
- ;; for both RCS and SCCS, which keep unlocked files at -r--r--r--.
- ;; We have to be careful not to exclude files with execute bits on;
- ;; scripts can be under version control too. Also, we must ignore the
- ;; group-read and other-read bits, since paranoid users turn them off.
- (let* ((attributes (file-attributes file 'string))
- (owner-name (nth 2 attributes))
- (permissions (nth 8 attributes)))
- (if (string-match ".r-..-..-." permissions)
- 'up-to-date
- (if (string-match ".rw..-..-." permissions)
- (if (file-ownership-preserved-p file)
- 'edited
- owner-name)
- ;; Strange permissions.
- ;; Fall through to real state computation.
- (vc-sccs-state file))))
- (vc-sccs-state file)))
-
(autoload 'vc-expand-dirs "vc")
(defun vc-sccs-dir-status (dir update-function)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 1ae3346..0d0639b 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -590,6 +590,11 @@
;; moves closer to emulating modern non-locking behavior even on very
;; old VCSes.
;;
+;; - the vc-mistrust-permissions configuration variable is gone; the
+;; code no longer relies on permissions except in one corner case where
+;; CVS leaves no alternative (which was not gated by this variable). The
+;; only affected back ends were SCCS and RCS.
+;;
;; - The init-revision function and the default-initial-revision
;; variable are gone. These have't made sense on anything shipped
;; since RCS, and using them was a dumb stunt even on RCS.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 33b4235: The vc-mistrust-permissions configuration variable is gone.,
Eric S. Raymond <=