annotate lisp/cvs-status.el @ 81287:adbf60b3cc56

*** empty log message ***
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 08 Jun 2007 20:18:14 +0000
parents e3694f1cb928
children 9355f9b7bbff 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
1 ;;; cvs-status.el --- major mode for browsing `cvs status' output -*- coding: utf-8 -*-
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2
74439
ddcbd2c1b70d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 70292
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74439
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
5
70292
2b77fa42947f Update my email address.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68651
diff changeset
6 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
42557
c450330ea833 Add keyword header `tools' to actually get listed in finder.
Pavel Janík <Pavel@Janik.cz>
parents: 42217
diff changeset
7 ;; Keywords: pcl-cvs cvs status tree tools
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
8
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
10
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
14 ;; any later version.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
15
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
19 ;; GNU General Public License for more details.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
20
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63210
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63210
diff changeset
24 ;; Boston, MA 02110-1301, USA.
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
25
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
26 ;;; Commentary:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
27
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
28 ;; Todo:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
29
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
30 ;; - Somehow allow cvs-status-tree to work on-the-fly
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
31
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
32 ;;; Code:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
33
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
34 (eval-when-compile (require 'cl))
58159
4d0805441612 Reduce spurious warnings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56752
diff changeset
35 (require 'pcvs-util)
56752
ba72d48889b4 Require pcvs during byte-compiling for
Andreas Schwab <schwab@suse.de>
parents: 56750
diff changeset
36 (eval-when-compile (require 'pcvs))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
37
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
38 ;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
39
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
40 (defgroup cvs-status nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
41 "Major mode for browsing `cvs status' output."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
42 :group 'pcl-cvs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
43 :prefix "cvs-status-")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
44
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
45 (easy-mmode-defmap cvs-status-mode-map
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
46 '(("n" . next-line)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
47 ("p" . previous-line)
28249
090fad6a7bcb (cvs-status-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
48 ("N" . cvs-status-next)
090fad6a7bcb (cvs-status-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
49 ("P" . cvs-status-prev)
090fad6a7bcb (cvs-status-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
50 ("\M-n" . cvs-status-next)
090fad6a7bcb (cvs-status-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
51 ("\M-p" . cvs-status-prev)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
52 ("t" . cvs-status-cvstrees)
56750
5ca81cc9c2de (cvs-status-checkout): New function.
Masatake YAMATO <jet@gyve.org>
parents: 55790
diff changeset
53 ("T" . cvs-status-trees)
58159
4d0805441612 Reduce spurious warnings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56752
diff changeset
54 (">" . cvs-mode-checkout))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
55 "CVS-Status' keymap."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
56 :group 'cvs-status
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
57 :inherit 'cvs-mode-map)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
58
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
59 ;;(easy-menu-define cvs-status-menu cvs-status-mode-map
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
60 ;; "Menu for `cvs-status-mode'."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
61 ;; '("CVS-Status"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
62 ;; ["Show Tag Trees" cvs-status-tree t]
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
63 ;; ))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
64
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
65 (defvar cvs-status-mode-hook nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
66 "Hook run at the end of `cvs-status-mode'.")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
67
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
68 (defconst cvs-status-tags-leader-re "^ Existing Tags:$")
31972
5fbecb49e386 (cvs-status-entry-leader-re): Minor fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30887
diff changeset
69 (defconst cvs-status-entry-leader-re
5fbecb49e386 (cvs-status-entry-leader-re): Minor fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30887
diff changeset
70 "^File:\\s-+\\(?:no file \\)?\\(.*\\S-\\)\\s-+Status: \\(.+\\)$")
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
71 (defconst cvs-status-dir-re "^cvs[.ex]* [a-z]+: Examining \\(.+\\)$")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
72 (defconst cvs-status-rev-re "[0-9][.0-9]*\\.[.0-9]*[0-9]")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
73 (defconst cvs-status-tag-re "[ \t]\\([a-zA-Z][^ \t\n.]*\\)")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
74
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
75 (defconst cvs-status-font-lock-keywords
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
76 `((,cvs-status-entry-leader-re
63210
2e115caaa7d2 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380
Miles Bader <miles@gnu.org>
parents: 58159
diff changeset
77 (1 'cvs-filename)
2e115caaa7d2 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380
Miles Bader <miles@gnu.org>
parents: 58159
diff changeset
78 (2 'cvs-need-action))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
79 (,cvs-status-tags-leader-re
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
80 (,cvs-status-rev-re
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
81 (save-excursion (re-search-forward "^\n" nil 'move) (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
82 (progn (re-search-backward cvs-status-tags-leader-re nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
83 (forward-line 1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
84 (0 font-lock-comment-face))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
85 (,cvs-status-tag-re
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
86 (save-excursion (re-search-forward "^\n" nil 'move) (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
87 (progn (re-search-backward cvs-status-tags-leader-re nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
88 (forward-line 1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
89 (1 font-lock-function-name-face)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
90 (defconst cvs-status-font-lock-defaults
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
91 '(cvs-status-font-lock-keywords t nil nil nil (font-lock-multiline . t)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42557
diff changeset
92
58159
4d0805441612 Reduce spurious warnings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56752
diff changeset
93 (defvar cvs-minor-wrap-function)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
94 (put 'cvs-status-mode 'mode-class 'special)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
95 ;;;###autoload
28250
3cfb9a01a935 (cvs-status-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28249
diff changeset
96 (define-derived-mode cvs-status-mode fundamental-mode "CVS-Status"
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
97 "Mode used for cvs status output."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
98 (set (make-local-variable 'font-lock-defaults) cvs-status-font-lock-defaults)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
99 (set (make-local-variable 'cvs-minor-wrap-function) 'cvs-status-minor-wrap))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
100
28249
090fad6a7bcb (cvs-status-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
101 ;; Define cvs-status-next and cvs-status-prev
090fad6a7bcb (cvs-status-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
102 (easy-mmode-define-navigation cvs-status cvs-status-entry-leader-re "entry")
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
103
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
104 (defun cvs-status-current-file ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
105 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
106 (forward-line 1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
107 (or (re-search-backward cvs-status-entry-leader-re nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
108 (re-search-forward cvs-status-entry-leader-re))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
109 (let* ((file (match-string 1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
110 (cvsdir (and (re-search-backward cvs-status-dir-re nil t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
111 (match-string 1)))
58159
4d0805441612 Reduce spurious warnings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56752
diff changeset
112 (pcldir (and (if (boundp 'cvs-pcl-cvs-dirchange-re)
4d0805441612 Reduce spurious warnings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56752
diff changeset
113 (re-search-backward cvs-pcl-cvs-dirchange-re nil t))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
114 (match-string 1)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
115 (dir ""))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
116 (let ((default-directory ""))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
117 (when pcldir (setq dir (expand-file-name pcldir dir)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
118 (when cvsdir (setq dir (expand-file-name cvsdir dir)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
119 (expand-file-name file dir)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
120
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
121 (defun cvs-status-current-tag ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
122 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
123 (let ((pt (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
124 (col (current-column))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
125 (start (progn (re-search-backward cvs-status-tags-leader-re nil t) (point)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
126 (end (progn (re-search-forward "^$" nil t) (point))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
127 (when (and (< start pt) (> end pt))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
128 (goto-char pt)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
129 (end-of-line)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
130 (let ((tag nil) (dist pt) (end (point)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
131 (beginning-of-line)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
132 (while (re-search-forward cvs-status-tag-re end t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
133 (let* ((cole (current-column))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
134 (colb (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
135 (goto-char (match-beginning 1)) (current-column)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
136 (ndist (min (abs (- cole col)) (abs (- colb col)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
137 (when (< ndist dist)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
138 (setq dist ndist)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
139 (setq tag (match-string 1)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
140 tag)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
141
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
142 (defun cvs-status-minor-wrap (buf f)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
143 (let ((data (with-current-buffer buf
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
144 (cons
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
145 (cons (cvs-status-current-file)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
146 (cvs-status-current-tag))
28857
3ec1142abebd (cvs-status-minor-wrap): Use mark-active.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28250
diff changeset
147 (when mark-active
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
148 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
149 (goto-char (mark))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
150 (cons (cvs-status-current-file)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
151 (cvs-status-current-tag))))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
152 (let ((cvs-branch-prefix (cdar data))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
153 (cvs-secondary-branch-prefix (and (cdar data) (cddr data)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
154 (cvs-minor-current-files
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
155 (cons (caar data)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
156 (when (and (cadr data) (not (equal (caar data) (cadr data))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
157 (list (cadr data)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
158 ;; FIXME: I need to force because the fileinfos are UNKNOWN
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
159 (cvs-force-command "/F"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
160 (funcall f))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
161
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
162 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
163 ;; Tagelt, tag element
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
164 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
165
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
166 (defstruct (cvs-tag
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
167 (:constructor nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
168 (:constructor cvs-tag-make
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
169 (vlist &optional name type))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
170 (:conc-name cvs-tag->))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
171 vlist
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
172 name
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
173 type)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
174
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
175 (defsubst cvs-status-vl-to-str (vl) (mapconcat 'number-to-string vl "."))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
176
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
177 (defun cvs-tag->string (tag)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
178 (if (stringp tag) tag
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
179 (let ((name (cvs-tag->name tag))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
180 (vl (cvs-tag->vlist tag)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
181 (if (null name) (cvs-status-vl-to-str vl)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
182 (let ((rev (if vl (concat " (" (cvs-status-vl-to-str vl) ")") "")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
183 (if (consp name) (mapcar (lambda (name) (concat name rev)) name)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
184 (concat name rev)))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
185
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
186 (defun cvs-tag-compare-1 (vl1 vl2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
187 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
188 ((and (null vl1) (null vl2)) 'equal)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
189 ((null vl1) 'more2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
190 ((null vl2) 'more1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
191 (t (let ((v1 (car vl1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
192 (v2 (car vl2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
193 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
194 ((> v1 v2) 'more1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
195 ((< v1 v2) 'more2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
196 (t (cvs-tag-compare-1 (cdr vl1) (cdr vl2))))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
197
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
198 (defsubst cvs-tag-compare (tag1 tag2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
199 (cvs-tag-compare-1 (cvs-tag->vlist tag1) (cvs-tag->vlist tag2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
200
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
201 (defun cvs-tag-merge (tag1 tag2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
202 "Merge TAG1 and TAG2 into one."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
203 (let ((type1 (cvs-tag->type tag1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
204 (type2 (cvs-tag->type tag2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
205 (name1 (cvs-tag->name tag1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
206 (name2 (cvs-tag->name tag2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
207 (unless (equal (cvs-tag->vlist tag1) (cvs-tag->vlist tag2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
208 (setf (cvs-tag->vlist tag1) nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
209 (if type1
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
210 (unless (or (not type2) (equal type1 type2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
211 (setf (cvs-tag->type tag1) nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
212 (setf (cvs-tag->type tag1) type2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
213 (if name1
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
214 (setf (cvs-tag->name tag1) (cvs-append name1 name2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
215 (setf (cvs-tag->name tag1) name2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
216 tag1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
217
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
218 (defun cvs-tree-print (tags printer column)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
219 "Print the tree of TAGS where each tag's string is given by PRINTER.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
220 PRINTER should accept both a tag (in which case it should return a string)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
221 or a string (in which case it should simply return its argument).
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
222 A tag cannot be a CONS. The return value can also be a list of strings,
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
223 if several nodes where merged into one.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
224 The tree will be printed no closer than column COLUMN."
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42557
diff changeset
225
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
226 (let* ((eol (save-excursion (end-of-line) (current-column)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
227 (column (max (+ eol 2) column)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
228 (if (null tags) column
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
229 ;;(move-to-column-force column)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
230 (let* ((rev (cvs-car tags))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
231 (name (funcall printer (cvs-car rev)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
232 (rest (append (cvs-cdr name) (cvs-cdr tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
233 (prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
234 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
235 (or (= (forward-line 1) 0) (insert "\n"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
236 (cvs-tree-print rest printer column))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
237 (assert (>= prefix column))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
238 (move-to-column prefix t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
239 (assert (eolp))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
240 (insert (cvs-car name))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
241 (dolist (br (cvs-cdr rev))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
242 (let* ((column (current-column))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
243 (brrev (funcall printer (cvs-car br)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
244 (brlength (length (cvs-car brrev)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
245 (brfill (concat (make-string (/ brlength 2) ? ) "|"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
246 (prefix
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
247 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
248 (insert " -- ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
249 (cvs-tree-print (cvs-append brrev brfill (cvs-cdr br))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
250 printer (current-column)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
251 (delete-region (save-excursion (move-to-column prefix) (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
252 (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
253 (insert " " (make-string (- prefix column 2) ?-) " ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
254 (end-of-line)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
255 prefix))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
256
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
257 (defun cvs-tree-merge (tree1 tree2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
258 "Merge tags trees TREE1 and TREE2 into one.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
259 BEWARE: because of stability issues, this is not a symetric operation."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
260 (assert (and (listp tree1) (listp tree2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
261 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
262 ((null tree1) tree2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
263 ((null tree2) tree1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
264 (t
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
265 (let* ((rev1 (car tree1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
266 (tag1 (cvs-car rev1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
267 (vl1 (cvs-tag->vlist tag1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
268 (l1 (length vl1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
269 (rev2 (car tree2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
270 (tag2 (cvs-car rev2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
271 (vl2 (cvs-tag->vlist tag2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
272 (l2 (length vl2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
273 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
274 ((= l1 l2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
275 (case (cvs-tag-compare tag1 tag2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
276 (more1 (list* rev2 (cvs-tree-merge tree1 (cdr tree2))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
277 (more2 (list* rev1 (cvs-tree-merge (cdr tree1) tree2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
278 (equal
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
279 (cons (cons (cvs-tag-merge tag1 tag2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
280 (cvs-tree-merge (cvs-cdr rev1) (cvs-cdr rev2)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
281 (cvs-tree-merge (cdr tree1) (cdr tree2))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
282 ((> l1 l2)
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
283 (cvs-tree-merge
55790
45bf91de4d41 (cvs-tree-merge, cvs-tags->tree): Use `butlast', not `cvs-butlast'.
Juanma Barranquero <lekktu@gmail.com>
parents: 55076
diff changeset
284 (list (cons (cvs-tag-make (butlast vl1)) tree1)) tree2))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
285 ((< l1 l2)
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
286 (cvs-tree-merge
55790
45bf91de4d41 (cvs-tree-merge, cvs-tags->tree): Use `butlast', not `cvs-butlast'.
Juanma Barranquero <lekktu@gmail.com>
parents: 55076
diff changeset
287 tree1 (list (cons (cvs-tag-make (butlast vl2)) tree2)))))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
288
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
289 (defun cvs-tag-make-tag (tag)
30618
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 28857
diff changeset
290 (let ((vl (mapcar 'string-to-number (split-string (nth 2 tag) "\\."))))
9dd1a6504bdd Use `nth' instead of `first', `second', and `third'.
Gerd Moellmann <gerd@gnu.org>
parents: 28857
diff changeset
291 (cvs-tag-make vl (nth 0 tag) (intern (nth 1 tag)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
292
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
293 (defun cvs-tags->tree (tags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
294 "Make a tree out of a list of TAGS."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
295 (let ((tags
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
296 (mapcar
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
297 (lambda (tag)
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
298 (let ((tag (cvs-tag-make-tag tag)))
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
299 (list (if (not (eq (cvs-tag->type tag) 'branch)) tag
55790
45bf91de4d41 (cvs-tree-merge, cvs-tags->tree): Use `butlast', not `cvs-butlast'.
Juanma Barranquero <lekktu@gmail.com>
parents: 55076
diff changeset
300 (list (cvs-tag-make (butlast (cvs-tag->vlist tag)))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
301 tag)))))
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
302 tags)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
303 (while (cdr tags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
304 (let (tl)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
305 (while tags
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
306 (push (cvs-tree-merge (pop tags) (pop tags)) tl))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
307 (setq tags (nreverse tl))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
308 (car tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
309
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
310 (defun cvs-status-get-tags ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
311 "Look for a list of tags, read them in and delete them.
42206
0f4506820432 Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 34652
diff changeset
312 Return nil if there was an empty list of tags and t if there wasn't
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
313 even a list. Else, return the list of tags where each element of
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
314 the list is a three-string list TAG, KIND, REV."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
315 (let ((tags nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
316 (if (not (re-search-forward cvs-status-tags-leader-re nil t)) t
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
317 (forward-char 1)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
318 (let ((pt (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
319 (lastrev nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
320 (case-fold-search t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
321 (or
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
322 (looking-at "\\s-+no\\s-+tags")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
323
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
324 (progn ; normal listing
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
325 (while (looking-at "^[ \t]+\\([^ \t\n]+\\)[ \t]+(\\([a-z]+\\): \\(.+\\))$")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
326 (push (list (match-string 1) (match-string 2) (match-string 3)) tags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
327 (forward-line 1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
328 (unless (looking-at "^$") (setq tags nil) (goto-char pt))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
329 tags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
330
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
331 (progn ; cvstree-style listing
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
332 (while (or (looking-at "^ .+\\(.\\) \\([0-9.]+\\): \\([^\n\t .0-9][^\n\t ]*\\)?$")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
333 (and lastrev
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
334 (looking-at "^ .+\\(\\) \\(8\\)? \\([^\n\t .0-9][^\n\t ]*\\)$")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
335 (setq lastrev (or (match-string 2) lastrev))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
336 (push (list (match-string 3)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
337 (if (equal (match-string 1) " ") "branch" "revision")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
338 lastrev) tags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
339 (forward-line 1))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
340 (unless (looking-at "^$") (setq tags nil) (goto-char pt))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
341 (setq tags (nreverse tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
342
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
343 (progn ; new tree style listing
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
344 (let* ((re-lead "[ \t]*\\(-+\\)?\\(|\n?[ \t]+\\)*")
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
345 (re3 (concat re-lead "\\(\\.\\)?\\(" cvs-status-rev-re "\\)"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
346 (re2 (concat re-lead cvs-status-tag-re "\\(\\)"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
347 (re1 (concat re-lead cvs-status-tag-re
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
348 " (\\(" cvs-status-rev-re "\\))")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
349 (while (or (looking-at re1) (looking-at re2) (looking-at re3))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
350 (push (list (match-string 3)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
351 (if (match-string 1) "branch" "revision")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
352 (match-string 4)) tags)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
353 (goto-char (match-end 0))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
354 (when (eolp) (forward-char 1))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
355 (unless (looking-at "^$") (setq tags nil) (goto-char pt))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
356 (setq tags (nreverse tags))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
357
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
358 (delete-region pt (point)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
359 tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
360
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
361 (defvar font-lock-mode)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
362 (defun cvs-refontify (beg end)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
363 (when (and (boundp 'font-lock-mode)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
364 font-lock-mode
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
365 (fboundp 'font-lock-fontify-region))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
366 (font-lock-fontify-region (1- beg) (1+ end))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
367
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
368 (defun cvs-status-trees ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
369 "Look for a lists of tags, and replace them with trees."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
370 (interactive)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
371 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
372 (goto-char (point-min))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
373 (let ((inhibit-read-only t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
374 (tags nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
375 (while (listp (setq tags (cvs-status-get-tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
376 ;;(let ((pt (save-excursion (forward-line -1) (point))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
377 (save-restriction
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
378 (narrow-to-region (point) (point))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
379 ;;(newline)
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
380 (combine-after-change-calls
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
381 (cvs-tree-print (cvs-tags->tree tags) 'cvs-tag->string 3)))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
382 ;;(cvs-refontify pt (point))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
383 ;;(sit-for 0)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
384 ;;)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
385 ))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
386
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
387 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
388 ;;;; CVSTree-style trees
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
389 ;;;;
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
390
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
391 (defvar cvs-tree-use-jisx0208 nil) ;Old compat var.
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
392 (defvar cvs-tree-use-charset
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
393 (cond
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
394 (cvs-tree-use-jisx0208 'jisx0208)
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
395 ((char-displayable-p ?━) 'unicode)
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
396 ((char-displayable-p (make-char 'japanese-jisx0208 40 44)) 'jisx0208))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
397 "*Non-nil if we should use the graphical glyphs from `japanese-jisx0208'.
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
398 Otherwise, default to ASCII chars like +, - and |.")
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
399
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
400 (defconst cvs-tree-char-space
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
401 (case cvs-tree-use-charset
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
402 (jisx0208 (make-char 'japanese-jisx0208 33 33))
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
403 (unicode " ")
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
404 (t " ")))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
405 (defconst cvs-tree-char-hbar
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
406 (case cvs-tree-use-charset
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
407 (jisx0208 (make-char 'japanese-jisx0208 40 44))
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
408 (unicode "━")
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
409 (t "--")))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
410 (defconst cvs-tree-char-vbar
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
411 (case cvs-tree-use-charset
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
412 (jisx0208 (make-char 'japanese-jisx0208 40 45))
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
413 (unicode "┃")
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
414 (t "| ")))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
415 (defconst cvs-tree-char-branch
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
416 (case cvs-tree-use-charset
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
417 (jisx0208 (make-char 'japanese-jisx0208 40 50))
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
418 (unicode "┣")
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
419 (t "+-")))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
420 (defconst cvs-tree-char-eob ;end of branch
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
421 (case cvs-tree-use-charset
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
422 (jisx0208 (make-char 'japanese-jisx0208 40 49))
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
423 (unicode "┗")
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
424 (t "`-")))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
425 (defconst cvs-tree-char-bob ;beginning of branch
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
426 (case cvs-tree-use-charset
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
427 (jisx0208 (make-char 'japanese-jisx0208 40 51))
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
428 (unicode "┳")
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
429 (t "+-")))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
430
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
431 (defun cvs-tag-lessp (tag1 tag2)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
432 (eq (cvs-tag-compare tag1 tag2) 'more2))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
433
28249
090fad6a7bcb (cvs-status-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
434 (defvar cvs-tree-nomerge nil)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
435
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
436 (defun cvs-status-cvstrees (&optional arg)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
437 "Look for a list of tags, and replace it with a tree.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
438 Optional prefix ARG chooses between two representations."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
439 (interactive "P")
55076
913c2e3a059f (cvs-tree-use-charset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54579
diff changeset
440 (when (and cvs-tree-use-charset
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
441 (not enable-multibyte-characters))
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
442 ;; We need to convert the buffer from unibyte to multibyte
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
443 ;; since we'll use multibyte chars for the tree.
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
444 (let ((modified (buffer-modified-p))
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
445 (inhibit-read-only t)
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
446 (inhibit-modification-hooks t))
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
447 (unwind-protect
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
448 (progn
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
449 (decode-coding-region (point-min) (point-max) 'undecided)
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
450 (set-buffer-multibyte t))
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
451 (restore-buffer-modified-p modified))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
452 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
453 (goto-char (point-min))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
454 (let ((inhibit-read-only t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
455 (tags nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
456 (cvs-tree-nomerge (if arg (not cvs-tree-nomerge) cvs-tree-nomerge)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
457 (while (listp (setq tags (cvs-status-get-tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
458 (let ((tags (mapcar 'cvs-tag-make-tag tags))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
459 ;;(pt (save-excursion (forward-line -1) (point)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
460 )
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
461 (setq tags (sort tags 'cvs-tag-lessp))
30887
c4366892a814 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
462 (let* ((first (car tags))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
463 (prev (if (cvs-tag-p first)
30887
c4366892a814 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 30618
diff changeset
464 (list (car (cvs-tag->vlist first))) nil)))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
465 (combine-after-change-calls
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
466 (cvs-tree-tags-insert tags prev))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
467 ;;(cvs-refontify pt (point))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
468 ;;(sit-for 0)
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
469 ))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
470
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
471 (defun cvs-tree-tags-insert (tags prev)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
472 (when tags
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
473 (let* ((tag (car tags))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
474 (vlist (cvs-tag->vlist tag))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
475 (nprev ;"next prev"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
476 (let* ((next (cvs-car (cadr tags)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
477 (nprev (if (and cvs-tree-nomerge next
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
478 (equal vlist (cvs-tag->vlist next)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
479 prev vlist)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
480 (cvs-map (lambda (v p) v) nprev prev)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
481 (after (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
482 (newline)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
483 (cvs-tree-tags-insert (cdr tags) nprev)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
484 (pe t) ;"prev equal"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
485 (nas nil)) ;"next afters" to be returned
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
486 (insert " ")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
487 (do* ((vs vlist (cdr vs))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
488 (ps prev (cdr ps))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
489 (as after (cdr as)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
490 ((and (null as) (null vs) (null ps))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
491 (let ((revname (cvs-status-vl-to-str vlist)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
492 (if (cvs-every 'identity (cvs-map 'equal prev vlist))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
493 (insert (make-string (+ 4 (length revname)) ? )
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
494 (or (cvs-tag->name tag) ""))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
495 (insert " " revname ": " (or (cvs-tag->name tag) "")))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
496 (let* ((eq (and pe (equal (car ps) (car vs))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
497 (next-eq (equal (cadr ps) (cadr vs))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
498 (let* ((na+char
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
499 (if (car as)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
500 (if eq
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
501 (if next-eq (cons t cvs-tree-char-vbar)
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
502 (cons t cvs-tree-char-branch))
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
503 (cons nil cvs-tree-char-bob))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
504 (if eq
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
505 (if next-eq (cons nil cvs-tree-char-space)
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
506 (cons t cvs-tree-char-eob))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
507 (cons nil (if (and (eq (cvs-tag->type tag) 'branch)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
508 (cvs-every 'null as))
33231
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
509 cvs-tree-char-space
c08a986392cd (cvs-tree-merge): Use cvs-butlast (avoid CL).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31972
diff changeset
510 cvs-tree-char-hbar))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
511 (insert (cdr na+char))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
512 (push (car na+char) nas))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
513 (setq pe eq)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
514 (nreverse nas))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
515
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42557
diff changeset
516 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
517 ;;;; Merged trees from different files
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42557
diff changeset
518 ;;;;
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
519
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
520 (defun cvs-tree-fuzzy-merge-1 (trees tree prev)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
521 )
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
522
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
523 (defun cvs-tree-fuzzy-merge (trees tree)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
524 "Do the impossible: merge TREE into TREES."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
525 ())
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
526
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
527 (defun cvs-tree ()
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
528 "Get tags from the status output and merge tham all into a big tree."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
529 (save-excursion
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
530 (goto-char (point-min))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
531 (let ((inhibit-read-only t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
532 (trees (make-vector 31 0)) tree)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
533 (while (listp (setq tree (cvs-tags->tree (cvs-status-get-tags))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
534 (cvs-tree-fuzzy-merge trees tree))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
535 (erase-buffer)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
536 (let ((cvs-tag-print-rev nil))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
537 (cvs-tree-print tree 'cvs-tag->string 3)))))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42557
diff changeset
538
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
539
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
540 (provide 'cvs-status)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
541
58159
4d0805441612 Reduce spurious warnings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56752
diff changeset
542 ;; arch-tag: db8b5094-d02a-473e-a476-544e89ff5ad0
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
543 ;;; cvs-status.el ends here