aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-03-22 02:57:23 +0000
committerStefan Monnier2000-03-22 02:57:23 +0000
commitcb3430a1f76f18e76cd3436e02346222895bd657 (patch)
treecc02efe53d5d3a73c122e164a03b9e1d59722841
parentff1a0d8e5b71fa7a031eb464d6c750fea8e67ad8 (diff)
downloademacs-cb3430a1f76f18e76cd3436e02346222895bd657.tar.gz
emacs-cb3430a1f76f18e76cd3436e02346222895bd657.zip
* pcvs.el: Add a minimal leading commentary.
(cvs-make-cvs-buffer): Change the header part by removing the startup message and adding a `Module' entry. Also replace the FOOTER and HEADER special fileinfos with the new support in ewoc for updating its own footer and header. (cvs-update-header): Update to use the header/footer of the ewoc. (cvs-mode): Use define-derived-mode and set truncate-lines to t. (cvs-is-within-p): New function. (cvs-mode-run): Take advantage of `save-some-buffers's new ability to only examine some subset of the buffers. * pcvs-info.el (cvs-fileinfo-pp): Use the new property-preserving `format' instead of our own ad-hoc functions. Remove HEADER and FOOTER cases, now handled in the EWOC. (cvs-fileinfo<): Remove HEADER and FOOTER cases. * pcvs-parse.el (cvs-parse-run-table): Change message for unknown output to avoid scaring the user. (cvs-parse-table): Catch message for non-up-to-date commits. * pcvs-defs.el (cvs-startup-message): Remove. (cvs-global-menu): New autoloaded menu. * pcvs-util.el (cvs-string-fill): Remove. * emacs-lisp/ewoc.el (ewoc--create-special-node): Remove. (ewoc--refresh-node): Don't take the whole EWOC but only the relevant PP part of it and also make it work for footers and headers. (ewoc-create): Drop POS and BUFFER arguments. Use the DLL's dummy node to store the end-of-footer position. (ewoc-map, ewoc-invalidate): Update call to ewoc--refresh-node. (ewoc-refresh): Remove unused `header' variable. (ewoc-(get|set)-hf): New functions.
-rw-r--r--lisp/ChangeLog34
-rw-r--r--lisp/emacs-lisp/ewoc.el87
-rw-r--r--lisp/pcvs-defs.el32
-rw-r--r--lisp/pcvs-info.el37
-rw-r--r--lisp/pcvs-parse.el8
-rw-r--r--lisp/pcvs-util.el11
-rw-r--r--lisp/pcvs.el205
7 files changed, 187 insertions, 227 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 452f106496b..4ed3ceeac94 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,39 @@
12000-03-21 Stefan Monnier <monnier@cs.yale.edu> 12000-03-21 Stefan Monnier <monnier@cs.yale.edu>
2 2
3 * pcvs.el: Add a minimal leading commentary.
4 (cvs-make-cvs-buffer): Change the header part by removing the startup
5 message and adding a `Module' entry. Also replace the FOOTER and
6 HEADER special fileinfos with the new support in ewoc for updating
7 its own footer and header.
8 (cvs-update-header): Update to use the header/footer of the ewoc.
9 (cvs-mode): Use define-derived-mode and set truncate-lines to t.
10 (cvs-is-within-p): New function.
11 (cvs-mode-run): Take advantage of `save-some-buffers's new ability
12 to only examine some subset of the buffers.
13
14 * pcvs-info.el (cvs-fileinfo-pp): Use the new property-preserving
15 `format' instead of our own ad-hoc functions.
16 Remove HEADER and FOOTER cases, now handled in the EWOC.
17 (cvs-fileinfo<): Remove HEADER and FOOTER cases.
18
19 * pcvs-parse.el (cvs-parse-run-table): Change message for unknown
20 output to avoid scaring the user.
21 (cvs-parse-table): Catch message for non-up-to-date commits.
22
23 * pcvs-defs.el (cvs-startup-message): Remove.
24 (cvs-global-menu): New autoloaded menu.
25
26 * pcvs-util.el (cvs-string-fill): Remove.
27
28 * emacs-lisp/ewoc.el (ewoc--create-special-node): Remove.
29 (ewoc--refresh-node): Don't take the whole EWOC but only the relevant
30 PP part of it and also make it work for footers and headers.
31 (ewoc-create): Drop POS and BUFFER arguments.
32 Use the DLL's dummy node to store the end-of-footer position.
33 (ewoc-map, ewoc-invalidate): Update call to ewoc--refresh-node.
34 (ewoc-refresh): Remove unused `header' variable.
35 (ewoc-(get|set)-hf): New functions.
36
3 * log-view.el (log-view-(msg|file)-(prev|next)): Rename from 37 * log-view.el (log-view-(msg|file)-(prev|next)): Rename from
4 log-view-*-(message|file) and use easy-mmode-define-navigation. 38 log-view-*-(message|file) and use easy-mmode-define-navigation.
5 (log-view-message-re): Match SCCS format as well. 39 (log-view-message-re): Match SCCS format as well.
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el
index 2af8dd49298..9c03b627f7a 100644
--- a/lisp/emacs-lisp/ewoc.el
+++ b/lisp/emacs-lisp/ewoc.el
@@ -68,7 +68,6 @@
68;; certain point in a certain buffer. (The buffer and point are 68;; certain point in a certain buffer. (The buffer and point are
69;; fixed when the ewoc is created). The header and the footer 69;; fixed when the ewoc is created). The header and the footer
70;; are constant strings. They appear before and after the elements. 70;; are constant strings. They appear before and after the elements.
71;; (Currently, once set, they can not be changed).
72;; 71;;
73;; Ewoc does not affect the mode of the buffer in any way. It 72;; Ewoc does not affect the mode of the buffer in any way. It
74;; merely makes it easy to connect an underlying data representation 73;; merely makes it easy to connect an underlying data representation
@@ -94,7 +93,7 @@
94;; In the mean time `grep '^(.*ewoc-[^-]' emacs-lisp/ewoc.el' can help 93;; In the mean time `grep '^(.*ewoc-[^-]' emacs-lisp/ewoc.el' can help
95;; you find all the exported functions: 94;; you find all the exported functions:
96;; 95;;
97;; (defun ewoc-create (buffer pretty-printer &optional header footer pos) 96;; (defun ewoc-create (pretty-printer &optional header footer)
98;; (defalias 'ewoc-data 'ewoc--node-data) 97;; (defalias 'ewoc-data 'ewoc--node-data)
99;; (defun ewoc-enter-first (ewoc data) 98;; (defun ewoc-enter-first (ewoc data)
100;; (defun ewoc-enter-last (ewoc data) 99;; (defun ewoc-enter-last (ewoc data)
@@ -113,7 +112,8 @@
113;; (defun ewoc-refresh (ewoc) 112;; (defun ewoc-refresh (ewoc)
114;; (defun ewoc-collect (ewoc predicate &rest args) 113;; (defun ewoc-collect (ewoc predicate &rest args)
115;; (defun ewoc-buffer (ewoc) 114;; (defun ewoc-buffer (ewoc)
116 115;; (defun ewoc-get-hf (ewoc)
116;; (defun ewoc-set-hf (ewoc header footer)
117 117
118;; Coding conventions 118;; Coding conventions
119;; ================== 119;; ==================
@@ -234,27 +234,6 @@ BUT if it is the header or the footer in EWOC return nil instead."
234 node)) 234 node))
235 235
236 236
237(defun ewoc--create-special-node (data string pos)
238 "Insert STRING at POS in current buffer. Remember the start
239position. Create a wrapper containing that start position and the
240element DATA."
241 (save-excursion
242 ;; Remember the position as a number so that it doesn't move
243 ;; when we insert the string.
244 (when (markerp pos) (setq pos (marker-position pos)))
245 (goto-char pos)
246 (let ((inhibit-read-only t))
247 ;; Use insert-before-markers so that the marker for the
248 ;; next element is updated.
249 (insert-before-markers string)
250 ;; Always insert a newline. You want invisible elements? You
251 ;; lose. (At least in this version). FIXME-someday. (It is
252 ;; harder to fix than it might seem. All markers have to point
253 ;; to the right place all the time...)
254 (insert-before-markers ?\n)
255 (ewoc--node-create (copy-marker pos) data))))
256
257
258(defun ewoc--create-node (data pretty-printer pos) 237(defun ewoc--create-node (data pretty-printer pos)
259 "Call PRETTY-PRINTER with point set at POS in current buffer. 238 "Call PRETTY-PRINTER with point set at POS in current buffer.
260Remember the start position. Create a wrapper containing that 239Remember the start position. Create a wrapper containing that
@@ -293,32 +272,26 @@ consume any more resources."
293 (ewoc--node-delete node))) 272 (ewoc--node-delete node)))
294 273
295 274
296(defvar dll) ;passed by dynamic binding 275(defun ewoc--refresh-node (pp node)
297 276 "Redisplay the element represented by NODE using the pretty-printer PP."
298(defun ewoc--refresh-node (ewoc node)
299 "Redisplay the element represented by NODE.
300Can not be used on the footer. dll *must* be bound to
301\(ewoc--dll ewoc)."
302 (let ((inhibit-read-only t)) 277 (let ((inhibit-read-only t))
303 (save-excursion 278 (save-excursion
304 ;; First, remove the string from the buffer: 279 ;; First, remove the string from the buffer:
305 (delete-region (ewoc--node-start-marker node) 280 (delete-region (ewoc--node-start-marker node)
306 (1- (marker-position 281 (1- (marker-position
307 (ewoc--node-start-marker (ewoc--node-next dll node))))) 282 (ewoc--node-start-marker (ewoc--node-right node)))))
308 ;; Calculate and insert the string. 283 ;; Calculate and insert the string.
309 (goto-char (ewoc--node-start-marker node)) 284 (goto-char (ewoc--node-start-marker node))
310 (funcall (ewoc--pretty-printer ewoc) 285 (funcall pp (ewoc--node-data node)))))
311 (ewoc--node-data node)))))
312 286
313;;; =========================================================================== 287;;; ===========================================================================
314;;; Public members of the Ewoc package 288;;; Public members of the Ewoc package
315 289
316 290
317(defun ewoc-create (buffer pretty-printer &optional header footer pos) 291(defun ewoc-create (pretty-printer &optional header footer)
318 "Create an empty ewoc. 292 "Create an empty ewoc.
319 293
320The ewoc will be inserted in BUFFER. BUFFER may be a 294The ewoc will be inserted in the current buffer at the current position.
321buffer or a buffer name. It is created if it does not exist.
322 295
323PRETTY-PRINTER should be a function that takes one argument, an 296PRETTY-PRINTER should be a function that takes one argument, an
324element, and inserts a string representing it in the buffer (at 297element, and inserts a string representing it in the buffer (at
@@ -330,27 +303,22 @@ insert-before-markers.
330Optional third argument HEADER is a string that will always be 303Optional third argument HEADER is a string that will always be
331present at the top of the ewoc. HEADER should end with a 304present at the top of the ewoc. HEADER should end with a
332newline. Optionaly fourth argument FOOTER is similar, and will 305newline. Optionaly fourth argument FOOTER is similar, and will
333always be inserted at the bottom of the ewoc. 306be inserted at the bottom of the ewoc."
334
335Optional fifth argument POS is a buffer position, specifying
336where the ewoc will be inserted. It defaults to the
337beginning of the buffer."
338 (let ((new-ewoc 307 (let ((new-ewoc
339 (ewoc--create (get-buffer-create buffer) 308 (ewoc--create (current-buffer)
340 pretty-printer nil nil (ewoc--dll-create)))) 309 pretty-printer nil nil (ewoc--dll-create)))
310 (pos (point)))
341 (ewoc--set-buffer-bind-dll new-ewoc 311 (ewoc--set-buffer-bind-dll new-ewoc
342 ;; Set default values 312 ;; Set default values
343 (unless header (setq header "")) 313 (unless header (setq header ""))
344 (unless footer (setq footer "")) 314 (unless footer (setq footer ""))
345 (unless pos (setq pos (point-min))) 315 (setf (ewoc--node-start-marker dll) (copy-marker pos))
346 ;; Force header to be above footer. 316 (let ((foot (ewoc--create-node footer (lambda (x) (insert footer)) pos))
347 (if (markerp pos) (setq pos (marker-position pos))) 317 (head (ewoc--create-node header (lambda (x) (insert header)) pos)))
348 (let ((foot (ewoc--create-special-node footer footer pos))
349 (head (ewoc--create-special-node header header pos)))
350 (ewoc--node-enter-first dll head) 318 (ewoc--node-enter-first dll head)
351 (ewoc--node-enter-last dll foot) 319 (ewoc--node-enter-last dll foot)
352 (setf (ewoc--header new-ewoc) (ewoc--node-nth dll 0)) 320 (setf (ewoc--header new-ewoc) head)
353 (setf (ewoc--footer new-ewoc) (ewoc--node-nth dll -1)))) 321 (setf (ewoc--footer new-ewoc) foot)))
354 ;; Return the ewoc 322 ;; Return the ewoc
355 new-ewoc)) 323 new-ewoc))
356 324
@@ -427,7 +395,7 @@ arguments will be passed to MAP-FUNCTION."
427 (node (ewoc--node-nth dll 1))) 395 (node (ewoc--node-nth dll 1)))
428 (while (not (eq node footer)) 396 (while (not (eq node footer))
429 (if (apply map-function (ewoc--node-data node) args) 397 (if (apply map-function (ewoc--node-data node) args)
430 (ewoc--refresh-node ewoc node)) 398 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node))
431 (setq node (ewoc--node-next dll node))))) 399 (setq node (ewoc--node-next dll node)))))
432 400
433(defun ewoc-filter (ewoc predicate &rest args) 401(defun ewoc-filter (ewoc predicate &rest args)
@@ -521,7 +489,7 @@ If the EWOC is empty, nil is returned."
521The pretty-printer that for EWOC will be called for all NODES." 489The pretty-printer that for EWOC will be called for all NODES."
522 (ewoc--set-buffer-bind-dll ewoc 490 (ewoc--set-buffer-bind-dll ewoc
523 (dolist (node nodes) 491 (dolist (node nodes)
524 (ewoc--refresh-node ewoc node)))) 492 (ewoc--refresh-node (ewoc--pretty-printer ewoc) node))))
525 493
526(defun ewoc-goto-prev (ewoc pos arg) 494(defun ewoc-goto-prev (ewoc pos arg)
527 "Move point to the ARGth previous element. 495 "Move point to the ARGth previous element.
@@ -566,8 +534,7 @@ will be called for all elements in EWOC.
566Note that `ewoc-invalidate' is more efficient if only a small 534Note that `ewoc-invalidate' is more efficient if only a small
567number of elements needs to be refreshed." 535number of elements needs to be refreshed."
568 (ewoc--set-buffer-bind-dll-let* ewoc 536 (ewoc--set-buffer-bind-dll-let* ewoc
569 ((header (ewoc--header ewoc)) 537 ((footer (ewoc--footer ewoc)))
570 (footer (ewoc--footer ewoc)))
571 (let ((inhibit-read-only t)) 538 (let ((inhibit-read-only t))
572 (delete-region (ewoc--node-start-marker (ewoc--node-nth dll 1)) 539 (delete-region (ewoc--node-start-marker (ewoc--node-nth dll 1))
573 (ewoc--node-start-marker footer)) 540 (ewoc--node-start-marker footer))
@@ -609,6 +576,18 @@ Returns nil if the buffer has been deleted."
609 (let ((buf (ewoc--buffer ewoc))) 576 (let ((buf (ewoc--buffer ewoc)))
610 (when (buffer-name buf) buf))) 577 (when (buffer-name buf) buf)))
611 578
579(defun ewoc-get-hf (ewoc)
580 "Return a cons cell containing the (HEADER . FOOTER) of EWOC."
581 (cons (ewoc--node-data (ewoc--header ewoc))
582 (ewoc--node-data (ewoc--footer ewoc))))
583
584(defun ewoc-set-hf (ewoc header footer)
585 "Set the HEADER and FOOTER of EWOC."
586 (setf (ewoc--node-data (ewoc--header ewoc)) header)
587 (setf (ewoc--node-data (ewoc--footer ewoc)) footer)
588 (ewoc--refresh-node (lambda (x) (insert header)) (ewoc--header ewoc))
589 (ewoc--refresh-node (lambda (x) (insert footer)) (ewoc--footer ewoc)))
590
612 591
613(provide 'ewoc) 592(provide 'ewoc)
614 593
diff --git a/lisp/pcvs-defs.el b/lisp/pcvs-defs.el
index 28263650edb..37aa13acc45 100644
--- a/lisp/pcvs-defs.el
+++ b/lisp/pcvs-defs.el
@@ -5,7 +5,7 @@
5;; Author: Stefan Monnier <monnier@cs.yale.edu> 5;; Author: Stefan Monnier <monnier@cs.yale.edu>
6;; Keywords: pcl-cvs 6;; Keywords: pcl-cvs
7;; Version: $Name: $ 7;; Version: $Name: $
8;; Revision: $Id: pcvs-defs.el,v 1.1 2000/03/11 03:42:29 monnier Exp $ 8;; Revision: $Id: pcvs-defs.el,v 1.2 2000/03/15 21:28:58 gerd Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -294,10 +294,6 @@ This variable is buffer local and only used in the *cvs* buffer.")
294;;;; Global internal variables 294;;;; Global internal variables
295;;;; 295;;;;
296 296
297(defconst cvs-startup-message
298 (concat "PCL-CVS release " pcl-cvs-version)
299 "*Startup message for CVS.")
300
301(defconst cvs-vendor-branch "1.1.1" 297(defconst cvs-vendor-branch "1.1.1"
302 "The default branch used by CVS for vendor code.") 298 "The default branch used by CVS for vendor code.")
303 299
@@ -460,17 +456,25 @@ It is expected to call the function.")
460(defconst cvs-pcl-cvs-dirchange-re "^pcl-cvs: descending directory \\(.*\\)$") 456(defconst cvs-pcl-cvs-dirchange-re "^pcl-cvs: descending directory \\(.*\\)$")
461 457
462;;;; 458;;;;
463;;;; 459;;;; autoload the global menu
464;;;; 460;;;;
465 461
466(if (progn (condition-case () (require 'easymenu) (error nil)) 462;;;###autoload
467 (fboundp 'easy-menu-add-item)) 463(defvar cvs-global-menu
468 (easy-menu-add-item nil '("tools") 464 (let ((m (make-sparse-keymap "PCL-CVS")))
469 '("PCL CVS" 465 (define-key m [status]
470 ["Update Directory" cvs-update t] 466 '(menu-item "Directory Status" cvs-status
471 ["Examine Directory" cvs-examine t] 467 :help "A more verbose status of a workarea"))
472 ["Status Directory" cvs-status t] 468 (define-key m [checkout]
473 ["Checkout Module" cvs-checkout t]) "vc")) 469 '(menu-item "Checkout Module" cvs-checkout
470 :help "Check out a module from the repository"))
471 (define-key m [update]
472 '(menu-item "Update Directory" cvs-update
473 :help "Fetch updates from the repository"))
474 (define-key m [examine]
475 '(menu-item "Examine Directory" cvs-examine
476 :help "Examine the current state of a workarea"))
477 m))
474 478
475 479
476;; cvs-1.10 and above can take file arguments in other directories 480;; cvs-1.10 and above can take file arguments in other directories
diff --git a/lisp/pcvs-info.el b/lisp/pcvs-info.el
index 51b791e8ae3..0adb7b680ea 100644
--- a/lisp/pcvs-info.el
+++ b/lisp/pcvs-info.el
@@ -5,7 +5,7 @@
5;; Author: Stefan Monnier <monnier@cs.yale.edu> 5;; Author: Stefan Monnier <monnier@cs.yale.edu>
6;; Keywords: pcl-cvs 6;; Keywords: pcl-cvs
7;; Version: $Name: $ 7;; Version: $Name: $
8;; Revision: $Id: pcl-cvs-info.el,v 1.28 2000/03/05 21:32:21 monnier Exp $ 8;; Revision: $Id: pcvs-info.el,v 1.1 2000/03/11 03:42:29 monnier Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -212,8 +212,6 @@ to confuse some users sometimes."
212 ;; to display a text that should be in 212 ;; to display a text that should be in
213 ;; full-log." 213 ;; full-log."
214 ;; TEMP A temporary message that should be removed 214 ;; TEMP A temporary message that should be removed
215 ;; HEADER A message that should stick at the top of the display
216 ;; FOOTER A message that should stick at the bottom of the display
217 ) 215 )
218(defun cvs-create-fileinfo (type dir file msg &rest keys) 216(defun cvs-create-fileinfo (type dir file msg &rest keys)
219 (cvs-check-fileinfo (apply #'-cvs-create-fileinfo type dir file msg keys))) 217 (cvs-check-fileinfo (apply #'-cvs-create-fileinfo type dir file msg keys)))
@@ -362,10 +360,8 @@ For use by the cookie package."
362 'cvs-header-face cvs-dirname-map) 360 'cvs-header-face cvs-dirname-map)
363 ":")) 361 ":"))
364 (MESSAGE 362 (MESSAGE
365 (if (memq (cvs-fileinfo->subtype fileinfo) '(FOOTER HEADER)) 363 (cvs-add-face (format "Message: %s" (cvs-fileinfo->full-log fileinfo))
366 (cvs-fileinfo->full-log fileinfo) 364 'cvs-msg-face))
367 (cvs-add-face (format "Message: %s" (cvs-fileinfo->full-log fileinfo))
368 'cvs-msg-face)))
369 (t 365 (t
370 (let* ((status (if (cvs-fileinfo->marked fileinfo) 366 (let* ((status (if (cvs-fileinfo->marked fileinfo)
371 (cvs-add-face "*" 'cvs-marked-face) 367 (cvs-add-face "*" 'cvs-marked-face)
@@ -390,24 +386,9 @@ For use by the cookie package."
390 ;; or the head-rev 386 ;; or the head-rev
391 (when (and head (not (string= head base))) head) 387 (when (and head (not (string= head base))) head)
392 ;; or nothing 388 ;; or nothing
393 "")) 389 "")))
394 ;; (action (cvs-add-face (case (cvs-default-action fileinfo) 390 (format "%-11s %s %-11s %-11s %s"
395 ;; (commit "com") 391 side status type base file)))))))
396 ;; (update "upd")
397 ;; (undo "udo")
398 ;; (t " "))
399 ;; 'cvs-action-face
400 ;; cvs-action-map))
401 )
402 (concat (cvs-string-fill side 11) " "
403 status " "
404 (cvs-string-fill type 11) " "
405 ;; action " "
406 (cvs-string-fill base 11) " "
407 file)))))))
408;; it seems that `format' removes text-properties. Too bad!
409;; (format "%-11s %s %-11s %-11s %s"
410;; side status type base file)))))))
411 392
412 393
413(defun cvs-fileinfo-update (fi fi-new) 394(defun cvs-fileinfo-update (fi fi-new)
@@ -433,12 +414,6 @@ fileinfo will appear first, followed by all files (alphabetically)."
433 (let ((subtypea (cvs-fileinfo->subtype a)) 414 (let ((subtypea (cvs-fileinfo->subtype a))
434 (subtypeb (cvs-fileinfo->subtype b))) 415 (subtypeb (cvs-fileinfo->subtype b)))
435 (cond 416 (cond
436 ;; keep header and footer where they belong. Note: the order is important
437 ((eq subtypeb 'HEADER) nil)
438 ((eq subtypea 'HEADER) t)
439 ((eq subtypea 'FOOTER) nil)
440 ((eq subtypeb 'FOOTER) t)
441
442 ;; Sort according to directories. 417 ;; Sort according to directories.
443 ((string< (cvs-fileinfo->dir a) (cvs-fileinfo->dir b)) t) 418 ((string< (cvs-fileinfo->dir a) (cvs-fileinfo->dir b)) t)
444 ((not (string= (cvs-fileinfo->dir a) (cvs-fileinfo->dir b))) nil) 419 ((not (string= (cvs-fileinfo->dir a) (cvs-fileinfo->dir b))) nil)
diff --git a/lisp/pcvs-parse.el b/lisp/pcvs-parse.el
index b65f8d2eb60..818506b6916 100644
--- a/lisp/pcvs-parse.el
+++ b/lisp/pcvs-parse.el
@@ -5,7 +5,7 @@
5;; Author: Stefan Monnier <monnier@cs.yale.edu> 5;; Author: Stefan Monnier <monnier@cs.yale.edu>
6;; Keywords: pcl-cvs 6;; Keywords: pcl-cvs
7;; Version: $Name: $ 7;; Version: $Name: $
8;; Revision: $Id: pcl-cvs-parse.el,v 1.41 2000/03/05 21:32:21 monnier Exp $ 8;; Revision: $Id: pcvs-parse.el,v 1.1 2000/03/11 03:42:29 monnier Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -154,7 +154,7 @@ Match RE and if successful, execute MATCHES."
154 (and 154 (and
155 (cvs-match ".*$") 155 (cvs-match ".*$")
156 (cvs-create-fileinfo 'MESSAGE cvs-current-dir " " 156 (cvs-create-fileinfo 'MESSAGE cvs-current-dir " "
157 (concat " Parser Error: '" (cvs-parse-msg) "'") 157 (concat " Unknown msg: '" (cvs-parse-msg) "'")
158 :subtype 'ERROR))))) 158 :subtype 'ERROR)))))
159 159
160 160
@@ -318,6 +318,10 @@ The remaining KEYS are passed directly to `cvs-create-fileinfo'."
318 (and (cvs-match "use `.+ add' to create an entry for \\(.*\\)$" (path 1)) 318 (and (cvs-match "use `.+ add' to create an entry for \\(.*\\)$" (path 1))
319 (cvs-parsed-fileinfo 'UNKNOWN path)) 319 (cvs-parsed-fileinfo 'UNKNOWN path))
320 320
321 ;; [commit]
322 (and (cvs-match "Up-to-date check failed for `\\(.+\\)'$" (file 1))
323 (cvs-parsed-fileinfo 'NEED-MERGE file))
324
321 ;; We use cvs-execute-multi-dir but cvs can't handle it 325 ;; We use cvs-execute-multi-dir but cvs can't handle it
322 ;; Probably because the cvs-client can but the cvs-server can't 326 ;; Probably because the cvs-client can but the cvs-server can't
323 (and (cvs-match ".* files with '?/'? in their name.*$") 327 (and (cvs-match ".* files with '?/'? in their name.*$")
diff --git a/lisp/pcvs-util.el b/lisp/pcvs-util.el
index 044fc858ae4..e8b71a120bc 100644
--- a/lisp/pcvs-util.el
+++ b/lisp/pcvs-util.el
@@ -5,7 +5,7 @@
5;; Author: Stefan Monnier <monnier@cs.yale.edu> 5;; Author: Stefan Monnier <monnier@cs.yale.edu>
6;; Keywords: pcl-cvs 6;; Keywords: pcl-cvs
7;; Version: $Name: $ 7;; Version: $Name: $
8;; Revision: $Id: pcvs-util.el,v 1.1 2000/03/11 03:42:30 monnier Exp $ 8;; Revision: $Id: pcvs-util.el,v 1.2 2000/03/17 10:07:00 fx Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -189,15 +189,6 @@ The SEPARATOR regexp defaults to \"\\s-+\"."
189 (let ((rfs (read-from-string string i))) 189 (let ((rfs (read-from-string string i)))
190 (cons (car rfs) 190 (cons (car rfs)
191 (cvs-string->strings (substring string (cdr rfs)) sep))))))) 191 (cvs-string->strings (substring string (cdr rfs)) sep)))))))
192
193
194(defun cvs-string-fill (str n &optional filling truncate)
195 "Add FILLING (defaults to the space char) to STR to reach size N.
196If STR is longer than N, truncate if TRUNCATE is set, else don't do anything."
197 (let ((l (length str)))
198 (if (> l n)
199 (if truncate (substring str 0 n) str)
200 (concat str (make-string (- n l) (or filling ? ))))))
201 192
202;;;; 193;;;;
203;;;; file names 194;;;; file names
diff --git a/lisp/pcvs.el b/lisp/pcvs.el
index 320ec3c58ac..4cb94c00842 100644
--- a/lisp/pcvs.el
+++ b/lisp/pcvs.el
@@ -14,7 +14,7 @@
14;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu 14;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu
15;; Keywords: CVS, version control, release management 15;; Keywords: CVS, version control, release management
16;; Version: $Name: $ 16;; Version: $Name: $
17;; Revision: $Id: pcl-cvs.el,v 1.75 2000/03/05 21:32:21 monnier Exp $ 17;; Revision: $Id: pcvs.el,v 1.1 2000/03/11 03:42:30 monnier Exp $
18 18
19;; This file is part of GNU Emacs. 19;; This file is part of GNU Emacs.
20 20
@@ -35,105 +35,78 @@
35 35
36;;; Commentary: 36;;; Commentary:
37 37
38;; PCL-CVS is a front-end to the CVS version control system. For people
39;; familiar with VC, it is somewhat like VC-dired: it presents the status of
40;; all the files in your working area and allows you to commit/update several
41;; of them at a time. Compared to VC-dired, it is considerably better and
42;; faster (but only for CVS).
43
44;; PCL-CVS was originally written by Per Cederqvist many years ago. This
45;; version derives from the XEmacs-21 version, itself based on the 2.0b2
46;; version (last release from Per). It is a thorough rework.
47
48;; Contrary to what you'd expect, PCL-CVS is not a replacement for VC but only
49;; for VC-dired. As such, I've tried to make PCL-CVS and VC interoperate
50;; seamlessly (I also use VC).
51
52;; To use PCL-CVS just use `M-x cvs-examine RET <dir> RET'.
53;; There used to be a TeXinfo manual, but it's now so out of date that
54;; it's not even worth looking at it.
55
38;;; Todo: 56;;; Todo:
39 57
40;; * FIX THE DOCUMENTATION 58;; ******** FIX THE DOCUMENTATION *********
41;;
42;; * Emacs-21 adaptation
43;; ** use the new arg of save-some-buffers
44;; ** add toolbar entries
45;; ** use `format' now that it keeps properties
46;; ** use propertize
47;; ** add compatibility with older name's variables.
48;;
49;; * New Features
50;;
51;; ** marking
52;; *** marking directories should jump to just after the dir.
53;; *** allow (un)marking directories at a time with the mouse.
54;; *** marking with the mouse should not move point.
55;;
56;; ** liveness indicator
57;;
58;; ** indicate in docstring if the cmd understands the `b' prefix(es).
59;;
60;; ** call smerge-mode when opening CONFLICT files.
61;; 59;;
62;; ** after-parse-hook (to eliminate *.elc from Emacs' CVS repository :-) 60;; - write cvs-fast-examine that parses CVS/Entries instead of running cvs
63;; 61;; we could even steal code from vc-cvs-hooks for that.
64;; ** have vc-checkin delegate to cvs-mode-commit when applicable 62;; - add toolbar entries
65;; 63;; - marking
66;; ** higher-level CVS operations 64;; marking directories should jump to just after the dir.
67;; 65;; allow (un)marking directories at a time with the mouse.
68;; *** cvs-mode-rename 66;; marking with the mouse should not move point.
69;; *** cvs-mode-branch 67;; - liveness indicator
70;; 68;; - indicate in docstring if the cmd understands the `b' prefix(es).
71;; ** module-level commands 69;; - call smerge-mode when opening CONFLICT files.
72;; 70;; - after-parse-hook (to eliminate *.elc from Emacs' CVS repository :-)
73;; *** add support for parsing 'modules' file ("cvs co -c") 71;; - have vc-checkin delegate to cvs-mode-commit when applicable
74;; 72;; - higher-level CVS operations
75;; *** cvs-mode-rcs2log 73;; cvs-mode-rename
76;; *** cvs-rdiff 74;; cvs-mode-branch
77;; *** cvs-release 75;; - module-level commands
78;; *** cvs-import 76;; add support for parsing 'modules' file ("cvs co -c")
79;; *** C-u M-x cvs-checkout should ask for a cvsroot 77;; cvs-mode-rcs2log
80;; 78;; cvs-rdiff
81;; *** cvs-mode-handle-new-vendor-version 79;; cvs-release
80;; cvs-import
81;; C-u M-x cvs-checkout should ask for a cvsroot
82;; cvs-mode-handle-new-vendor-version
82;; - checks out module, or alternately does update join 83;; - checks out module, or alternately does update join
83;; - does "cvs -n tag LAST_VENDOR" to find old files into *cvs* 84;; - does "cvs -n tag LAST_VENDOR" to find old files into *cvs*
84;; 85;; cvs-export
85;; *** cvs-export
86;; (with completion on tag names and hooks to 86;; (with completion on tag names and hooks to
87;; help generate full releases) 87;; help generate full releases)
88;; 88;; - allow cvs-cmd-do to either clear the marks or not.
89;; ** allow cvs-cmd-do to either clear the marks or not. 89;; - allow more concurrency: if the output buffer is busy, pick a new one.
90;; 90;; - display stickiness information. And current CVS/Tag as well.
91;; ** allow more concurrency: if the output buffer is busy, pick a new one. 91;; - write 'cvs-mode-admin' to do arbitrary 'cvs admin' commands
92;; 92;; - cvs-mode-incorporate
93;; ** configurable layout/format of *cvs*.
94;;
95;; ** display stickiness information. And current CVS/Tag as well.
96;;
97;; ** cvs-log-mode should know how to extract version info
98;; cvs-log-current-tag is a nop right now :-(
99;;
100;; ** write 'cvs-mode-admin' to do arbitrary 'cvs admin' commands
101;;
102;; ** cvs-mode-incorporate
103;; It would merge in the status from one ``*cvs*'' buffer into another. 93;; It would merge in the status from one ``*cvs*'' buffer into another.
104;; This would be used to populate such a buffer that had been created with 94;; This would be used to populate such a buffer that had been created with
105;; a `cvs {update,status,checkout} -l'. 95;; a `cvs {update,status,checkout} -l'.
106;; 96;; - cvs-mode-(i)diff-other-{file,buffer,cvs-buffer}
107;; ** cvs-mode-(i)diff-other-{file,buffer,cvs-buffer} 97;; - offer the choice to kill the process when the user kills the cvs buffer.
108;;
109;; ** offer the choice to kill the process when the user kills the cvs buffer.
110;; right now, it's killed without further ado. 98;; right now, it's killed without further ado.
111;; 99;; - make `cvs-mode-ignore' allow manually entering a pattern.
112;; ** make `cvs-mode-ignore' allow manually entering a pattern.
113;; to which dir should it apply ? 100;; to which dir should it apply ?
114;; 101;; - cvs-mode-ignore should try to remove duplicate entries.
115;; ** cvs-mode-ignore should try to remove duplicate entries. 102;; - maybe poll/check CVS/Entries files to react to external `cvs' commands ?
116;; 103;; - some kind of `cvs annotate' support ?
117;; * Old misfeatures
118;;
119;; ** cvs-mode-<foo> commands tend to require saving too many buffers
120;; they should only require saving the files concerned by the command
121;;
122;; * Secondary issues
123;;
124;; ** maybe poll/check CVS/Entries files to react to external `cvs' commands ?
125;;
126;; ** some kind of `cvs annotate' support ?
127;; but vc-annotate can be used instead. 104;; but vc-annotate can be used instead.
128;; 105;; - dynamic `g' mapping
129;; * probably not worth the trouble
130;;
131;; ** dynamic `g' mapping
132;; Make 'g', and perhaps other commands, use either cvs-update or 106;; Make 'g', and perhaps other commands, use either cvs-update or
133;; cvs-examine depending on the read-only status of the cvs buffer, for 107;; cvs-examine depending on the read-only status of the cvs buffer, for
134;; instance. 108;; instance.
135;; 109;; - add message-levels so that we can hide some levels of messages
136;; ** add message-levels so that we can hide some levels of messages
137 110
138;;; Code: 111;;; Code:
139 112
@@ -457,24 +430,18 @@ If non-nil, NEW means to create a new buffer no matter what."
457 (setq default-directory dir) 430 (setq default-directory dir)
458 (setq buffer-read-only nil) 431 (setq buffer-read-only nil)
459 (erase-buffer) 432 (erase-buffer)
433 (insert "\
434Repository : " (directory-file-name (cvs-get-cvsroot)) "
435Module : " (cvs-get-module) "
436Working dir: " (abbreviate-file-name dir) "
437
438")
460 (setq buffer-read-only t) 439 (setq buffer-read-only t)
461 (cvs-mode) 440 (cvs-mode)
462 (set (make-local-variable 'list-buffers-directory) buffer-name) 441 (set (make-local-variable 'list-buffers-directory) buffer-name)
463 ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer)) 442 ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer))
464 (let ((cookies 443 (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n" "")))
465 (ewoc-create
466 buffer 'cvs-fileinfo-pp
467 (format "%s\n\nRepository : %s\nWorking directory: %s\n"
468 cvs-startup-message
469 (directory-file-name (cvs-get-cvsroot))
470 dir))))
471 (set (make-local-variable 'cvs-cookies) cookies) 444 (set (make-local-variable 'cvs-cookies) cookies)
472 (ewoc-enter-first
473 cookies
474 (cvs-create-fileinfo 'MESSAGE "" " " "\n" :subtype 'HEADER))
475 (ewoc-enter-last
476 cookies
477 (cvs-create-fileinfo 'MESSAGE "" " " "\n" :subtype 'FOOTER))
478 (make-local-hook 'kill-buffer-hook) 445 (make-local-hook 'kill-buffer-hook)
479 (add-hook 'kill-buffer-hook 446 (add-hook 'kill-buffer-hook
480 (lambda () 447 (lambda ()
@@ -599,14 +566,8 @@ If non-nil, NEW means to create a new buffer no matter what."
599 "\n"))) 566 "\n")))
600 (if nil (insert str) ;inline 567 (if nil (insert str) ;inline
601 ;;(with-current-buffer cvs-buffer 568 ;;(with-current-buffer cvs-buffer
602 (let* ((tin0 (ewoc-nth cvs-cookies 0)) 569 (let* ((prev-msg (car (ewoc-get-hf cvs-cookies)))
603 (tin-1 (ewoc-nth cvs-cookies -1)) 570 (tin (ewoc-nth cvs-cookies 0)))
604 (header (ewoc-data tin0))
605 (footer (ewoc-data tin-1))
606 (prev-msg (cvs-fileinfo->full-log header))
607 (tin tin0))
608 (assert (and (eq 'HEADER (cvs-fileinfo->subtype header))
609 (eq 'FOOTER (cvs-fileinfo->subtype footer))))
610 ;; look for the first *real* fileinfo (to determine emptyness) 571 ;; look for the first *real* fileinfo (to determine emptyness)
611 (while 572 (while
612 (and tin 573 (and tin
@@ -621,13 +582,11 @@ If non-nil, NEW means to create a new buffer no matter what."
621 (match-string 1 prev-msg) 582 (match-string 1 prev-msg)
622 " --"))) 583 " --")))
623 ;; set the new header and footer 584 ;; set the new header and footer
624 (setf (cvs-fileinfo->full-log header) str) 585 (ewoc-set-hf cvs-cookies
625 (setf (cvs-fileinfo->full-log footer) 586 str (concat "\n--------------------- "
626 (concat "\n--------------------- " 587 (if tin "End" "Empty")
627 (if tin "End" "Empty") 588 " ---------------------\n"
628 " ---------------------\n" 589 prev-msg))))))
629 prev-msg))
630 (ewoc-invalidate cvs-cookies tin0 tin-1)))));;)
631 590
632 591
633;;---------- 592;;----------
@@ -999,10 +958,9 @@ the override will persist until the next toggle."
999 958
1000;;---------- 959;;----------
1001(put 'cvs-mode 'mode-class 'special) 960(put 'cvs-mode 'mode-class 'special)
1002(easy-mmode-define-derived-mode cvs-mode fundamental-mode "CVS" 961(define-derived-mode cvs-mode fundamental-mode "CVS"
1003 "Mode used for PCL-CVS, a frontend to CVS. 962 "Mode used for PCL-CVS, a frontend to CVS.
1004Full documentation is in the Texinfo file. 963Full documentation is in the Texinfo file."
1005Pcl-cvs runs `pcl-cvs-load-hook' after being loaded."
1006 (setq mode-line-process 964 (setq mode-line-process
1007 '("" cvs-force-command cvs-ignore-marks-modif 965 '("" cvs-force-command cvs-ignore-marks-modif
1008 ":" (cvs-branch-prefix 966 ":" (cvs-branch-prefix
@@ -1012,6 +970,7 @@ Pcl-cvs runs `pcl-cvs-load-hook' after being loaded."
1012 (buffer-disable-undo (current-buffer)) 970 (buffer-disable-undo (current-buffer))
1013 ;;(set (make-local-variable 'goal-column) cvs-cursor-column) 971 ;;(set (make-local-variable 'goal-column) cvs-cursor-column)
1014 (set (make-local-variable 'revert-buffer-function) 'cvs-mode-revert-buffer) 972 (set (make-local-variable 'revert-buffer-function) 'cvs-mode-revert-buffer)
973 (setq truncate-lines t)
1015 (cvs-prefix-make-local 'cvs-branch-prefix) 974 (cvs-prefix-make-local 'cvs-branch-prefix)
1016 (cvs-prefix-make-local 'cvs-secondary-branch-prefix) 975 (cvs-prefix-make-local 'cvs-secondary-branch-prefix)
1017 (cvs-prefix-make-local 'cvs-force-command) 976 (cvs-prefix-make-local 'cvs-force-command)
@@ -1578,6 +1537,18 @@ Signal an error if there is no backup file."
1578 (setf (cvs-fileinfo->type fi) 'DEAD)) 1537 (setf (cvs-fileinfo->type fi) 'DEAD))
1579 (setf (cvs-fileinfo->type fi) 'DEAD))) 1538 (setf (cvs-fileinfo->type fi) 'DEAD)))
1580 1539
1540(defun cvs-is-within-p (fis dir)
1541 "Non-nil is buffer is inside one of FIS (in DIR)."
1542 (when (stringp buffer-file-name)
1543 (setq buffer-file-name (expand-file-name buffer-file-name))
1544 (let (ret)
1545 (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))
1546 (when (cvs-string-prefix-p
1547 (expand-file-name (cvs-fileinfo->full-path fi) dir)
1548 buffer-file-name)
1549 (setq ret t)))
1550 ret)))
1551
1581(defun* cvs-mode-run (cmd flags fis 1552(defun* cvs-mode-run (cmd flags fis
1582 &key (buf (cvs-temp-buffer)) 1553 &key (buf (cvs-temp-buffer))
1583 dont-change-disc cvsargs postproc) 1554 dont-change-disc cvsargs postproc)
@@ -1588,7 +1559,9 @@ DONT-CHANGE-DISC non-nil indicates that the command will not change the
1588 contents of files. This is only used by the parser. 1559 contents of files. This is only used by the parser.
1589POSTPROC is a list of expressions to be evaluated at the very end (after 1560POSTPROC is a list of expressions to be evaluated at the very end (after
1590 parsing if applicable). It will be prepended with `progn' is necessary." 1561 parsing if applicable). It will be prepended with `progn' is necessary."
1591 (save-some-buffers) 1562 (let ((def-dir default-directory))
1563 ;; Save the relevant buffers
1564 (save-some-buffers nil (lambda () (cvs-is-within-p fis def-dir))))
1592 (unless (listp flags) (error "flags should be a list of strings")) 1565 (unless (listp flags) (error "flags should be a list of strings"))
1593 (let* ((cvs-buf (current-buffer)) 1566 (let* ((cvs-buf (current-buffer))
1594 (single-dir (or (not (listp cvs-execute-single-dir)) 1567 (single-dir (or (not (listp cvs-execute-single-dir))