diff options
| author | Dan Nicolaescu | 2009-11-20 06:56:16 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2009-11-20 06:56:16 +0000 |
| commit | 8de724f3d10d0a11cf0ef971084659a36bdb02b6 (patch) | |
| tree | 6b78493fdd8d36e25fa295d2cb8c62fa539ff9ab | |
| parent | 7a2efa6f088dee91feb2c095f81cf9c2030c2e97 (diff) | |
| download | emacs-8de724f3d10d0a11cf0ef971084659a36bdb02b6.tar.gz emacs-8de724f3d10d0a11cf0ef971084659a36bdb02b6.zip | |
(vc-deduce-fileset): Allow non-state changing operations
from a dired buffer.
(vc-dired-deduce-fileset): New function.
(vc-root-diff, vc-print-root-log): Use it.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc.el | 15 |
3 files changed, 21 insertions, 1 deletions
| @@ -230,6 +230,8 @@ advantage of this feature. | |||
| 230 | 230 | ||
| 231 | *** When a file is not found, VC will not try to check it out of RCS anymore. | 231 | *** When a file is not found, VC will not try to check it out of RCS anymore. |
| 232 | 232 | ||
| 233 | *** Diff and log operations can be used from dired buffers. | ||
| 234 | |||
| 233 | *** vc-git changes | 235 | *** vc-git changes |
| 234 | 236 | ||
| 235 | **** The new variable vc-git-add-signoff can be used to add a | 237 | **** The new variable vc-git-add-signoff can be used to add a |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e68d1e6012f..a05579268bf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2009-11-20 Dan Nicolaescu <dann@ics.uci.edu> | 1 | 2009-11-20 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 2 | ||
| 3 | * vc.el (vc-deduce-fileset): Allow non-state changing operations | ||
| 4 | from a dired buffer. | ||
| 5 | (vc-dired-deduce-fileset): New function. | ||
| 6 | (vc-root-diff, vc-print-root-log): Use it. | ||
| 7 | |||
| 3 | * vc-annotate.el (vc-annotate-show-log-revision-at-line): Pass a | 8 | * vc-annotate.el (vc-annotate-show-log-revision-at-line): Pass a |
| 4 | nil LIMIT argument to vc-print-log-internal. | 9 | nil LIMIT argument to vc-print-log-internal. |
| 5 | 10 | ||
diff --git a/lisp/vc.el b/lisp/vc.el index f58ba6ebab9..7c4cfbd28af 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -617,7 +617,8 @@ | |||
| 617 | (require 'vc-dispatcher) | 617 | (require 'vc-dispatcher) |
| 618 | 618 | ||
| 619 | (eval-when-compile | 619 | (eval-when-compile |
| 620 | (require 'cl)) | 620 | (require 'cl) |
| 621 | (require 'dired)) | ||
| 621 | 622 | ||
| 622 | (unless (assoc 'vc-parent-buffer minor-mode-alist) | 623 | (unless (assoc 'vc-parent-buffer minor-mode-alist) |
| 623 | (setq minor-mode-alist | 624 | (setq minor-mode-alist |
| @@ -902,6 +903,10 @@ current buffer." | |||
| 902 | (cond | 903 | (cond |
| 903 | ((derived-mode-p 'vc-dir-mode) | 904 | ((derived-mode-p 'vc-dir-mode) |
| 904 | (vc-dir-deduce-fileset state-model-only-files)) | 905 | (vc-dir-deduce-fileset state-model-only-files)) |
| 906 | ((derived-mode-p 'dired-mode) | ||
| 907 | (if observer | ||
| 908 | (vc-dired-deduce-fileset) | ||
| 909 | (error "State changing VC operations not supported in `dired-mode'"))) | ||
| 905 | ((setq backend (vc-backend buffer-file-name)) | 910 | ((setq backend (vc-backend buffer-file-name)) |
| 906 | (if state-model-only-files | 911 | (if state-model-only-files |
| 907 | (list backend (list buffer-file-name) | 912 | (list backend (list buffer-file-name) |
| @@ -930,6 +935,12 @@ current buffer." | |||
| 930 | (list buffer-file-name)))) | 935 | (list buffer-file-name)))) |
| 931 | (t (error "No fileset is available here"))))) | 936 | (t (error "No fileset is available here"))))) |
| 932 | 937 | ||
| 938 | (defun vc-dired-deduce-fileset () | ||
| 939 | (let ((backend (vc-responsible-backend default-directory))) | ||
| 940 | (unless backend (error "Directory not under VC")) | ||
| 941 | (list backend | ||
| 942 | (dired-map-over-marks (dired-get-filename nil t) nil)))) | ||
| 943 | |||
| 933 | (defun vc-ensure-vc-buffer () | 944 | (defun vc-ensure-vc-buffer () |
| 934 | "Make sure that the current buffer visits a version-controlled file." | 945 | "Make sure that the current buffer visits a version-controlled file." |
| 935 | (cond | 946 | (cond |
| @@ -1601,6 +1612,7 @@ saving the buffer." | |||
| 1601 | (when buffer-file-name (vc-buffer-sync not-urgent)) | 1612 | (when buffer-file-name (vc-buffer-sync not-urgent)) |
| 1602 | (let ((backend | 1613 | (let ((backend |
| 1603 | (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) | 1614 | (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) |
| 1615 | ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory)) | ||
| 1604 | (vc-mode (vc-backend buffer-file-name)))) | 1616 | (vc-mode (vc-backend buffer-file-name)))) |
| 1605 | rootdir working-revision) | 1617 | rootdir working-revision) |
| 1606 | (unless backend | 1618 | (unless backend |
| @@ -1937,6 +1949,7 @@ If WORKING-REVISION is non-nil, leave the point at that revision." | |||
| 1937 | (list nil)))) | 1949 | (list nil)))) |
| 1938 | (let ((backend | 1950 | (let ((backend |
| 1939 | (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) | 1951 | (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) |
| 1952 | ((derived-mode-p 'dired-mode) (vc-responsible-backend default-directory)) | ||
| 1940 | (vc-mode (vc-backend buffer-file-name)))) | 1953 | (vc-mode (vc-backend buffer-file-name)))) |
| 1941 | rootdir working-revision) | 1954 | rootdir working-revision) |
| 1942 | (unless backend | 1955 | (unless backend |