aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2009-09-14 04:38:49 +0000
committerDan Nicolaescu2009-09-14 04:38:49 +0000
commit32ba3abcc148f356994a77b72052cca9da85ee4b (patch)
tree80b02f751f602b61e02e0ad58bb32a4e149639b6
parent31cd2dd4e14916714a5178b57dfda171a219cc93 (diff)
downloademacs-32ba3abcc148f356994a77b72052cca9da85ee4b.tar.gz
emacs-32ba3abcc148f356994a77b72052cca9da85ee4b.zip
* vc.el (top): print-log method now takes an optional SHORTLOG
argument. Add a new method: root. * vc-hooks.el (vc-prefix-map, vc-menu-map): Add bindings for vc-print-root-log and vc-print-root-diff. * vc-bzr.el (vc-bzr-log-view-mode, vc-bzr-print-log): * vc-git.el (vc-git-print-log, vc-git-log-view-mode): * vc-hg.el (vc-hg-print-log, vc-hg-log-view-mode): Add support for short logs. * vc-cvs.el (vc-cvs-print-log): * vc-mtn.el (vc-mtn-print-log): * vc-rcs.el (vc-rcs-print-log): * vc-sccs.el (vc-sccs-print-log): * vc-svn.el (vc-svn-print-log): Add an optional argument shortlog that is ignored for now.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog24
-rw-r--r--lisp/vc-bzr.el26
-rw-r--r--lisp/vc-cvs.el2
-rw-r--r--lisp/vc-git.el31
-rw-r--r--lisp/vc-hg.el21
-rw-r--r--lisp/vc-hooks.el8
-rw-r--r--lisp/vc-mtn.el2
-rw-r--r--lisp/vc-rcs.el2
-rw-r--r--lisp/vc-sccs.el2
-rw-r--r--lisp/vc-svn.el2
-rw-r--r--lisp/vc.el93
12 files changed, 177 insertions, 39 deletions
diff --git a/etc/NEWS b/etc/NEWS
index c6772138bb6..90dff59083e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -155,6 +155,9 @@ Autorevert Tail mode works now for remote files.
155 155
156** VC and related modes 156** VC and related modes
157 157
158*** FIXME: add info about the new VC functions: vc-root-diff and
159vc-root-print-log once they stabilize.
160
158*** When a file is not found, VC will not try to check it out of RCS anymore. 161*** When a file is not found, VC will not try to check it out of RCS anymore.
159 162
160*** vc-git changes 163*** vc-git changes
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 72054a6835f..63e684b8132 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,27 @@
12009-09-14 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc.el (top): print-log method now takes an optional SHORTLOG
4 argument. Add a new method: root.
5
6 (vc-root-diff, vc-print-root-log): New functions.
7 (vc-log-short-style): New variable.
8 (vc-print-log-internal): Add support for showing short logs.
9
10 * vc-hooks.el (vc-prefix-map, vc-menu-map): Add bindings for
11 vc-print-root-log and vc-print-root-diff.
12
13 * vc-bzr.el (vc-bzr-log-view-mode, vc-bzr-print-log):
14 * vc-git.el (vc-git-print-log, vc-git-log-view-mode):
15 * vc-hg.el (vc-hg-print-log, vc-hg-log-view-mode): Add support for
16 short logs.
17
18 * vc-cvs.el (vc-cvs-print-log):
19 * vc-mtn.el (vc-mtn-print-log):
20 * vc-rcs.el (vc-rcs-print-log):
21 * vc-sccs.el (vc-sccs-print-log):
22 * vc-svn.el (vc-svn-print-log): Add an optional argument shortlog
23 that is ignored for now.
24
12009-09-14 Stefan Monnier <monnier@iro.umontreal.ca> 252009-09-14 Stefan Monnier <monnier@iro.umontreal.ca>
2 26
3 * simple.el: Add mapping for backspace/delete/clear/tab/escape/return 27 * simple.el: Add mapping for backspace/delete/clear/tab/escape/return
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el
index b7e0b65e48a..da9c97f2c17 100644
--- a/lisp/vc-bzr.el
+++ b/lisp/vc-bzr.el
@@ -453,6 +453,7 @@ REV non-nil gets an error."
453(defvar log-view-font-lock-keywords) 453(defvar log-view-font-lock-keywords)
454(defvar log-view-current-tag-function) 454(defvar log-view-current-tag-function)
455(defvar log-view-per-file-logs) 455(defvar log-view-per-file-logs)
456(defvar vc-short-log)
456 457
457(define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" 458(define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View"
458 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. 459 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
@@ -460,19 +461,27 @@ REV non-nil gets an error."
460 (set (make-local-variable 'log-view-per-file-logs) nil) 461 (set (make-local-variable 'log-view-per-file-logs) nil)
461 (set (make-local-variable 'log-view-file-re) "\\`a\\`") 462 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
462 (set (make-local-variable 'log-view-message-re) 463 (set (make-local-variable 'log-view-message-re)
463 "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)") 464 (if vc-short-log
465 "^ +\\([0-9]+\\) \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
466 "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)"))
464 (set (make-local-variable 'log-view-font-lock-keywords) 467 (set (make-local-variable 'log-view-font-lock-keywords)
465 ;; log-view-font-lock-keywords is careful to use the buffer-local 468 ;; log-view-font-lock-keywords is careful to use the buffer-local
466 ;; value of log-view-message-re only since Emacs-23. 469 ;; value of log-view-message-re only since Emacs-23.
467 (append `((,log-view-message-re . 'log-view-message-face)) 470 (if vc-short-log
468 ;; log-view-font-lock-keywords 471 (append `((,log-view-message-re
469 '(("^ *committer: \ 472 (1 'log-view-message-face)
473 (2 'change-log-name)
474 (3 'change-log-date)
475 (4 'change-log-list))))
476 (append `((,log-view-message-re . 'log-view-message-face))
477 ;; log-view-font-lock-keywords
478 '(("^ *committer: \
470\\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]" 479\\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]"
471 (1 'change-log-name) 480 (1 'change-log-name)
472 (2 'change-log-email)) 481 (2 'change-log-email))
473 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))) 482 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))))
474 483
475(defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22 484(defun vc-bzr-print-log (files &optional buffer shortlog) ; get buffer arg in Emacs 22
476 "Get bzr change log for FILES into specified BUFFER." 485 "Get bzr change log for FILES into specified BUFFER."
477 ;; `vc-do-command' creates the buffer, but we need it before running 486 ;; `vc-do-command' creates the buffer, but we need it before running
478 ;; the command. 487 ;; the command.
@@ -484,6 +493,7 @@ REV non-nil gets an error."
484 ;; way of getting the above regexps working. 493 ;; way of getting the above regexps working.
485 (with-current-buffer buffer 494 (with-current-buffer buffer
486 (apply 'vc-bzr-command "log" buffer 'async files 495 (apply 'vc-bzr-command "log" buffer 'async files
496 (if shortlog "--short")
487 (if (stringp vc-bzr-log-switches) 497 (if (stringp vc-bzr-log-switches)
488 (list vc-bzr-log-switches) 498 (list vc-bzr-log-switches)
489 vc-bzr-log-switches)))) 499 vc-bzr-log-switches))))
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index 55a03d79900..2d433b08e26 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -496,7 +496,7 @@ Will fail unless you have administrative privileges on the repo."
496 496
497(declare-function vc-rcs-print-log-cleanup "vc-rcs" ()) 497(declare-function vc-rcs-print-log-cleanup "vc-rcs" ())
498 498
499(defun vc-cvs-print-log (files &optional buffer) 499(defun vc-cvs-print-log (files &optional buffer shortlog)
500 "Get change logs associated with FILES." 500 "Get change logs associated with FILES."
501 (require 'vc-rcs) 501 (require 'vc-rcs)
502 ;; It's just the catenation of the individual logs. 502 ;; It's just the catenation of the individual logs.
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index d4b65127c3c..5230d54216e 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -471,7 +471,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
471 471
472;;; HISTORY FUNCTIONS 472;;; HISTORY FUNCTIONS
473 473
474(defun vc-git-print-log (files &optional buffer) 474(defun vc-git-print-log (files &optional buffer shortlog)
475 "Get change log associated with FILES." 475 "Get change log associated with FILES."
476 (let ((coding-system-for-read git-commits-coding-system) 476 (let ((coding-system-for-read git-commits-coding-system)
477 ;; Support both the old print-log interface that passes a 477 ;; Support both the old print-log interface that passes a
@@ -485,22 +485,38 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
485 (let ((inhibit-read-only t)) 485 (let ((inhibit-read-only t))
486 (with-current-buffer 486 (with-current-buffer
487 buffer 487 buffer
488 (if shortlog
488 (vc-git-command buffer 'async files 489 (vc-git-command buffer 'async files
489 "rev-list" "--pretty" "HEAD" "--"))))) 490 "log" ;; "--graph"
491 "--date=short" "--pretty=format:%h %ad %s" "--abbrev-commit"
492 "--")
493 (vc-git-command buffer 'async files
494 "rev-list" ;; "--graph"
495 "--pretty" "HEAD" "--"))))))
490 496
491(defvar log-view-message-re) 497(defvar log-view-message-re)
492(defvar log-view-file-re) 498(defvar log-view-file-re)
493(defvar log-view-font-lock-keywords) 499(defvar log-view-font-lock-keywords)
494(defvar log-view-per-file-logs) 500(defvar log-view-per-file-logs)
495 501
502;; Dynamically bound.
503(defvar vc-short-log)
504
496(define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View" 505(define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View"
497 (require 'add-log) ;; we need the faces add-log 506 (require 'add-log) ;; we need the faces add-log
498 ;; Don't have file markers, so use impossible regexp. 507 ;; Don't have file markers, so use impossible regexp.
499 (set (make-local-variable 'log-view-file-re) "\\`a\\`") 508 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
500 (set (make-local-variable 'log-view-per-file-logs) nil) 509 (set (make-local-variable 'log-view-per-file-logs) nil)
501 (set (make-local-variable 'log-view-message-re) 510 (set (make-local-variable 'log-view-message-re)
502 "^commit *\\([0-9a-z]+\\)") 511 (if vc-short-log
512 "^\\(?:[*/\\| ]+ \\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)"
513 "^[ */\\|]+commit *\\([0-9a-z]+\\)"))
503 (set (make-local-variable 'log-view-font-lock-keywords) 514 (set (make-local-variable 'log-view-font-lock-keywords)
515 (if vc-short-log
516 (append
517 `((,log-view-message-re
518 (1 'change-log-acknowledgement)
519 (2 'change-log-date))))
504 (append 520 (append
505 `((,log-view-message-re (1 'change-log-acknowledgement))) 521 `((,log-view-message-re (1 'change-log-acknowledgement)))
506 ;; Handle the case: 522 ;; Handle the case:
@@ -521,7 +537,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
521 (1 'change-log-acknowledgement) 537 (1 'change-log-acknowledgement)
522 (2 'change-log-acknowledgement)) 538 (2 'change-log-acknowledgement))
523 ("^Date: \\(.+\\)" (1 'change-log-date)) 539 ("^Date: \\(.+\\)" (1 'change-log-date))
524 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))) 540 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
541
525 542
526(defun vc-git-show-log-entry (revision) 543(defun vc-git-show-log-entry (revision)
527 "Move to the log entry for REVISION. 544 "Move to the log entry for REVISION.
@@ -678,6 +695,9 @@ or BRANCH^ (where \"^\" can be repeated)."
678 695
679(defun vc-git-extra-status-menu () vc-git-extra-menu-map) 696(defun vc-git-extra-status-menu () vc-git-extra-menu-map)
680 697
698(defun vc-git-root (file)
699 (vc-find-root file ".git"))
700
681(defun vc-git-toggle-signoff () 701(defun vc-git-toggle-signoff ()
682 (interactive) 702 (interactive)
683 (setq vc-git-add-signoff (not vc-git-add-signoff))) 703 (setq vc-git-add-signoff (not vc-git-add-signoff)))
@@ -763,9 +783,6 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
763 783
764;;; Internal commands 784;;; Internal commands
765 785
766(defun vc-git-root (file)
767 (vc-find-root file ".git"))
768
769(defun vc-git-command (buffer okstatus file-or-list &rest flags) 786(defun vc-git-command (buffer okstatus file-or-list &rest flags)
770 "A wrapper around `vc-do-command' for use in vc-git.el. 787 "A wrapper around `vc-do-command' for use in vc-git.el.
771The difference to vc-do-command is that this function always invokes `git'." 788The difference to vc-do-command is that this function always invokes `git'."
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index a8a8895de01..4a81ffb232f 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -68,7 +68,7 @@
68;; - merge-news (file) NEEDED 68;; - merge-news (file) NEEDED
69;; - steal-lock (file &optional revision) NOT NEEDED 69;; - steal-lock (file &optional revision) NOT NEEDED
70;; HISTORY FUNCTIONS 70;; HISTORY FUNCTIONS
71;; * print-log (files &optional buffer) OK 71;; * print-log (files &optional buffer shortlog)OK
72;; - log-view-mode () OK 72;; - log-view-mode () OK
73;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD 73;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
74;; - comment-history (file) NOT NEEDED 74;; - comment-history (file) NOT NEEDED
@@ -217,7 +217,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
217 (repeat :tag "Argument List" :value ("") string)) 217 (repeat :tag "Argument List" :value ("") string))
218 :group 'vc-hg) 218 :group 'vc-hg)
219 219
220(defun vc-hg-print-log (files &optional buffer) 220(defun vc-hg-print-log (files &optional buffer shortlog)
221 "Get change log associated with FILES." 221 "Get change log associated with FILES."
222 ;; `log-view-mode' needs to have the file names in order to function 222 ;; `log-view-mode' needs to have the file names in order to function
223 ;; correctly. "hg log" does not print it, so we insert it here by 223 ;; correctly. "hg log" does not print it, so we insert it here by
@@ -231,20 +231,31 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
231 (let ((inhibit-read-only t)) 231 (let ((inhibit-read-only t))
232 (with-current-buffer 232 (with-current-buffer
233 buffer 233 buffer
234 (apply 'vc-hg-command buffer 0 files "log" vc-hg-log-switches)))) 234 (apply 'vc-hg-command buffer 0 files "log"
235 (if shortlog '("--style" "compact"))
236 vc-hg-log-switches))))
235 237
236(defvar log-view-message-re) 238(defvar log-view-message-re)
237(defvar log-view-file-re) 239(defvar log-view-file-re)
238(defvar log-view-font-lock-keywords) 240(defvar log-view-font-lock-keywords)
239(defvar log-view-per-file-logs) 241(defvar log-view-per-file-logs)
242(defvar vc-short-log)
240 243
241(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" 244(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
242 (require 'add-log) ;; we need the add-log faces 245 (require 'add-log) ;; we need the add-log faces
243 (set (make-local-variable 'log-view-file-re) "\\`a\\`") 246 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
244 (set (make-local-variable 'log-view-per-file-logs) nil) 247 (set (make-local-variable 'log-view-per-file-logs) nil)
245 (set (make-local-variable 'log-view-message-re) 248 (set (make-local-variable 'log-view-message-re)
246 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)") 249 (if vc-short-log
250 "^\\([0-9]+\\)\\(?:\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$"
251 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)"))
247 (set (make-local-variable 'log-view-font-lock-keywords) 252 (set (make-local-variable 'log-view-font-lock-keywords)
253 (if vc-short-log
254 (append `((,log-view-message-re
255 (1 'log-view-message-face)
256 (2 'log-view-message-face)
257 (3 'change-log-date)
258 (4 'change-log-name))))
248 (append 259 (append
249 log-view-font-lock-keywords 260 log-view-font-lock-keywords
250 '( 261 '(
@@ -260,7 +271,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
260 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)" 271 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
261 (1 'change-log-email)) 272 (1 'change-log-email))
262 ("^date: \\(.+\\)" (1 'change-log-date)) 273 ("^date: \\(.+\\)" (1 'change-log-date))
263 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))) 274 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
264 275
265(defun vc-hg-diff (files &optional oldvers newvers buffer) 276(defun vc-hg-diff (files &optional oldvers newvers buffer)
266 "Get a difference report using hg between two revisions of FILES." 277 "Get a difference report using hg between two revisions of FILES."
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 20fd73d641f..ca007c16543 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -938,6 +938,7 @@ current, and kill the buffer that visits the link."
938 (define-key map "h" 'vc-insert-headers) 938 (define-key map "h" 'vc-insert-headers)
939 (define-key map "i" 'vc-register) 939 (define-key map "i" 'vc-register)
940 (define-key map "l" 'vc-print-log) 940 (define-key map "l" 'vc-print-log)
941 (define-key map "L" 'vc-print-root-log)
941 (define-key map "m" 'vc-merge) 942 (define-key map "m" 'vc-merge)
942 (define-key map "r" 'vc-retrieve-tag) 943 (define-key map "r" 'vc-retrieve-tag)
943 (define-key map "s" 'vc-create-tag) 944 (define-key map "s" 'vc-create-tag)
@@ -945,6 +946,7 @@ current, and kill the buffer that visits the link."
945 (define-key map "v" 'vc-next-action) 946 (define-key map "v" 'vc-next-action)
946 (define-key map "+" 'vc-update) 947 (define-key map "+" 'vc-update)
947 (define-key map "=" 'vc-diff) 948 (define-key map "=" 'vc-diff)
949 (define-key map "D" 'vc-root-diff)
948 (define-key map "~" 'vc-revision-other-window) 950 (define-key map "~" 'vc-revision-other-window)
949 map)) 951 map))
950(fset 'vc-prefix-map vc-prefix-map) 952(fset 'vc-prefix-map vc-prefix-map)
@@ -973,12 +975,18 @@ current, and kill the buffer that visits the link."
973 (define-key map [vc-diff] 975 (define-key map [vc-diff]
974 '(menu-item "Compare with Base Version" vc-diff 976 '(menu-item "Compare with Base Version" vc-diff
975 :help "Compare file set with the base version")) 977 :help "Compare file set with the base version"))
978 (define-key map [vc-root-diff]
979 '(menu-item "Compare Tree with Base Version" vc-root-diff
980 :help "Compare current tree with the base version"))
976 (define-key map [vc-update-change-log] 981 (define-key map [vc-update-change-log]
977 '(menu-item "Update ChangeLog" vc-update-change-log 982 '(menu-item "Update ChangeLog" vc-update-change-log
978 :help "Find change log file and add entries from recent version control logs")) 983 :help "Find change log file and add entries from recent version control logs"))
979 (define-key map [vc-print-log] 984 (define-key map [vc-print-log]
980 '(menu-item "Show History" vc-print-log 985 '(menu-item "Show History" vc-print-log
981 :help "List the change log of the current file set in a window")) 986 :help "List the change log of the current file set in a window"))
987 (define-key map [vc-print-root-log]
988 '(menu-item "Show Top of the Tree History " vc-print-root-log
989 :help "List the change log for the current tree in a window"))
982 (define-key map [separator2] '("----")) 990 (define-key map [separator2] '("----"))
983 (define-key map [vc-insert-header] 991 (define-key map [vc-insert-header]
984 '(menu-item "Insert Header" vc-insert-headers 992 '(menu-item "Insert Header" vc-insert-headers
diff --git a/lisp/vc-mtn.el b/lisp/vc-mtn.el
index a6d1d99de81..2127199887e 100644
--- a/lisp/vc-mtn.el
+++ b/lisp/vc-mtn.el
@@ -188,7 +188,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
188;; (defun vc-mtn-roolback (files) 188;; (defun vc-mtn-roolback (files)
189;; ) 189;; )
190 190
191(defun vc-mtn-print-log (files &optional buffer) 191(defun vc-mtn-print-log (files &optional buffer shortlog)
192 (vc-mtn-command buffer 0 files "log")) 192 (vc-mtn-command buffer 0 files "log"))
193 193
194(defvar log-view-message-re) 194(defvar log-view-message-re)
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el
index 7e01709ccb4..97e5ff62a69 100644
--- a/lisp/vc-rcs.el
+++ b/lisp/vc-rcs.el
@@ -549,7 +549,7 @@ directory the operation is applied to all registered files beneath it."
549 (when (looking-at "[\b\t\n\v\f\r ]+") 549 (when (looking-at "[\b\t\n\v\f\r ]+")
550 (delete-char (- (match-end 0) (match-beginning 0)))))) 550 (delete-char (- (match-end 0) (match-beginning 0))))))
551 551
552(defun vc-rcs-print-log (files &optional buffer) 552(defun vc-rcs-print-log (files &optional buffer shortlog)
553 "Get change log associated with FILE. If FILE is a 553 "Get change log associated with FILE. If FILE is a
554directory the operation is applied to all registered files beneath it." 554directory the operation is applied to all registered files beneath it."
555 (vc-do-command (or buffer "*vc*") 0 "rlog" (mapcar 'vc-name (vc-expand-dirs files))) 555 (vc-do-command (or buffer "*vc*") 0 "rlog" (mapcar 'vc-name (vc-expand-dirs files)))
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el
index 3d9ac3833ad..4a614033b9a 100644
--- a/lisp/vc-sccs.el
+++ b/lisp/vc-sccs.el
@@ -331,7 +331,7 @@ revert all subfiles."
331;;; History functions 331;;; History functions
332;;; 332;;;
333 333
334(defun vc-sccs-print-log (files &optional buffer) 334(defun vc-sccs-print-log (files &optional buffer shortlog)
335 "Get change log associated with FILES." 335 "Get change log associated with FILES."
336 (setq files (vc-expand-dirs files)) 336 (setq files (vc-expand-dirs files))
337 (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files))) 337 (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files)))
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el
index b07a6642192..e10073e6b54 100644
--- a/lisp/vc-svn.el
+++ b/lisp/vc-svn.el
@@ -462,7 +462,7 @@ or svn+ssh://."
462 (require 'add-log) 462 (require 'add-log)
463 (set (make-local-variable 'log-view-per-file-logs) nil)) 463 (set (make-local-variable 'log-view-per-file-logs) nil))
464 464
465(defun vc-svn-print-log (files &optional buffer) 465(defun vc-svn-print-log (files &optional buffer shortlog)
466 "Get change log(s) associated with FILES." 466 "Get change log(s) associated with FILES."
467 (save-current-buffer 467 (save-current-buffer
468 (vc-setup-buffer buffer) 468 (vc-setup-buffer buffer)
diff --git a/lisp/vc.el b/lisp/vc.el
index fd95d86c5e1..d4151323105 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -346,11 +346,12 @@
346;; 346;;
347;; HISTORY FUNCTIONS 347;; HISTORY FUNCTIONS
348;; 348;;
349;; * print-log (files &optional buffer) 349;; * print-log (files &optional buffer shortlog)
350;; 350;;
351;; Insert the revision log for FILES into BUFFER, or the *vc* buffer 351;; Insert the revision log for FILES into BUFFER, or the *vc* buffer
352;; if BUFFER is nil. (Note: older versions of this function expected 352;; if BUFFER is nil. (Note: older versions of this function expected
353;; only a single file argument.) 353;; only a single file argument.)
354;; If SHORTLOG is true insert a short version of the log.
354;; 355;;
355;; - log-view-mode () 356;; - log-view-mode ()
356;; 357;;
@@ -461,6 +462,9 @@
461;; `revert' operations itself, without calling the backend system. The 462;; `revert' operations itself, without calling the backend system. The
462;; default implementation always returns nil. 463;; default implementation always returns nil.
463;; 464;;
465;; - root (file)
466;; Return the root of the VC controlled hierarchy for file.
467;;
464;; - repository-hostname (dirname) 468;; - repository-hostname (dirname)
465;; 469;;
466;; Return the hostname that the backend will have to contact 470;; Return the hostname that the backend will have to contact
@@ -1597,6 +1601,33 @@ saving the buffer."
1597 (vc-diff-internal t (vc-deduce-fileset) nil nil (interactive-p)))) 1601 (vc-diff-internal t (vc-deduce-fileset) nil nil (interactive-p))))
1598 1602
1599;;;###autoload 1603;;;###autoload
1604(defun vc-root-diff (historic &optional not-urgent)
1605 "Display diffs between file revisions.
1606Normally this compares the currently selected fileset with their
1607working revisions. With a prefix argument HISTORIC, it reads two revision
1608designators specifying which revisions to compare.
1609
1610The optional argument NOT-URGENT non-nil means it is ok to say no to
1611saving the buffer."
1612 (interactive (list current-prefix-arg t))
1613 (if historic
1614 ;; FIXME: this does not work right, `vc-version-diff' ends up
1615 ;; calling `vc-deduce-fileset' to find the files to diff, and
1616 ;; that's not what we want here, we want the diff for the VC root dir.
1617 (call-interactively 'vc-version-diff)
1618 (when buffer-file-name (vc-buffer-sync not-urgent))
1619 (let ((backend
1620 (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
1621 (vc-mode (vc-backend buffer-file-name))))
1622 rootdir working-revision)
1623 (unless backend
1624 (error "Buffer is not version controlled"))
1625 (setq rootdir (vc-call-backend backend 'root default-directory))
1626 (setq working-revision (vc-working-revision rootdir))
1627 (vc-diff-internal
1628 t (list backend (list rootdir) working-revision) nil nil (interactive-p)))))
1629
1630;;;###autoload
1600(defun vc-revision-other-window (rev) 1631(defun vc-revision-other-window (rev)
1601 "Visit revision REV of the current file in another window. 1632 "Visit revision REV of the current file in another window.
1602If the current file is named `F', the revision is named `F.~REV~'. 1633If the current file is named `F', the revision is named `F.~REV~'.
@@ -1822,23 +1853,43 @@ allowed and simply skipped)."
1822 1853
1823;; Miscellaneous other entry points 1854;; Miscellaneous other entry points
1824 1855
1856;; FIXME: this should be a defcustom
1857;; FIXME: maybe add another choice:
1858;; `root-directory' (or somesuch), which would mean show a short log
1859;; for the root directory.
1860(defvar vc-log-short-style '(directory)
1861 "Whether or not to show a short log.
1862If it contains `directory' then if the fileset contains a directory show a short log.
1863If it contains `file' then show short logs for files.
1864Not all VC backends support short logs!")
1865
1825(defun vc-print-log-internal (backend files working-revision) 1866(defun vc-print-log-internal (backend files working-revision)
1826 ;; Don't switch to the output buffer before running the command, 1867 ;; Don't switch to the output buffer before running the command,
1827 ;; so that any buffer-local settings in the vc-controlled 1868 ;; so that any buffer-local settings in the vc-controlled
1828 ;; buffer can be accessed by the command. 1869 ;; buffer can be accessed by the command.
1829 (vc-call-backend backend 'print-log files "*vc-change-log*") 1870 (let ((dir-present nil)
1830 (pop-to-buffer "*vc-change-log*") 1871 (vc-short-log nil))
1831 (vc-exec-after 1872 (dolist (file files)
1832 `(let ((inhibit-read-only t)) 1873 (when (file-directory-p file)
1833 (vc-call-backend ',backend 'log-view-mode) 1874 (setq dir-present t)))
1834 (set (make-local-variable 'log-view-vc-backend) ',backend) 1875 (setq vc-short-log
1835 (set (make-local-variable 'log-view-vc-fileset) ',files) 1876 (not (null (if dir-present
1836 1877 (memq 'directory vc-log-short-style)
1837 (shrink-window-if-larger-than-buffer) 1878 (memq 'file vc-log-short-style)))))
1838 ;; move point to the log entry for the working revision 1879 (vc-call-backend backend 'print-log files "*vc-change-log*" vc-short-log)
1839 (vc-call-backend ',backend 'show-log-entry ',working-revision) 1880 (pop-to-buffer "*vc-change-log*")
1840 (setq vc-sentinel-movepoint (point)) 1881 (vc-exec-after
1841 (set-buffer-modified-p nil)))) 1882 `(let ((inhibit-read-only t)
1883 (vc-short-log ,vc-short-log))
1884 (vc-call-backend ',backend 'log-view-mode)
1885 (set (make-local-variable 'log-view-vc-backend) ',backend)
1886 (set (make-local-variable 'log-view-vc-fileset) ',files)
1887
1888 (shrink-window-if-larger-than-buffer)
1889 ;; move point to the log entry for the working revision
1890 (vc-call-backend ',backend 'show-log-entry ',working-revision)
1891 (setq vc-sentinel-movepoint (point))
1892 (set-buffer-modified-p nil)))))
1842 1893
1843;;;###autoload 1894;;;###autoload
1844(defun vc-print-log (&optional working-revision) 1895(defun vc-print-log (&optional working-revision)
@@ -1852,6 +1903,20 @@ If WORKING-REVISION is non-nil, leave the point at that revision."
1852 (vc-print-log-internal backend files working-revision))) 1903 (vc-print-log-internal backend files working-revision)))
1853 1904
1854;;;###autoload 1905;;;###autoload
1906(defun vc-print-root-log ()
1907 "List the change log of for the current VC controlled tree in a window."
1908 (interactive)
1909 (let ((backend
1910 (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
1911 (vc-mode (vc-backend buffer-file-name))))
1912 rootdir working-revision)
1913 (unless backend
1914 (error "Buffer is not version controlled"))
1915 (setq rootdir (vc-call-backend backend 'root default-directory))
1916 (setq working-revision (vc-working-revision rootdir))
1917 (vc-print-log-internal backend (list rootdir) working-revision)))
1918
1919;;;###autoload
1855(defun vc-revert () 1920(defun vc-revert ()
1856 "Revert working copies of the selected fileset to their repository contents. 1921 "Revert working copies of the selected fileset to their repository contents.
1857This asks for confirmation if the buffer contents are not identical 1922This asks for confirmation if the buffer contents are not identical