[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 578d91a: Remove vc-state-heuristic from the set of
From: |
Eric S. Raymond |
Subject: |
[Emacs-diffs] master 578d91a: Remove vc-state-heuristic from the set of public methods. |
Date: |
Mon, 01 Dec 2014 14:43:10 +0000 |
branch: master
commit 578d91ac509a9856cf854bea75b6328cf40d1d03
Author: Eric S. Raymond <address@hidden>
Commit: Eric S. Raymond <address@hidden>
Remove vc-state-heuristic from the set of public methods.
* vc/vc.el, vc-hooks.el, and all backends: API simplification;
vc-state-heuristic is no longer a public method, having been removed
where it is redundant, unnecessary, or known buggy. This eliminated
all backends except CVS. Eliminates bug#7850.
---
lisp/ChangeLog | 5 ++
lisp/vc/vc-bzr.el | 111 +--------------------------------------------------
lisp/vc/vc-dav.el | 4 --
lisp/vc/vc-git.el | 1 -
lisp/vc/vc-hg.el | 1 -
lisp/vc/vc-hooks.el | 8 +---
lisp/vc/vc-src.el | 1 -
lisp/vc/vc-svn.el | 21 +---------
lisp/vc/vc.el | 14 ++-----
9 files changed, 12 insertions(+), 154 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6f5bb46..d6691f5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
2014-12-01 Eric S. Raymond <address@hidden>
+ * vc/vc.el, vc-hooks.el, and all backends: API simplification;
+ vc-state-heuristic is no longer a public method, having been
+ removed where it is redundant, unnecessary, or known buggy. This
+ eliminated all backends except CVS. Eliminates bug#7850.
+
* 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
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 19a8299..34a7c7b 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -178,113 +178,6 @@ in the repository root directory of FILE."
(insert-file-contents-literally file)
(sha1 (current-buffer))))
-(defun vc-bzr-state-heuristic (file)
- "Like `vc-bzr-state' but hopefully without running Bzr."
- ;; `bzr status' could be slow with large histories and pending merges,
- ;; so this tries to avoid calling it if possible. bzr status is
- ;; faster now, so this is not as important as it was.
- ;;
- ;; This function tries first to parse Bzr internal file
- ;; `checkout/dirstate', but it may fail if Bzr internal file format
- ;; has changed. As a safeguard, the `checkout/dirstate' file is
- ;; only parsed if it contains the string `#bazaar dirstate flat
- ;; format 3' in the first line.
- ;; If the `checkout/dirstate' file cannot be parsed, fall back to
- ;; running `vc-bzr-state'."
- ;;
- ;; The format of the dirstate file is explained in bzrlib/dirstate.py
- ;; in the bzr distribution. Basically:
- ;; header-line giving the version of the file format in use.
- ;; a few lines of stuff
- ;; entries, one per line, with null-separated fields. Each line:
- ;; entry_key = dirname (may be empty), basename, file-id
- ;; current = common ( = kind, fingerprint, size, executable )
- ;; + working ( = packed_stat )
- ;; parent = common ( as above ) + history ( = rev_id )
- ;; kinds = (r)elocated, (a)bsent, (d)irectory, (f)ile, (l)ink
- (let* ((root (vc-bzr-root file))
- (dirstate (expand-file-name vc-bzr-admin-dirstate root)))
- (when root ; Short cut.
- (condition-case err
- (with-temp-buffer
- (insert-file-contents dirstate)
- (goto-char (point-min))
- (if (not (looking-at "#bazaar dirstate flat format 3"))
- (vc-bzr-state file) ; Some other unknown format?
- (let* ((relfile (file-relative-name file root))
- (reldir (file-name-directory relfile)))
- (cond
- ((not
- (re-search-forward
- (concat "^\0"
- (if reldir (regexp-quote
- (directory-file-name reldir)))
- "\0"
- (regexp-quote (file-name-nondirectory relfile))
- "\0"
- "[^\0]*\0" ;id?
- "\\([^\0]*\\)\0" ;"a/f/d", a=removed?
- "\\([^\0]*\\)\0" ;sha1 (empty if conflicted)?
- "\\([^\0]*\\)\0" ;size?p
- ;; y/n. Whether or not the current copy
- ;; was executable the last time bzr checked?
- "[^\0]*\0"
- "[^\0]*\0" ;?
- ;; Parent information. Absent in a new repo.
- "\\(?:\\([^\0]*\\)\0" ;"a/f/d" a=added?
- "\\([^\0]*\\)\0" ;sha1 again?
- "\\([^\0]*\\)\0" ;size again?
- ;; y/n. Whether or not the repo thinks
- ;; the file should be executable?
- "\\([^\0]*\\)\0"
- "[^\0]*\0\\)?" ;last revid?
- ;; There are more fields when merges are pending.
- )
- nil t))
- 'unregistered)
- ;; Apparently the second sha1 is the one we want: when
- ;; there's a conflict, the first sha1 is absent (and the
- ;; first size seems to correspond to the file with
- ;; conflict markers).
- ((eq (char-after (match-beginning 1)) ?a) 'removed)
- ;; If there is no parent, this must be a new repo.
- ;; If file is in dirstate, can only be added (b#8025).
- ((or (not (match-beginning 4))
- (eq (char-after (match-beginning 4)) ?a)) 'added)
- ((or (and (eq (string-to-number (match-string 3))
- (nth 7 (file-attributes file)))
- (equal (match-string 5)
- (save-match-data (vc-bzr-sha1 file)))
- ;; For a file, does the executable state match?
- ;; (Bug#7544)
- (or (not
- (eq (char-after (match-beginning 1)) ?f))
- (let ((exe
- (memq
- ?x
- (mapcar
- 'identity
- (nth 8 (file-attributes file))))))
- (if (eq (char-after (match-beginning 7))
- ?y)
- exe
- (not exe)))))
- (and
- ;; It looks like for lightweight
- ;; checkouts \2 is empty and we need to
- ;; look for size in \6.
- (eq (match-beginning 2) (match-end 2))
- (eq (string-to-number (match-string 6))
- (nth 7 (file-attributes file)))
- (equal (match-string 5)
- (vc-bzr-sha1 file))))
- 'up-to-date)
- (t 'edited)))))
- ;; The dirstate file can't be read, or some other problem.
- (error
- (message "Falling back on \"slow\" status detection (%S)" err)
- (vc-bzr-state file))))))
-
;; This is a cheap approximation that is autoloaded. If it finds a
;; possible match it loads this file and runs the real function.
;; It requires vc-bzr-admin-checkout-format-file to be autoloaded too.
@@ -296,7 +189,7 @@ in the repository root directory of FILE."
(defun vc-bzr-registered (file)
"Return non-nil if FILE is registered with bzr."
- (let ((state (vc-bzr-state-heuristic file)))
+ (let ((state (vc-bzr-state file)))
(not (memq state '(nil unregistered ignored)))))
(defconst vc-bzr-state-words
@@ -494,8 +387,6 @@ in the branch repository (or whose status not be
determined)."
(message "There are unresolved conflicts in this file")))
(defun vc-bzr-working-revision (file)
- ;; Together with the code in vc-state-heuristic, this makes it possible
- ;; to get the initial VC state of a Bzr file even if Bzr is not installed.
(let* ((rootdir (vc-bzr-root file))
(branch-format-file (expand-file-name vc-bzr-admin-branch-format-file
rootdir))
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index e6ab771..dd1841d 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -133,10 +133,6 @@ It should return a status of either 0 (no differences
found), or
;;; Optional functions
-;; Should be faster than vc-dav-state - but how?
-(defun vc-dav-state-heuristic (url)
- "Estimate the version control state of URL at visiting time."
- (vc-dav-state url))
;; This should use url-dav-get-properties with a depth of `1' to get
;; all the properties.
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index f2cb997..0aceb55 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -50,7 +50,6 @@
;; STATE-QUERYING FUNCTIONS
;; * registered (file) OK
;; * state (file) OK
-;; - state-heuristic (file) NOT NEEDED
;; * working-revision (file) OK
;; - latest-on-branch-p (file) NOT NEEDED
;; * checkout-model (files) OK
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 52d5ceb..9bb79a7 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -43,7 +43,6 @@
;; STATE-QUERYING FUNCTIONS
;; * registered (file) OK
;; * state (file) OK
-;; - state-heuristic (file) NOT NEEDED
;; - dir-status (dir update-function) OK
;; - dir-status-files (dir files ds uf) OK
;; - dir-extra-headers (dir) OK
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 46a6b31..39c18d4 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -548,18 +548,12 @@ status of this file. Otherwise, the value returned is
one of:
"Quickly recompute the `state' of FILE."
(vc-file-setprop
file 'vc-state
- (vc-call-backend backend 'state-heuristic file)))
+ (vc-call-backend backend 'state file)))
(defsubst vc-up-to-date-p (file)
"Convenience function that checks whether `vc-state' of FILE is
`up-to-date'."
(eq (vc-state file) 'up-to-date))
-(defun vc-default-state-heuristic (backend file)
- "Default implementation of vc-BACKEND-state-heuristic.
-It simply calls the real state computation function `vc-BACKEND-state'
-and does not employ any heuristic at all."
- (vc-call-backend backend 'state file))
-
(defun vc-working-revision (file &optional backend)
"Return the repository version from which FILE was checked out.
If FILE is not registered, this function always returns nil."
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index 931dc5a..0462223 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -31,7 +31,6 @@
;; STATE-QUERYING FUNCTIONS
;; * registered (file) OK
;; * state (file) OK
-;; - state-heuristic (file) NOT NEEDED
;; * dir-status (dir update-function) OK
;; - dir-status-files (dir files ds uf) ??
;; - dir-extra-headers (dir) NOT NEEDED
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index fa584fa..0479519 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -9,7 +9,7 @@
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
+;; it under the` terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
@@ -162,25 +162,6 @@ If you want to force an empty list of arguments, use t."
(vc-svn-command t 0 file "status" (if localp "-v" "-u"))
(vc-svn-parse-status file))))
-;; NB this does not handle svn properties, which can be changed
-;; without changing the file timestamp.
-;; Note that unlike vc-cvs-state-heuristic, this is not called from
-;; vc-svn-state. AFAICS, it is only called from vc-state-refresh via
-;; vc-after-save (bug#7850). Therefore the fact that it ignores
-;; properties is irrelevant. If you want to make vc-svn-state call
-;; this, it should be extended to handle svn properties.
-(defun vc-svn-state-heuristic (file)
- "SVN-specific state heuristic."
- ;; If the file has not changed since checkout, consider it `up-to-date'.
- ;; Otherwise consider it `edited'. Copied from vc-cvs-state-heuristic.
- (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
- (lastmod (nth 5 (file-attributes file))))
- (cond
- ((equal checkout-time lastmod) 'up-to-date)
- ((string= (vc-working-revision file) "0") 'added)
- ((null checkout-time) 'unregistered)
- (t 'edited))))
-
;; FIXME it would be better not to have the "remote" argument,
;; but to distinguish the two output formats based on content.
(defun vc-svn-after-dir-status (callback &optional remote)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0d0639b..54fb9cd 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -128,16 +128,7 @@
;; Return the current version control state of FILE. For a list of
;; possible values, see `vc-state'. This function should do a full and
;; reliable state computation; it is usually called immediately after
-;; C-x v v. If you want to use a faster heuristic when visiting a
-;; file, put that into `state-heuristic' below. Note that under most
-;; VCSes this won't be called at all, dir-status is used instead.
-;;
-;; - state-heuristic (file)
-;;
-;; If provided, this function is used to estimate the version control
-;; state of FILE at visiting time. It should be considerably faster
-;; than the implementation of `state'. For a list of possible values,
-;; see the doc string of `vc-state'.
+;; C-x v v.
;;
;; - dir-status (dir update-function)
;;
@@ -590,6 +581,9 @@
;; moves closer to emulating modern non-locking behavior even on very
;; old VCSes.
;;
+;; - vc-state-heuristic is no longer a public method (the CVS backend
+;; retains it as a private one).
+;;
;; - 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 578d91a: Remove vc-state-heuristic from the set of public methods.,
Eric S. Raymond <=