]> git.eshelyaron.com Git - emacs.git/commitdiff
The vc-mistrust-permissions configuration variable is gone.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 1 Dec 2014 14:08:26 +0000 (09:08 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 1 Dec 2014 14:08:26 +0000 (09:08 -0500)
* 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
lisp/vc/vc-cvs.el
lisp/vc/vc-hooks.el
lisp/vc/vc-rcs.el
lisp/vc/vc-sccs.el
lisp/vc/vc.el

index 66b671a6300e126c45bc06d3afcf9407f5a56f2f..6f5bb465c310c99c9c8ff24c96b22c8a6f96d6b3 100644 (file)
@@ -1,5 +1,12 @@
 2014-12-01  Eric S. Raymond  <esr@snark.thyrsus.com>
 
+       * 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
index c938899a53051557d16d277ab8e529295d366b4b..28da328db71f6453d9000a7b7b47bc23eaf98f1f 100644 (file)
@@ -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))))))
index 7224aeeb5b3661495ea61226b1220bce797c2e30..46a6b3194b95ced08945df86b7ab0c040e097242 100644 (file)
@@ -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
index 3028d7e7b878be34b44a4887152e8e444592989a..96ae5836f429df67aae46640c8aba460762b217b 100644 (file)
@@ -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)
index 8c9595a7461eb56200f45afcd3203117435c925a..cd4c054b07d9c85b390a5b4bf3e77fc047d51f36 100644 (file)
@@ -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)
index 1ae334683c162e54ae7af98f4f8009e83f4faadb..0d0639ba86c80be390938ebcb29b54b105d35705 100644 (file)
 ;;   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.