29041
|
1 ;;; log-view.el --- Major mode for browsing RCS/CVS/SCCS log output
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2
|
68651
|
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
87562
|
4 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5
|
70292
|
6 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
|
29041
|
7 ;; Keywords: rcs sccs cvs log version-control
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10
|
94678
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by
|
94678
|
13 ;; the Free Software Foundation, either version 3 of the License, or
|
|
14 ;; (at your option) any later version.
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful,
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details.
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License
|
94678
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 ;;; Commentary:
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25
|
67709
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
26 ;; Major mode to browse revision log histories.
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
27 ;; Currently supports the format output by:
|
68098
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
28 ;; RCS, SCCS, CVS, Subversion, and DaRCS.
|
67709
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
29
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
30 ;; Examples of log output:
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
31
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
32 ;;;; RCS/CVS:
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33
|
67709
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
34 ;; ----------------------------
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
35 ;; revision 1.35 locked by: turlutut
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
36 ;; date: 2005-03-22 18:48:38 +0000; author: monnier; state: Exp; lines: +6 -8
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
37 ;; (gnus-display-time-event-handler):
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
38 ;; Check display-time-timer at runtime rather than only at load time
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
39 ;; in case display-time-mode is turned off in the mean time.
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
40 ;; ----------------------------
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
41 ;; revision 1.34
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
42 ;; date: 2005-02-09 15:50:38 +0000; author: kfstorm; state: Exp; lines: +7 -7
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
43 ;; branches: 1.34.2;
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
44 ;; Change release version from 21.4 to 22.1 throughout.
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
45 ;; Change development version from 21.3.50 to 22.0.50.
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
46
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
47 ;;;; SCCS:
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
48
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
49 ;;;; Subversion:
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
50
|
87421
|
51 ;; ------------------------------------------------------------------------
|
|
52 ;; r4622 | ckuethe | 2007-12-23 18:18:01 -0500 (Sun, 23 Dec 2007) | 2 lines
|
96006
|
53 ;;
|
87421
|
54 ;; uBlox AEK-4T in binary mode. Added to unstable because it breaks gpsfake
|
96006
|
55 ;;
|
87421
|
56 ;; ------------------------------------------------------------------------
|
|
57 ;; r4621 | ckuethe | 2007-12-23 16:48:11 -0500 (Sun, 23 Dec 2007) | 3 lines
|
96006
|
58 ;;
|
87421
|
59 ;; Add a note about requiring usbfs to use the garmin gps18 (usb)
|
|
60 ;; Mention firmware testing the AC12 with firmware BQ00 and BQ04
|
96006
|
61 ;;
|
87421
|
62 ;; ------------------------------------------------------------------------
|
|
63 ;; r4620 | ckuethe | 2007-12-23 15:52:34 -0500 (Sun, 23 Dec 2007) | 1 line
|
96006
|
64 ;;
|
87421
|
65 ;; add link to latest hardware reference
|
|
66 ;; ------------------------------------------------------------------------
|
|
67 ;; r4619 | ckuethe | 2007-12-23 14:37:31 -0500 (Sun, 23 Dec 2007) | 1 line
|
96006
|
68 ;;
|
87421
|
69 ;; there is now a regression test for AC12 without raw data output
|
|
70
|
68098
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
71 ;;;; Darcs:
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
72
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
73 ;; Changes to darcsum.el:
|
96006
|
74 ;;
|
68098
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
75 ;; Mon Nov 28 15:19:38 GMT 2005 Dave Love <fx@gnu.org>
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
76 ;; * Abstract process startup into darcsum-start-process. Use TERM=dumb.
|
96006
|
77 ;; TERM=dumb avoids escape characters, at least, for any old darcs that
|
68098
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
78 ;; doesn't understand DARCS_DONT_COLOR & al.
|
96006
|
79 ;;
|
68098
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
80 ;; Thu Nov 24 15:20:45 GMT 2005 Dave Love <fx@gnu.org>
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
81 ;; * darcsum-mode-related changes.
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
82 ;; Don't call font-lock-mode (unnecessary) or use-local-map (redundant).
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
83 ;; Use mode-class 'special. Add :group.
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
84 ;; Add trailing-whitespace option to mode hook and fix
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
85 ;; darcsum-display-changeset not to use trailing whitespace.
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
86
|
87421
|
87 ;;;; Mercurial
|
|
88
|
|
89 ;; changeset: 11:8ff1a4166444
|
|
90 ;; tag: tip
|
|
91 ;; user: Eric S. Raymond <esr@thyrsus.com>
|
|
92 ;; date: Wed Dec 26 12:18:58 2007 -0500
|
|
93 ;; summary: Explain keywords. Add markup fixes.
|
96006
|
94 ;;
|
87421
|
95 ;; changeset: 10:20abc7ab09c3
|
|
96 ;; user: Eric S. Raymond <esr@thyrsus.com>
|
|
97 ;; date: Wed Dec 26 11:37:28 2007 -0500
|
|
98 ;; summary: Typo fixes.
|
96006
|
99 ;;
|
87421
|
100 ;; changeset: 9:ada9f4da88aa
|
|
101 ;; user: Eric S. Raymond <esr@thyrsus.com>
|
|
102 ;; date: Wed Dec 26 11:23:00 2007 -0500
|
|
103 ;; summary: Add RCS example session.
|
|
104
|
67709
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
105 ;;; Todo:
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
106
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 ;; - add ability to modify a log-entry (via cvs-mode-admin ;-)
|
29041
|
108 ;; - remove references to cvs-*
|
67709
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
109 ;; - make it easier to add support for new backends without changing the code.
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 ;;; Code:
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
112
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 (eval-when-compile (require 'cl))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
114 (require 'pcvs-util)
|
85139
|
115 (autoload 'vc-find-revision "vc")
|
40958
|
116 (autoload 'vc-version-diff "vc")
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117
|
65293
|
118 (defvar cvs-minor-wrap-function)
|
|
119
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 (defgroup log-view nil
|
29041
|
121 "Major mode for browsing log output of RCS/CVS/SCCS."
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
122 :group 'pcl-cvs
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 :prefix "log-view-")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 (easy-mmode-defmap log-view-mode-map
|
40958
|
126 '(("q" . quit-window)
|
|
127 ("z" . kill-this-buffer)
|
82826
|
128 ("m" . log-view-toggle-mark-entry)
|
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
129 ("e" . log-view-modify-change-comment)
|
40958
|
130 ("d" . log-view-diff)
|
95966
|
131 ("D" . log-view-diff-changeset)
|
78867
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
132 ("a" . log-view-annotate-version)
|
85139
|
133 ("f" . log-view-find-revision)
|
40958
|
134 ("n" . log-view-msg-next)
|
28251
|
135 ("p" . log-view-msg-prev)
|
78882
|
136 ("\t" . log-view-msg-next)
|
|
137 ([backtab] . log-view-msg-prev)
|
28251
|
138 ("N" . log-view-file-next)
|
|
139 ("P" . log-view-file-prev)
|
40450
|
140 ("\M-n" . log-view-file-next)
|
|
141 ("\M-p" . log-view-file-prev))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 "Log-View's keymap."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 :group 'log-view
|
29041
|
144 ;; Here I really need either buffer-local keymap-inheritance
|
|
145 ;; or a minor-mode-map with lower precedence than the local map.
|
|
146 :inherit (if (boundp 'cvs-mode-map) cvs-mode-map))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147
|
78077
|
148 (easy-menu-define log-view-mode-menu log-view-mode-map
|
|
149 "Log-View Display Menu"
|
|
150 `("Log-View"
|
|
151 ;; XXX Do we need menu entries for these?
|
|
152 ;; ["Quit" quit-window]
|
|
153 ;; ["Kill This Buffer" kill-this-buffer]
|
93893
|
154 ["Mark Log Entry for Diff" set-mark-command
|
|
155 :help ""]
|
|
156 ["Diff Revisions" log-view-diff
|
|
157 :help "Get the diff between two revisions"]
|
95966
|
158 ["Changeset Diff" log-view-diff-changeset
|
|
159 :help "Get the changeset diff between two revisions"]
|
93893
|
160 ["Visit Version" log-view-find-revision
|
|
161 :help "Visit the version at point"]
|
|
162 ["Annotate Version" log-view-annotate-version
|
|
163 :help "Annotate the version at point"]
|
93867
|
164 ["Modify Log Comment" log-view-modify-change-comment
|
|
165 :help "Edit the change comment displayed at point"]
|
|
166 "-----"
|
93893
|
167 ["Next Log Entry" log-view-msg-next
|
|
168 :help "Go to the next count'th log message"]
|
|
169 ["Previous Log Entry" log-view-msg-prev
|
|
170 :help "Go to the previous count'th log message"]
|
|
171 ["Next File" log-view-file-next
|
|
172 :help "Go to the next count'th file"]
|
|
173 ["Previous File" log-view-file-prev
|
|
174 :help "Go to the previous count'th file"]))
|
78077
|
175
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
176 (defvar log-view-mode-hook nil
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 "Hook run at the end of `log-view-mode'.")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178
|
63203
|
179 (defface log-view-file
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
180 '((((class color) (background light))
|
42456
|
181 (:background "grey70" :weight bold))
|
|
182 (t (:weight bold)))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
183 "Face for the file header line in `log-view-mode'."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
184 :group 'log-view)
|
63203
|
185 ;; backward-compatibility alias
|
|
186 (put 'log-view-file-face 'face-alias 'log-view-file)
|
|
187 (defvar log-view-file-face 'log-view-file)
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
188
|
63203
|
189 (defface log-view-message
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
190 '((((class color) (background light))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
191 (:background "grey85"))
|
42456
|
192 (t (:weight bold)))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
193 "Face for the message header line in `log-view-mode'."
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
194 :group 'log-view)
|
63203
|
195 ;; backward-compatibility alias
|
|
196 (put 'log-view-message-face 'face-alias 'log-view-message)
|
|
197 (defvar log-view-message-face 'log-view-message)
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
198
|
81511
9785d18889ed
(log-view-font-lock-keywords): Use `eval' to consult the
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
199 (defvar log-view-file-re
|
81330
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
200 (concat "^\\(?:Working file: \\(?1:.+\\)" ;RCS and CVS.
|
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
201 ;; Subversion has no such thing??
|
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
202 "\\|\\(?:SCCS/s\\.\\|Changes to \\)\\(?1:.+\\):" ;SCCS and Darcs.
|
81567
|
203 "\\)\n") ;Include the \n for font-lock reasons.
|
|
204 "Regexp matching the text identifying the file.
|
|
205 The match group number 1 should match the file name itself.")
|
67709
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
206
|
95966
|
207 (defvar log-view-per-file-logs t
|
|
208 "Set if to t if the logs are shown one file at a time.")
|
|
209
|
81511
9785d18889ed
(log-view-font-lock-keywords): Use `eval' to consult the
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
210 (defvar log-view-message-re
|
81330
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
211 (concat "^\\(?:revision \\(?1:[.0-9]+\\)\\(?:\t.*\\)?" ; RCS and CVS.
|
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
212 "\\|r\\(?1:[0-9]+\\) | .* | .*" ; Subversion.
|
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
213 "\\|D \\(?1:[.0-9]+\\) .*" ; SCCS.
|
68098
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
214 ;; Darcs doesn't have revision names. VC-darcs uses patch names
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
215 ;; instead. Darcs patch names are hashcodes, which do not appear
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
216 ;; in the log output :-(, but darcs accepts any prefix of the log
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
217 ;; message as a patch name, so we match the first line of the log
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
218 ;; message.
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
219 ;; First loosely match the date format.
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
220 (concat "\\|[^ \n].*[^0-9\n][0-9][0-9]:[0-9][0-9][^0-9\n].*[^ \n]"
|
150225f41e97
(log-view-file-re, log-view-message-re): Add support for DaRCS output.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
221 ;;Email of user and finally Msg, used as revision name.
|
81330
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
222 " .*@.*\n\\(?: \\* \\(?1:.*\\)\\)?")
|
78525
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
223 "\\)$")
|
81567
|
224 "Regexp matching the text identifying a revision.
|
|
225 The match group number 1 should match the revision number itself.")
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
226
|
78525
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
227 (defvar log-view-font-lock-keywords
|
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
228 ;; We use `eval' so as to use the buffer-local value of log-view-file-re
|
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
229 ;; and log-view-message-re, if applicable.
|
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
230 '((eval . `(,log-view-file-re
|
81511
9785d18889ed
(log-view-font-lock-keywords): Use `eval' to consult the
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
231 (1 (if (boundp 'cvs-filename-face) cvs-filename-face))
|
78525
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
232 (0 log-view-file-face append)))
|
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
233 (eval . `(,log-view-message-re . log-view-message-face))))
|
33690fc4e175
(log-view-font-lock-keywords): Use `eval' so as to adapt to buffer settings.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
234
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
235 (defconst log-view-font-lock-defaults
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
236 '(log-view-font-lock-keywords t nil nil nil))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
237
|
95966
|
238 (defvar log-view-vc-fileset nil
|
|
239 "Set this to the fileset corresponding to the current log.")
|
|
240
|
|
241 (defvar log-view-vc-backend nil
|
|
242 "Set this to the VC backend that created the current log.")
|
|
243
|
40954
|
244 ;;;;
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
245 ;;;; Actual code
|
40954
|
246 ;;;;
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
247
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
248 ;;;###autoload
|
28251
|
249 (define-derived-mode log-view-mode fundamental-mode "Log-View"
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
250 "Major mode for browsing CVS log output."
|
40958
|
251 (setq buffer-read-only t)
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
252 (set (make-local-variable 'font-lock-defaults) log-view-font-lock-defaults)
|
96006
|
253 (set (make-local-variable 'beginning-of-defun-function)
|
78867
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
254 'log-view-beginning-of-defun)
|
96006
|
255 (set (make-local-variable 'end-of-defun-function)
|
78867
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
256 'log-view-end-of-defun)
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
258
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
259 ;;;;
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 ;;;; Navigation
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
261 ;;;;
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262
|
28251
|
263 ;; define log-view-{msg,file}-{next,prev}
|
|
264 (easy-mmode-define-navigation log-view-msg log-view-message-re "log message")
|
|
265 (easy-mmode-define-navigation log-view-file log-view-file-re "file")
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
266
|
28861
|
267 (defun log-view-goto-rev (rev)
|
|
268 (goto-char (point-min))
|
|
269 (ignore-errors
|
|
270 (while (not (equal rev (log-view-current-tag)))
|
|
271 (log-view-msg-next))
|
|
272 t))
|
|
273
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
274 ;;;;
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
275 ;;;; Linkage to PCL-CVS (mostly copied from cvs-status.el)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
276 ;;;;
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
277
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
278 (defconst log-view-dir-re "^cvs[.ex]* [a-z]+: Logging \\(.+\\)$")
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
280 (defun log-view-current-file ()
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
281 (save-excursion
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
282 (forward-line 1)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 (or (re-search-backward log-view-file-re nil t)
|
83843
|
284 (re-search-forward log-view-file-re nil t)
|
83845
|
285 (error "Unable to determine the current file"))
|
81330
f7754bd2e73f
(log-view-file-re, log-view-message-re): Use \(?1:...\).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
286 (let* ((file (match-string 1))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
287 (cvsdir (and (re-search-backward log-view-dir-re nil t)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
288 (match-string 1)))
|
29041
|
289 (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re)
|
|
290 (re-search-backward cvs-pcl-cvs-dirchange-re nil t)
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
291 (match-string 1)))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
292 (dir ""))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 (let ((default-directory ""))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
294 (when pcldir (setq dir (expand-file-name pcldir dir)))
|
40958
|
295 (when cvsdir (setq dir (expand-file-name cvsdir dir))))
|
|
296 (expand-file-name file dir))))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
297
|
40958
|
298 (defun log-view-current-tag (&optional where)
|
28251
|
299 (save-excursion
|
40958
|
300 (when where (goto-char where))
|
28251
|
301 (forward-line 1)
|
|
302 (let ((pt (point)))
|
|
303 (when (re-search-backward log-view-message-re nil t)
|
82844
|
304 (let ((rev (match-string-no-properties 1)))
|
28251
|
305 (unless (re-search-forward log-view-file-re pt t)
|
|
306 rev))))))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
307
|
82826
|
308 (defun log-view-toggle-mark-entry ()
|
82852
|
309 "Toggle the marked state for the log entry at point.
|
|
310 Individual log entries can be marked and unmarked. The marked
|
|
311 entries are denoted by changing their background color.
|
|
312 `log-view-get-marked' returns the list of tags for the marked
|
|
313 log entries."
|
82826
|
314 (interactive)
|
|
315 (save-excursion
|
|
316 (forward-line 1)
|
|
317 (let ((pt (point)))
|
|
318 (when (re-search-backward log-view-message-re nil t)
|
|
319 (let ((beg (match-beginning 0))
|
|
320 end ov ovlist found tag)
|
|
321 (unless (re-search-forward log-view-file-re pt t)
|
82844
|
322 ;; Look to see if the current entry is marked.
|
|
323 (setq found (get-char-property (point) 'log-view-self))
|
82826
|
324 (if found
|
82844
|
325 (delete-overlay found)
|
|
326 ;; Create an overlay that covers this entry and change
|
87421
|
327 ;; its color.
|
82826
|
328 (setq tag (log-view-current-tag (point)))
|
|
329 (forward-line 1)
|
82844
|
330 (setq end
|
82826
|
331 (if (re-search-forward log-view-message-re nil t)
|
|
332 (match-beginning 0)
|
|
333 (point-max)))
|
|
334 (setq ov (make-overlay beg end))
|
|
335 (overlay-put ov 'face 'log-view-file)
|
82844
|
336 ;; This is used to check if the overlay is present.
|
|
337 (overlay-put ov 'log-view-self ov)
|
82826
|
338 (overlay-put ov 'log-view-marked tag))))))))
|
|
339
|
82844
|
340 (defun log-view-get-marked ()
|
82852
|
341 "Return the list of tags for the marked log entries."
|
82844
|
342 (save-excursion
|
|
343 (let ((pos (point-min))
|
|
344 marked-list ov)
|
|
345 (while (setq pos (next-single-property-change pos 'face))
|
|
346 (when (setq ov (get-char-property pos 'log-view-self))
|
|
347 (push (overlay-get ov 'log-view-marked) marked-list)
|
|
348 (setq pos (overlay-end ov))))
|
|
349 marked-list)))
|
|
350
|
78867
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
351 (defun log-view-beginning-of-defun ()
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
352 ;; This assumes that a log entry starts with a line matching
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
353 ;; `log-view-message-re'. Modes that derive from `log-view-mode'
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
354 ;; for which this assumption is not valid will have to provide
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
355 ;; another implementation of this function. `log-view-msg-prev'
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
356 ;; does a similar job to this function, we can't use it here
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
357 ;; directly because it prints messages that are not appropriate in
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
358 ;; this context and it does not move to the beginning of the buffer
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
359 ;; when the point is before the first log entry.
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
360
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
361 ;; `log-view-beginning-of-defun' and `log-view-end-of-defun' have
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
362 ;; been checked to work with logs produced by RCS, CVS, git,
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
363 ;; mercurial and subversion.
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
364
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
365 (re-search-backward log-view-message-re nil 'move))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
366
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
367 (defun log-view-end-of-defun ()
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
368 ;; The idea in this function is to search for the beginning of the
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
369 ;; next log entry using `log-view-message-re' and then go back one
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
370 ;; line when finding it. Modes that derive from `log-view-mode' for
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
371 ;; which this assumption is not valid will have to provide another
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
372 ;; implementation of this function.
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
373
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
374 ;; Look back and if there is no entry there it means we are before
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
375 ;; the first log entry, so go forward until finding one.
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
376 (unless (save-excursion (re-search-backward log-view-message-re nil t))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
377 (re-search-forward log-view-message-re nil t))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
378
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
379 ;; In case we are at the end of log entry going forward a line will
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
380 ;; make us find the next entry when searching. If we are inside of
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
381 ;; an entry going forward a line will still keep the point inside
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
382 ;; the same entry.
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
383 (forward-line 1)
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
384
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
385 ;; In case we are at the beginning of an entry, move past it.
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
386 (when (looking-at log-view-message-re)
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
387 (goto-char (match-end 0))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
388 (forward-line 1))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
389
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
390 ;; Search for the start of the next log entry. Go to the end of the
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
391 ;; buffer if we could not find a next entry.
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
392 (when (re-search-forward log-view-message-re nil 'move)
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
393 (goto-char (match-beginning 0))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
394 (forward-line -1)))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
395
|
67709
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
396 (defvar cvs-minor-current-files)
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
397 (defvar cvs-branch-prefix)
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
398 (defvar cvs-secondary-branch-prefix)
|
6f549652480e
(log-view-file-re, log-view-message-re): Use shy groups.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
399
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
400 (defun log-view-minor-wrap (buf f)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
401 (let ((data (with-current-buffer buf
|
68370
|
402 (let* ((beg (point))
|
|
403 (end (if mark-active (mark) (point)))
|
68221
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
404 (fr (log-view-current-tag beg))
|
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
405 (to (log-view-current-tag end)))
|
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
406 (when (string-equal fr to)
|
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
407 (save-excursion
|
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
408 (goto-char end)
|
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
409 (log-view-msg-next)
|
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
410 (setq to (log-view-current-tag))))
|
4804f7b39bfe
(log-view-minor-wrap): Use the same logic to get revisions as `log-view-diff'.
Juri Linkov <juri@jurta.org>
diff
changeset
|
411 (cons
|
68370
|
412 ;; The first revision has to be the one at point, for
|
|
413 ;; operations that only take one revision
|
|
414 ;; (e.g. cvs-mode-edit).
|
|
415 (cons (log-view-current-file) fr)
|
|
416 (cons (log-view-current-file) to))))))
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
417 (let ((cvs-branch-prefix (cdar data))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
418 (cvs-secondary-branch-prefix (and (cdar data) (cddr data)))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
419 (cvs-minor-current-files
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
420 (cons (caar data)
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
421 (when (and (cadr data) (not (equal (caar data) (cadr data))))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
422 (list (cadr data)))))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
423 ;; FIXME: I need to force because the fileinfos are UNKNOWN
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
424 (cvs-force-command "/F"))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
425 (funcall f))))
|
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
426
|
85139
|
427 (defun log-view-find-revision (pos)
|
41557
|
428 "Visit the version at point."
|
|
429 (interactive "d")
|
95966
|
430 (unless log-view-per-file-logs
|
|
431 (when (> (length log-view-vc-fileset) 1)
|
|
432 (error "Multiple files shown in this buffer, cannot use this command here")))
|
41557
|
433 (save-excursion
|
|
434 (goto-char pos)
|
95966
|
435 (switch-to-buffer (vc-find-revision (if log-view-per-file-logs
|
|
436 (log-view-current-file)
|
|
437 (car log-view-vc-fileset))
|
|
438 (log-view-current-tag)))))
|
41557
|
439
|
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
440
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
441 (defun log-view-extract-comment ()
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
442 "Parse comment from around the current point in the log."
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
443 (save-excursion
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
444 (let (st en (backend (vc-backend (log-view-current-file))))
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
445 (log-view-end-of-defun)
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
446 (cond ((eq backend 'SVN)
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
447 (forward-line -1)))
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
448 (setq en (point))
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
449 (log-view-beginning-of-defun)
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
450 (cond ((memq backend '(SCCS RCS CVS MCVS SVN))
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
451 (forward-line 2))
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
452 ((eq backend 'Hg)
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
453 (forward-line 4)
|
96006
|
454 (re-search-forward "summary: *" nil t)))
|
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
455 (setq st (point))
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
456 (buffer-substring st en))))
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
457
|
87562
|
458 (declare-function vc-modify-change-comment "vc" (files rev oldcomment))
|
|
459
|
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
460 (defun log-view-modify-change-comment ()
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
461 "Edit the change comment displayed at point."
|
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
462 (interactive)
|
95966
|
463 (vc-modify-change-comment (list (if log-view-per-file-logs
|
|
464 (log-view-current-file)
|
|
465 (car log-view-vc-fileset)))
|
|
466 (log-view-current-tag)
|
|
467 (log-view-extract-comment)))
|
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
468
|
78867
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
469 (defun log-view-annotate-version (pos)
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
470 "Annotate the version at point."
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
471 (interactive "d")
|
95966
|
472 (unless log-view-per-file-logs
|
|
473 (when (> (length log-view-vc-fileset) 1)
|
|
474 (error "Multiple files shown in this buffer, cannot use this command here")))
|
78867
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
475 (save-excursion
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
476 (goto-char pos)
|
95966
|
477 (switch-to-buffer (vc-annotate (if log-view-per-file-logs
|
|
478 (log-view-current-file)
|
|
479 (car log-view-vc-fileset))
|
78867
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
480 (log-view-current-tag)))))
|
82b0e30f9888
* files.el (file-name-sans-versions): Allow - and a-z in version
Dan Nicolaescu <dann@ics.uci.edu>
diff
changeset
|
481
|
42074
|
482 ;;
|
|
483 ;; diff
|
|
484 ;;
|
40958
|
485
|
|
486 (defun log-view-diff (beg end)
|
67569
|
487 "Get the diff between two revisions.
|
|
488 If the mark is not active or the mark is on the revision at point,
|
|
489 get the diff between the revision at point and its previous revision.
|
|
490 Otherwise, get the diff between the revisions where the region starts
|
|
491 and ends."
|
55175
|
492 (interactive
|
|
493 (list (if mark-active (region-beginning) (point))
|
|
494 (if mark-active (region-end) (point))))
|
40958
|
495 (let ((fr (log-view-current-tag beg))
|
|
496 (to (log-view-current-tag end)))
|
|
497 (when (string-equal fr to)
|
|
498 (save-excursion
|
|
499 (goto-char end)
|
|
500 (log-view-msg-next)
|
|
501 (setq to (log-view-current-tag))))
|
95966
|
502 (vc-version-diff
|
|
503 (if log-view-per-file-logs
|
|
504 (list (log-view-current-file))
|
|
505 log-view-vc-fileset)
|
|
506 to fr)))
|
|
507
|
96006
|
508 (declare-function vc-diff-internal "vc"
|
|
509 (async vc-fileset rev1 rev2 &optional verbose))
|
|
510
|
95966
|
511 (defun log-view-diff-changeset (beg end)
|
|
512 "Get the diff between two revisions.
|
|
513 If the mark is not active or the mark is on the revision at point,
|
|
514 get the diff between the revision at point and its previous revision.
|
|
515 Otherwise, get the diff between the revisions where the region starts
|
|
516 and ends."
|
|
517 (interactive
|
|
518 (list (if mark-active (region-beginning) (point))
|
|
519 (if mark-active (region-end) (point))))
|
|
520 (when (eq (vc-call-backend log-view-vc-backend 'revision-granularity) 'file)
|
|
521 (error "The %s backend does not support changeset diffs" log-view-vc-backend))
|
|
522 (let ((fr (log-view-current-tag beg))
|
|
523 (to (log-view-current-tag end)))
|
|
524 (when (string-equal fr to)
|
|
525 ;; TO and FR are the same, look at the previous revision.
|
|
526 (setq to (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
|
|
527 (vc-diff-internal
|
|
528 t
|
|
529 ;; We want to see the diff for all the files in the changeset, so
|
|
530 ;; pass NIL for the file list. The value passed here should
|
|
531 ;; follow what `vc-deduce-fileset' returns.
|
|
532 (list log-view-vc-backend nil)
|
|
533 to fr)))
|
40958
|
534
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
535 (provide 'log-view)
|
28251
|
536
|
60145
|
537 ;; arch-tag: 0d64220b-ce7e-4f62-9c2a-6b04c2f81f4f
|
28088
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
538 ;;; log-view.el ends here
|