summaryrefslogtreecommitdiff
path: root/lisp/vc
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-12-01 08:24:27 -0500
committerEric S. Raymond <esr@thyrsus.com>2014-12-01 08:24:27 -0500
commitf82f3f1f177c1a9cc2c2236f51acd1be1809ae1f (patch)
tree76163b25a84c8416f7f529b9331778020cb7dc8b /lisp/vc
parent2532d74a5fb5168955aa900f597bf7efc14efb12 (diff)
downloademacs-f82f3f1f177c1a9cc2c2236f51acd1be1809ae1f.tar.gz
emacs-f82f3f1f177c1a9cc2c2236f51acd1be1809ae1f.tar.bz2
emacs-f82f3f1f177c1a9cc2c2236f51acd1be1809ae1f.zip
API simplification: remove vc-workfile-unchanged-p from pubic methods.
* 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 computation). This method was redundant with vc-state and usually implemented as a trivial call to same. Fixes the failure mode described in bug#694.
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/vc-arch.el4
-rw-r--r--lisp/vc/vc-bzr.el3
-rw-r--r--lisp/vc/vc-dav.el5
-rw-r--r--lisp/vc/vc-git.el4
-rw-r--r--lisp/vc/vc-hg.el5
-rw-r--r--lisp/vc/vc-hooks.el33
-rw-r--r--lisp/vc/vc-mtn.el3
-rw-r--r--lisp/vc/vc-rcs.el4
-rw-r--r--lisp/vc/vc-sccs.el4
-rw-r--r--lisp/vc/vc-src.el4
-rw-r--r--lisp/vc/vc.el18
11 files changed, 10 insertions, 77 deletions
diff --git a/lisp/vc/vc-arch.el b/lisp/vc/vc-arch.el
index 6d2e47291dc..eb6ea7d26a0 100644
--- a/lisp/vc/vc-arch.el
+++ b/lisp/vc/vc-arch.el
@@ -261,10 +261,6 @@ Only the value `maybe' can be trusted :-(."
;; Strip the terminating newline.
(buffer-substring (point-min) (1- (point-max)))))))))
-(defun vc-arch-workfile-unchanged-p (_file)
- "Stub: arch workfiles are always considered to be in a changed state,"
- nil)
-
(defun vc-arch-state (file)
;; There's no checkout operation and merging is not done from VC
;; so the only operation that's state dependent that VC supports is commit
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index afe8770ec10..19a8299485d 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -493,9 +493,6 @@ in the branch repository (or whose status not be determined)."
(add-hook 'after-save-hook 'vc-bzr-resolve-when-done nil t)
(message "There are unresolved conflicts in this file")))
-(defun vc-bzr-workfile-unchanged-p (file)
- (eq 'unchanged (car (vc-bzr-status 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.
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index ff4d5e51b5c..e6ab771ed81 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -144,11 +144,6 @@ It should return a status of either 0 (no differences found), or
"find the version control state of all files in DIR in a fast way."
)
-(defun vc-dav-workfile-unchanged-p (url)
- "Return non-nil if URL is unchanged from its current workfile version."
- ;; Probably impossible with webdav
- )
-
(defun vc-dav-responsible-p (url)
"Return non-nil if DAV considers itself `responsible' for URL."
;; Check for DAV support on the web server.
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index ae1b35636fd..f2cb99733ba 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -54,7 +54,6 @@
;; * working-revision (file) OK
;; - latest-on-branch-p (file) NOT NEEDED
;; * checkout-model (files) OK
-;; - workfile-unchanged-p (file) OK
;; - mode-line-string (file) OK
;; STATE-CHANGING FUNCTIONS
;; * create-repo () OK
@@ -248,9 +247,6 @@ matching the resulting Git log output, and KEYWORDS is a list of
str)
(vc-git--rev-parse "HEAD"))))
-(defun vc-git-workfile-unchanged-p (file)
- (eq 'up-to-date (vc-git-state file)))
-
(defun vc-git-mode-line-string (file)
"Return a string for `vc-mode-line' to put in the mode line for FILE."
(let* ((rev (vc-working-revision file))
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 337107f2ef4..52d5ceb12ca 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -51,7 +51,6 @@
;; * working-revision (file) OK
;; - latest-on-branch-p (file) ??
;; * checkout-model (files) OK
-;; - workfile-unchanged-p (file) OK
;; - mode-line-string (file) NOT NEEDED
;; STATE-CHANGING FUNCTIONS
;; * register (files &optional rev comment) OK
@@ -531,10 +530,6 @@ REV is the revision to check out into WORKFILE."
;; Modeled after the similar function in vc-bzr.el
-(defun vc-hg-workfile-unchanged-p (file)
- (eq 'up-to-date (vc-hg-state file)))
-
-;; Modeled after the similar function in vc-bzr.el
(defun vc-hg-revert (file &optional contents-done)
(unless contents-done
(with-temp-buffer (vc-hg-command t 0 file "revert"))))
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 3a2ad40ee35..7224aeeb5b3 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -576,39 +576,6 @@ 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-workfile-unchanged-p (file)
- "Return non-nil if FILE has not changed since the last checkout."
- (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
- (lastmod (nth 5 (file-attributes file))))
- ;; This is a shortcut for determining when the workfile is
- ;; unchanged. It can fail under some circumstances; see the
- ;; discussion in bug#694.
- (if (and checkout-time
- ;; Tramp and Ange-FTP return this when they don't know the time.
- (not (equal lastmod '(0 0))))
- (equal checkout-time lastmod)
- (let ((unchanged (vc-call workfile-unchanged-p file)))
- (vc-file-setprop file 'vc-checkout-time (if unchanged lastmod 0))
- unchanged))))
-
-(defun vc-default-workfile-unchanged-p (backend file)
- "Check if FILE is unchanged by diffing against the repository version.
-Return non-nil if FILE is unchanged."
- (zerop (condition-case err
- ;; If the implementation supports it, let the output
- ;; go to *vc*, not *vc-diff*, since this is an internal call.
- (vc-call-backend backend 'diff (list file) nil nil "*vc*")
- (wrong-number-of-arguments
- ;; If this error came from the above call to vc-BACKEND-diff,
- ;; try again without the optional buffer argument (for
- ;; backward compatibility). Otherwise, resignal.
- (if (or (not (eq (cadr err)
- (indirect-function
- (vc-find-backend-function backend 'diff))))
- (not (eq (cl-caddr err) 4)))
- (signal (car err) (cdr err))
- (vc-call-backend backend 'diff (list 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-mtn.el b/lisp/vc/vc-mtn.el
index f12ca0fd581..b32a1db744d 100644
--- a/lisp/vc/vc-mtn.el
+++ b/lisp/vc/vc-mtn.el
@@ -154,9 +154,6 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(re-search-forward "\\(?:Current b\\|B\\)ranch: *\\(.*\\)\n?\nChanges against parent \\(.*\\)")
(match-string 1))))
-(defun vc-mtn-workfile-unchanged-p (file)
- (not (eq (vc-mtn-state file) 'edited)))
-
;; Mode-line rewrite code copied from vc-arch.el.
(defcustom vc-mtn-mode-line-rewrite
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 572a83e7a38..3028d7e7b87 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -149,7 +149,7 @@ For a description of possible values, see `vc-check-master-templates'."
'vc-working-revision))))
(if (not (eq state 'up-to-date))
state
- (if (vc-workfile-unchanged-p file)
+ (if (vc-rcs-workfile-unchanged-p file)
'up-to-date
(if (eq (vc-rcs-checkout-model (list file)) 'locking)
'unlocked-changes
@@ -248,7 +248,7 @@ When VERSION is given, perform check for that version."
(vc-rcs-find-most-recent-rev (vc-branch-part version))))))
(defun vc-rcs-workfile-unchanged-p (file)
- "RCS-specific implementation of `vc-workfile-unchanged-p'."
+ "Has FILE remained unchanged since last checkout?"
;; Try to use rcsdiff --brief. If rcsdiff does not understand that,
;; do a double take and remember the fact for the future
(let* ((version (concat "-r" (vc-working-revision file)))
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 46e191ad399..8c9595a7461 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -124,7 +124,7 @@ For a description of possible values, see `vc-check-master-templates'."
(working-revision (vc-working-revision file))
(locking-user (cdr (assoc working-revision locks))))
(if (not locking-user)
- (if (vc-workfile-unchanged-p file)
+ (if (vc-sccs-workfile-unchanged-p file)
'up-to-date
'unlocked-changes)
(if (string= locking-user (vc-user-login-name file))
@@ -197,7 +197,7 @@ Optional string REV is a revision."
(write-region nil nil outfile nil 'silent)))
(defun vc-sccs-workfile-unchanged-p (file)
- "SCCS-specific implementation of `vc-workfile-unchanged-p'."
+ "Has FILE remained unchanged since last checkout?"
(let ((tempfile (make-temp-file "vc-sccs")))
(unwind-protect
(progn
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index 186f73f9890..931dc5a2a93 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -39,7 +39,6 @@
;; * working-revision (file) OK
;; - latest-on-branch-p (file) ??
;; * checkout-model (files) OK
-;; * workfile-unchanged-p (file) OK
;; - mode-line-string (file) NOT NEEDED
;; STATE-CHANGING FUNCTIONS
;; * register (files &optional rev comment) OK
@@ -213,9 +212,6 @@ This function differs from vc-do-command in that it invokes `vc-src-program'."
(vc-src-command standard-output file "list" "-f{1}" "@")))
"0"))
-(defun vc-src-workfile-unchanged-p (file)
- (eq 'up-to-date (vc-src-state file)))
-
;;;
;;; State-changing functions
;;;
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 62e68e221ee..1ae334683c1 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -200,17 +200,6 @@
;; Indicate whether FILES need to be "checked out" before they can be
;; edited. See `vc-checkout-model' for a list of possible values.
;;
-;; - workfile-unchanged-p (file)
-;;
-;; Return non-nil if FILE is unchanged from the working revision.
-;; This function should do a brief comparison of FILE's contents
-;; with those of the repository copy of the working revision. If
-;; the backend does not have such a brief-comparison feature, the
-;; default implementation of this function can be used, which
-;; delegates to a full vc-BACKEND-diff. (Note that vc-BACKEND-diff
-;; must not run asynchronously in this case, see variable
-;; `vc-disable-async-diff'.)
-;;
;; - mode-line-string (file)
;;
;; If provided, this function should return the VC-specific mode
@@ -609,6 +598,11 @@
;; take a first optional revision argument, since on no system since
;; RCS has setting the initial revision been even possible, let alone
;; sane.
+;;
+;; workfile-unchanged-p is no longer a public back-end method. It
+;; was redundant with vc-state and usually implemented with a trivial
+;; call to it. A few older back ends retain versions for internal use in
+;; their vc-state functions.
;;; Todo:
@@ -1186,7 +1180,7 @@ For old-style locking-based version control systems, like RCS:
;; For files with locking, if the file does not contain
;; any changes, just let go of the lock, i.e. revert.
(when (and (not (eq model 'implicit))
- (vc-workfile-unchanged-p file)
+ (eq state 'up-to-date)
;; If buffer is modified, that means the user just
;; said no to saving it; in that case, don't revert,
;; because the user might intend to save after