diff options
| -rw-r--r-- | lisp/vc-hooks.el | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index aaa8436b627..3717bea650a 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: FSF (see vc.el for full credits) | 5 | ;; Author: FSF (see vc.el for full credits) |
| 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 7 | 7 | ||
| 8 | ;; $Id: vc-hooks.el,v 1.142 2002/07/29 02:40:40 rms Exp $ | 8 | ;; $Id: vc-hooks.el,v 1.143 2002/08/23 13:23:14 spiegel Exp $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -34,6 +34,7 @@ | |||
| 34 | ;;; Code: | 34 | ;;; Code: |
| 35 | 35 | ||
| 36 | (eval-when-compile | 36 | (eval-when-compile |
| 37 | (require 'vc) | ||
| 37 | (require 'cl)) | 38 | (require 'cl)) |
| 38 | 39 | ||
| 39 | ;; Customization Variables (the rest is in vc.el) | 40 | ;; Customization Variables (the rest is in vc.el) |
| @@ -382,6 +383,21 @@ It simply calls the real state computation function `vc-BACKEND-state' | |||
| 382 | and does not employ any heuristic at all." | 383 | and does not employ any heuristic at all." |
| 383 | (vc-call-backend backend 'state file)) | 384 | (vc-call-backend backend 'state file)) |
| 384 | 385 | ||
| 386 | (defun vc-workfile-unchanged-p (file) | ||
| 387 | "Return non-nil if FILE has not changed since the last checkout." | ||
| 388 | (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) | ||
| 389 | (lastmod (nth 5 (file-attributes file)))) | ||
| 390 | (if checkout-time | ||
| 391 | (equal checkout-time lastmod) | ||
| 392 | (let ((unchanged (vc-call workfile-unchanged-p file))) | ||
| 393 | (vc-file-setprop file 'vc-checkout-time (if unchanged lastmod 0)) | ||
| 394 | unchanged)))) | ||
| 395 | |||
| 396 | (defun vc-default-workfile-unchanged-p (backend file) | ||
| 397 | "Check if FILE is unchanged by diffing against the master version. | ||
| 398 | Return non-nil if FILE is unchanged." | ||
| 399 | (zerop (vc-call diff file (vc-workfile-version file)))) | ||
| 400 | |||
| 385 | (defun vc-workfile-version (file) | 401 | (defun vc-workfile-version (file) |
| 386 | "Return the version level of the current workfile FILE. | 402 | "Return the version level of the current workfile FILE. |
| 387 | If FILE is not registered, this function always returns nil." | 403 | If FILE is not registered, this function always returns nil." |
| @@ -390,8 +406,6 @@ If FILE is not registered, this function always returns nil." | |||
| 390 | (vc-file-setprop file 'vc-workfile-version | 406 | (vc-file-setprop file 'vc-workfile-version |
| 391 | (vc-call workfile-version file))))) | 407 | (vc-call workfile-version file))))) |
| 392 | 408 | ||
| 393 | ;;; actual version-control code starts here | ||
| 394 | |||
| 395 | (defun vc-default-registered (backend file) | 409 | (defun vc-default-registered (backend file) |
| 396 | "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." | 410 | "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." |
| 397 | (let ((sym (vc-make-backend-sym backend 'master-templates))) | 411 | (let ((sym (vc-make-backend-sym backend 'master-templates))) |