aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc.el
diff options
context:
space:
mode:
authorEric S. Raymond <[email protected]>2008-05-09 20:17:50 +0000
committerEric S. Raymond <[email protected]>2008-05-09 20:17:50 +0000
commitcb5d44b66d1d8d5ab3de862896a25bae88e76da2 (patch)
tree1ce565f16d99d0e90dfe9d661b155532faf57246 /lisp/vc.el
parent79ac8f50ea15722da21f05f37f36eea632701ff2 (diff)
Dupport an use an observer flag in (vc-dispatcher-selection-set).
Diffstat (limited to 'lisp/vc.el')
-rw-r--r--lisp/vc.el18
1 files changed, 14 insertions, 4 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index 2a46d13873..55fc1cc9fa 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1002,10 +1002,10 @@ Only files already under version control are noticed."
node (lambda (f) (when (vc-backend f) (push f flattened)))))
(nreverse flattened)))
-(defun vc-deduce-fileset ()
+(defun vc-deduce-fileset (&optional observer)
"Deduce a set of files and a backend to which to apply an operation and
the common state of the fileset. Return (BACKEND . FILESET)."
- (let* ((fileset (vc-dispatcher-selection-set))
+ (let* ((fileset (vc-dispatcher-selection-set observer))
;; FIXME: Store the backend in a buffer-local variable.
(backend (if (derived-mode-p 'vc-dir-mode)
(vc-responsible-backend default-directory)
@@ -1031,6 +1031,16 @@ the common state of the fileset. Return (BACKEND . FILESET)."
(unless (vc-backend buffer-file-name)
(error "File %s is not under version control" buffer-file-name))))))
+(defun vc-buffer-sync (&optional not-urgent)
+ "Make sure the current buffer and its working file are in sync.
+NOT-URGENT means it is ok to continue if the user says not to save."
+ (when (buffer-modified-p)
+ (if (or vc-suppress-confirm
+ (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name))))
+ (save-buffer)
+ (unless not-urgent
+ (error "Aborted")))))
+
;;; Support for the C-x v v command.
;; This is where all the single-file-oriented code from before the fileset
;; rewrite lives.
@@ -1561,7 +1571,7 @@ returns t if the buffer had changes, nil otherwise."
(defun vc-version-diff (files rev1 rev2)
"Report diffs between revisions of the fileset in the repository history."
(interactive
- (let* ((vc-fileset (vc-deduce-fileset))
+ (let* ((vc-fileset (vc-deduce-fileset t))
(files (cdr vc-fileset))
(backend (car vc-fileset))
(first (car files))
@@ -2123,7 +2133,7 @@ allowed and simply skipped)."
"List the change log of the current fileset in a window.
If WORKING-REVISION is non-nil, leave the point at that revision."
(interactive)
- (let* ((vc-fileset (vc-deduce-fileset))
+ (let* ((vc-fileset (vc-deduce-fileset t))
(backend (car vc-fileset))
(files (cdr vc-fileset))
(working-revision (or working-revision (vc-working-revision (car files)))))