]> git.eshelyaron.com Git - emacs.git/commitdiff
(vc-workfile-unchanged-p, vc-default-workfile-unchanged-p): Moved
authorAndré Spiegel <spiegel@gnu.org>
Tue, 15 Oct 2002 18:46:17 +0000 (18:46 +0000)
committerAndré Spiegel <spiegel@gnu.org>
Tue, 15 Oct 2002 18:46:17 +0000 (18:46 +0000)
here from vc.el.

lisp/vc-hooks.el

index bd6a036d30d3622683073f52624000dd3d9748d3..7d2da891750b17bf4d359aef9429511ac670ec76 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-hooks.el,v 1.134.4.2 2001/12/14 08:19:06 spiegel Exp $
+;; $Id: vc-hooks.el,v 1.134.4.3 2002/07/20 17:24:56 spiegel Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -383,6 +383,21 @@ 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))))
+    (if checkout-time
+        (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 master version.
+Return non-nil if FILE is unchanged."
+  (zerop (vc-call diff file (vc-workfile-version file))))
+
 (defun vc-workfile-version (file)
   "Return the version level of the current workfile FILE.
 If FILE is not registered, this function always returns nil."