diff options
| author | Paul Eggert | 1993-12-03 09:30:38 +0000 |
|---|---|---|
| committer | Paul Eggert | 1993-12-03 09:30:38 +0000 |
| commit | 9a51ed3ae46fef0fbd5d21778cb1c8c4667bf667 (patch) | |
| tree | 5e7902413b7db28b3dc1095be41851cb0781963e | |
| parent | 0fd6b1770a15bf68b6ef0b9abbe613b3ca5e9d45 (diff) | |
| download | emacs-9a51ed3ae46fef0fbd5d21778cb1c8c4667bf667.tar.gz emacs-9a51ed3ae46fef0fbd5d21778cb1c8c4667bf667.zip | |
(vc-workfile-unchanged-p): Add optional argument
specifying whether we want to compute the differences if the
file is changed. Otherwise, use cmp instead of diff.
(vc-next-action-on-file): Use new vc-workfile-unchanged-p option;
this avoids recomputing the differences in some cases.
(vc-backend-diff): OLDVERS is now optional; all callers changed.
New optional argument CMP says to use `cmp' rather than `diff'.
| -rw-r--r-- | lisp/vc.el | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 635b0298c00..0d6ac098dce 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -340,21 +340,17 @@ the master name of FILE; this is appended to an optional list of FLAGS." | |||
| 340 | (error "Aborted")) | 340 | (error "Aborted")) |
| 341 | (save-buffer)))) | 341 | (save-buffer)))) |
| 342 | 342 | ||
| 343 | (defun vc-workfile-unchanged-p (file) | 343 | (defun vc-workfile-unchanged-p (file &optional want-differences-if-changed) |
| 344 | ;; Has the given workfile changed since last checkout? | 344 | ;; Has the given workfile changed since last checkout? |
| 345 | (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) | 345 | (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) |
| 346 | (lastmod (nth 5 (file-attributes file)))) | 346 | (lastmod (nth 5 (file-attributes file)))) |
| 347 | (if checkout-time | 347 | (or (equal checkout-time lastmod) |
| 348 | (equal lastmod checkout-time) | 348 | (and (or (not checkout-time) want-differences-if-changed) |
| 349 | (if (zerop (vc-backend-diff file nil)) | 349 | (let ((unchanged (zerop (vc-backend-diff file nil nil |
| 350 | (progn | 350 | (not want-differences-if-changed))))) |
| 351 | (vc-file-setprop file 'vc-checkout-time lastmod) | 351 | ;; 0 stands for an unknown time; it can't match any mod time. |
| 352 | t) | 352 | (vc-file-setprop file 'vc-checkout-time (if unchanged lastmod 0)) |
| 353 | (progn | 353 | unchanged))))) |
| 354 | (vc-file-setprop file 'vc-checkout-time '(0 . 0)) | ||
| 355 | nil | ||
| 356 | )) | ||
| 357 | ))) | ||
| 358 | 354 | ||
| 359 | (defun vc-next-action-on-file (file verbose &optional comment) | 355 | (defun vc-next-action-on-file (file verbose &optional comment) |
| 360 | ;;; If comment is specified, it will be used as an admin or checkin comment. | 356 | ;;; If comment is specified, it will be used as an admin or checkin comment. |
| @@ -372,8 +368,7 @@ the master name of FILE; this is appended to an optional list of FLAGS." | |||
| 372 | ;; if there is no lock on the file, assert one and get it | 368 | ;; if there is no lock on the file, assert one and get it |
| 373 | ((not (setq owner (vc-locking-user file))) | 369 | ((not (setq owner (vc-locking-user file))) |
| 374 | (if (and vc-checkout-carefully | 370 | (if (and vc-checkout-carefully |
| 375 | (not (vc-workfile-unchanged-p file)) | 371 | (not (vc-workfile-unchanged-p file t))) |
| 376 | (not (zerop (vc-backend-diff file nil)))) | ||
| 377 | (if (save-window-excursion | 372 | (if (save-window-excursion |
| 378 | (pop-to-buffer "*vc*") | 373 | (pop-to-buffer "*vc*") |
| 379 | (goto-char (point-min)) | 374 | (goto-char (point-min)) |
| @@ -777,7 +772,7 @@ and two version designators specifying which versions to compare." | |||
| 777 | (setq unchanged (vc-workfile-unchanged-p buffer-file-name)) | 772 | (setq unchanged (vc-workfile-unchanged-p buffer-file-name)) |
| 778 | (if unchanged | 773 | (if unchanged |
| 779 | (message "No changes to %s since latest version." file) | 774 | (message "No changes to %s since latest version." file) |
| 780 | (vc-backend-diff file nil) | 775 | (vc-backend-diff file) |
| 781 | ;; Ideally, we'd like at this point to parse the diff so that | 776 | ;; Ideally, we'd like at this point to parse the diff so that |
| 782 | ;; the buffer effectively goes into compilation mode and we | 777 | ;; the buffer effectively goes into compilation mode and we |
| 783 | ;; can visit the old and new change locations via next-error. | 778 | ;; can visit the old and new change locations via next-error. |
| @@ -1622,22 +1617,27 @@ Return nil if there is no such person." | |||
| 1622 | ) | 1617 | ) |
| 1623 | ) | 1618 | ) |
| 1624 | 1619 | ||
| 1625 | (defun vc-backend-diff (file oldvers &optional newvers) | 1620 | (defun vc-backend-diff (file &optional oldvers newvers cmp) |
| 1626 | ;; Get a difference report between two versions | 1621 | ;; Get a difference report between two versions of FILE. |
| 1622 | ;; Get only a brief comparison report if CMP, a difference report otherwise. | ||
| 1627 | (if (eq (vc-backend-deduce file) 'SCCS) | 1623 | (if (eq (vc-backend-deduce file) 'SCCS) |
| 1628 | (setq oldvers (vc-lookup-triple file oldvers)) | 1624 | (setq oldvers (vc-lookup-triple file oldvers)) |
| 1629 | (setq newvers (vc-lookup-triple file newvers))) | 1625 | (setq newvers (vc-lookup-triple file newvers))) |
| 1630 | (apply 'vc-do-command 1 | 1626 | (let* ((command (or (vc-backend-dispatch file "vcdiff" "rcsdiff") |
| 1631 | (or (vc-backend-dispatch file "vcdiff" "rcsdiff") | 1627 | (vc-registration-error file))) |
| 1632 | (vc-registration-error file)) | 1628 | (options (append (list (and cmp "--brief") |
| 1633 | file | 1629 | "-q" |
| 1634 | "-q" | 1630 | (and oldvers (concat "-r" oldvers)) |
| 1635 | (and oldvers (concat "-r" oldvers)) | 1631 | (and newvers (concat "-r" newvers))) |
| 1636 | (and newvers (concat "-r" newvers)) | 1632 | (and (not cmp) |
| 1637 | (if (listp diff-switches) | 1633 | (if (listp diff-switches) |
| 1638 | diff-switches | 1634 | diff-switches |
| 1639 | (list diff-switches)) | 1635 | (list diff-switches))))) |
| 1640 | )) | 1636 | (status (apply 'vc-do-command 2 command file options))) |
| 1637 | ;; Some RCS versions don't understand "--brief"; work around this. | ||
| 1638 | (if (eq status 2) | ||
| 1639 | (apply 'vc-do-command 1 command file (if cmp options (cdr options))) | ||
| 1640 | status))) | ||
| 1641 | 1641 | ||
| 1642 | (defun vc-check-headers () | 1642 | (defun vc-check-headers () |
| 1643 | "Check if the current file has any headers in it." | 1643 | "Check if the current file has any headers in it." |