annotate lisp/pcvs-info.el @ 33900:d038b15baca0

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Mon, 27 Nov 2000 12:13:06 +0000
parents 5ca411467bf3
children dd613770eb0f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1 ;;; pcvs-info.el --- Internal representation of a fileinfo entry
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
3 ;; Copyright (C) 1991-2000 Free Software Foundation, Inc.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
4
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
5 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
6 ;; Keywords: pcl-cvs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
7 ;; Version: $Name: $
33431
5ca411467bf3 (cvs-fi-conflict-face): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29576
diff changeset
8 ;; Revision: $Id: pcvs-info.el,v 1.3 2000/06/12 04:37:50 monnier Exp $
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
9
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
11
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
12 ;; 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
13 ;; 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
14 ;; the Free Software Foundation; either version 2, or (at your option)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
15 ;; any later version.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
16
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
17 ;; 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
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
20 ;; GNU General Public License for more details.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
21
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
22 ;; 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
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
26
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
27 ;;; Commentary:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
28
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
29 ;; The cvs-fileinfo data structure:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
30 ;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
31 ;; When the `cvs update' is ready we parse the output. Every file
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
32 ;; that is affected in some way is added to the cookie collection as
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
33 ;; a "fileinfo" (as defined below in cvs-create-fileinfo).
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
34
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
35 ;;; Code:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
36
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
37 (eval-when-compile (require 'cl))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
38 (require 'pcvs-util)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
39 ;;(require 'pcvs-defs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
40
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
41 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
42 ;;;; config variables
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
43 ;;;;
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 (defcustom cvs-display-full-path t
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
46 "*Specifies how the filenames should look like in the listing.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
47 If t, their full path name will be displayed, else only the filename."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
48 :group 'pcl-cvs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
49 :type '(boolean))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
50
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
51 (defvar global-font-lock-mode)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
52 (defvar font-lock-auto-fontify)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
53 (defcustom cvs-highlight
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
54 (or (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
55 (and (boundp 'global-font-lock-mode) global-font-lock-mode))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
56 "*Whether to use text highlighting (à la font-lock) or not."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
57 :group 'pcl-cvs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
58 :type '(boolean))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
59
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
60 (defcustom cvs-allow-dir-commit nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
61 "*Allow `cvs-mode-commit' on directories.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
62 If you commit without any marked file and with the cursor positioned
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
63 on a directory entry, cvs would commit the whole directory. This seems
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
64 to confuse some users sometimes."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
65 :group 'pcl-cvs
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
66 :type '(boolean))
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 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
69 ;;;; Faces for fontification
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
70 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
71
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
72 (defface cvs-header-face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
73 '((((class color) (background dark))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
74 (:foreground "lightyellow" :bold t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
75 (((class color) (background light))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
76 (:foreground "blue4" :bold t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
77 (t (:bold t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
78 "PCL-CVS face used to highlight directory changes."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
79 :group 'pcl-cvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
80
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
81 (defface cvs-filename-face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
82 '((((class color) (background dark))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
83 (:foreground "lightblue"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
84 (((class color) (background light))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
85 (:foreground "blue4"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
86 (t ()))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
87 "PCL-CVS face used to highlight file names."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
88 :group 'pcl-cvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
89
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
90 (defface cvs-unknown-face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
91 '((((class color) (background dark))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
92 (:foreground "red"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
93 (((class color) (background light))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
94 (:foreground "red"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
95 (t (:italic t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
96 "PCL-CVS face used to highlight unknown file status."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
97 :group 'pcl-cvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
98
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
99 (defface cvs-handled-face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
100 '((((class color) (background dark))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
101 (:foreground "pink"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
102 (((class color) (background light))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
103 (:foreground "pink"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
104 (t ()))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
105 "PCL-CVS face used to highlight handled file status."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
106 :group 'pcl-cvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
107
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
108 (defface cvs-need-action-face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
109 '((((class color) (background dark))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
110 (:foreground "orange"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
111 (((class color) (background light))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
112 (:foreground "orange"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
113 (t (:italic t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
114 "PCL-CVS face used to highlight status of files needing action."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
115 :group 'pcl-cvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
116
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
117 (defface cvs-marked-face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
118 '((((class color) (background dark))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
119 (:foreground "green" :bold t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
120 (((class color) (background light))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
121 (:foreground "green3" :bold t))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
122 (t (:bold t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
123 "PCL-CVS face used to highlight marked file indicator."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
124 :group 'pcl-cvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
125
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
126 (defface cvs-msg-face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
127 '((t (:italic t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
128 "PCL-CVS face used to highlight CVS messages."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
129 :group 'pcl-cvs)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
130
29576
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
131 (defvar cvs-fi-up-to-date-face 'cvs-handled-face)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
132 (defvar cvs-fi-unknown-face 'cvs-unknown-face)
33431
5ca411467bf3 (cvs-fi-conflict-face): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29576
diff changeset
133 (defvar cvs-fi-conflict-face 'font-lock-warning-face)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
134
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
135 ;; There is normally no need to alter the following variable, but if
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
136 ;; your site has installed CVS in a non-standard way you might have
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
137 ;; to change it.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
138
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
139 (defvar cvs-bakprefix ".#"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
140 "The prefix that CVS prepends to files when rcsmerge'ing.")
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 (easy-mmode-defmap cvs-status-map
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
143 '(([(mouse-2)] . cvs-mouse-toggle-mark))
29576
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
144 "Local keymap for text properties of status")
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
145
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
146 ;; Constructor:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
147
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
148 (defstruct (cvs-fileinfo
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
149 (:constructor nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
150 (:copier nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
151 (:constructor -cvs-create-fileinfo (type dir file full-log
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
152 &key marked subtype
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
153 merge
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
154 base-rev
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
155 head-rev))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
156 (:conc-name cvs-fileinfo->))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
157 marked ;; t/nil.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
158 type ;; See below
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
159 subtype ;; See below
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
160 dir ;; Relative directory the file resides in.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
161 ;; (concat dir file) should give a valid path.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
162 file ;; The file name sans the directory.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
163 base-rev ;; During status: This is the revision that the
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
164 ;; working file is based on.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
165 head-rev ;; During status: This is the highest revision in
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
166 ;; the repository.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
167 merge ;; A cons cell containing the (ancestor . head) revisions
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
168 ;; of the merge that resulted in the current file.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
169 ;;removed ;; t if the file no longer exists.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
170 full-log ;; The output from cvs, unparsed.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
171 ;;mod-time ;; Not used.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
172
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
173 ;; In addition to the above, the following values can be extracted:
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 ;; handled ;; t if this file doesn't require further action.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
176 ;; full-path ;; The complete relative filename.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
177 ;; pp-name ;; The printed file name
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
178 ;; backup-file;; For MERGED and CONFLICT files after a \"cvs update\",
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
179 ;; this is a full path to the backup file where the
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
180 ;; untouched version resides.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
181
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
182 ;; The meaning of the type field:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
183
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
184 ;; Value ---Used by--- Explanation
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
185 ;; update status
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
186 ;; NEED-UPDATE x file needs update
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
187 ;; MODIFIED x x modified by you, unchanged in repository
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
188 ;; MERGED x x successful merge
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
189 ;; ADDED x x added by you, not yet committed
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
190 ;; MISSING x rm'd, but not yet `cvs remove'd
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
191 ;; REMOVED x x removed by you, not yet committed
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
192 ;; NEED-MERGE x need merge
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
193 ;; CONFLICT x conflict when merging
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
194 ;; ;;MOD-CONFLICT x removed locally, changed in repository.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
195 ;; DIRCHANGE x x A change of directory.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
196 ;; UNKNOWN x An unknown file.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
197 ;; UP-TO-DATE x The file is up-to-date.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
198 ;; UPDATED x x file copied from repository
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
199 ;; PATCHED x x diff applied from repository
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
200 ;; COMMITTED x x cvs commit'd
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
201 ;; DEAD An entry that should be removed
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
202 ;; MESSAGE x x This is a special fileinfo that is used
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
203 ;; to display a text that should be in
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
204 ;; full-log."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
205 ;; TEMP A temporary message that should be removed
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
206 )
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
207 (defun cvs-create-fileinfo (type dir file msg &rest keys)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
208 (cvs-check-fileinfo (apply #'-cvs-create-fileinfo type dir file msg keys)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
209
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
210 ;; Fake selectors:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
211
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
212 (defun cvs-fileinfo->full-path (fileinfo)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
213 "Return the full path for the file that is described in FILEINFO."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
214 (let ((dir (cvs-fileinfo->dir fileinfo)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
215 (if (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
216 (if (string= dir "") "." (directory-file-name dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
217 ;; Here, I use `concat' rather than `expand-file-name' because I want
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
218 ;; the resulting path to stay relative if `dir' is relative.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
219 (concat dir (cvs-fileinfo->file fileinfo)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
220
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
221 (defun cvs-fileinfo->pp-name (fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
222 "Return the filename of FI as it should be displayed."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
223 (if cvs-display-full-path
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
224 (cvs-fileinfo->full-path fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
225 (cvs-fileinfo->file fi)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
226
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
227 (defun cvs-fileinfo->backup-file (fileinfo)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
228 "Construct the file name of the backup file for FILEINFO."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
229 (let* ((dir (cvs-fileinfo->dir fileinfo))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
230 (file (cvs-fileinfo->file fileinfo))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
231 (default-directory (file-name-as-directory (expand-file-name dir)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
232 (files (directory-files "." nil
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
233 (concat "^" (regexp-quote cvs-bakprefix)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
234 (regexp-quote file) "\\.")))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
235 bf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
236 (dolist (f files bf)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
237 (when (and (file-readable-p f)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
238 (or (null bf) (file-newer-than-file-p f bf)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
239 (setq bf (concat dir f))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
240
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
241 ;; (defun cvs-fileinfo->handled (fileinfo)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
242 ;; "Tell if this requires further action"
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
243 ;; (memq (cvs-fileinfo->type fileinfo) '(UP-TO-DATE DEAD)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
244
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
245
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
246 ;; Predicate:
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
247
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
248 (defun boolp (x) (or (eq t x) (null x)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
249 (defun cvs-check-fileinfo (fi)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
250 "Check FI's conformance to some conventions."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
251 (let ((check 'none)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
252 (type (cvs-fileinfo->type fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
253 (subtype (cvs-fileinfo->subtype fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
254 (marked (cvs-fileinfo->marked fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
255 (dir (cvs-fileinfo->dir fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
256 (file (cvs-fileinfo->file fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
257 (base-rev (cvs-fileinfo->base-rev fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
258 (head-rev (cvs-fileinfo->head-rev fi))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
259 (full-log (cvs-fileinfo->full-log fi)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
260 (if (and (setq check 'marked) (boolp marked)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
261 (setq check 'base-rev) (or (null base-rev) (stringp base-rev))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
262 (setq check 'head-rev) (or (null head-rev) (stringp head-rev))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
263 (setq check 'full-log) (stringp full-log)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
264 (setq check 'dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
265 (and (stringp dir)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
266 (not (file-name-absolute-p dir))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
267 (or (string= dir "")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
268 (string= dir (file-name-as-directory dir))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
269 (setq check 'file)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
270 (and (stringp file)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
271 (string= file (file-name-nondirectory file)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
272 (setq check 'type) (symbolp type)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
273 (setq check 'consistency)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
274 (case type
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
275 (DIRCHANGE (and (null subtype) (string= "." file)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
276 ((NEED-UPDATE ADDED MISSING DEAD MODIFIED MESSAGE UP-TO-DATE
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
277 REMOVED NEED-MERGE CONFLICT UNKNOWN MESSAGE)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
278 t)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
279 fi
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
280 (error "Invalid :%s in cvs-fileinfo %s" check fi))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
281
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
282
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
283 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
284 ;;;; State table to indicate what you can do when.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
285 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
286
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
287 (defconst cvs-states
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
288 `((NEED-UPDATE update diff)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
289 (UP-TO-DATE update nil remove diff safe-rm revert)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
290 (MODIFIED update commit undo remove diff merge diff-base)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
291 (ADDED update commit remove)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
292 (MISSING remove undo update safe-rm revert)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
293 (REMOVED commit add undo safe-rm)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
294 (NEED-MERGE update undo diff diff-base)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
295 (CONFLICT merge remove undo commit diff diff-base)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
296 (DIRCHANGE remove update diff ,(if cvs-allow-dir-commit 'commit) tag)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
297 (UNKNOWN ignore add remove)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
298 (DEAD )
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
299 (MESSAGE))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
300 "Fileinfo state descriptions for pcl-cvs.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
301 This is an assoc list. Each element consists of (STATE . FUNS)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
302 - STATE (described in `cvs-create-fileinfo') is the key
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
303 - FUNS is the list of applicable operations.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
304 The first one (if any) should be the \"default\" action.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
305 Most of the actions have the obvious meaning.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
306 `safe-rm' indicates that the file can be removed without losing
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
307 any information.")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
308
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 ;;;; Utility functions
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
311 ;;;;
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
312
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
313 (defun cvs-applicable-p (fi-or-type func)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
314 "Check if FUNC is applicable to FI-OR-TYPE.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
315 If FUNC is nil, always return t.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
316 FI-OR-TYPE can either be a symbol (a fileinfo-type) or a fileinfo."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
317 (let ((type (if (symbolp fi-or-type) fi-or-type
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
318 (cvs-fileinfo->type fi-or-type))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
319 (and (not (eq type 'MESSAGE))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
320 (eq (car (memq func (cdr (assq type cvs-states)))) func))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
321
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
322 (defun cvs-add-face (str face &optional keymap)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
323 (when cvs-highlight
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
324 (add-text-properties 0 (length str)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
325 (list* 'face face
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
326 (when keymap
29576
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
327 (list* 'mouse-face 'highlight
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
328 (when (keymapp keymap)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
329 (list 'keymap keymap)))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
330 str))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
331 str)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
332
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
333 (defun cvs-fileinfo-pp (fileinfo)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
334 "Pretty print FILEINFO. Insert a printed representation in current buffer.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
335 For use by the cookie package."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
336 (cvs-check-fileinfo fileinfo)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
337 (let ((type (cvs-fileinfo->type fileinfo))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
338 (subtype (cvs-fileinfo->subtype fileinfo)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
339 (insert
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
340 (case type
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
341 (DIRCHANGE (concat "In directory "
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
342 (cvs-add-face (cvs-fileinfo->full-path fileinfo)
29576
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
343 'cvs-header-face t)
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
344 ":"))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
345 (MESSAGE
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
346 (cvs-add-face (format "Message: %s" (cvs-fileinfo->full-log fileinfo))
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
347 'cvs-msg-face))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
348 (t
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
349 (let* ((status (if (cvs-fileinfo->marked fileinfo)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
350 (cvs-add-face "*" 'cvs-marked-face)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
351 " "))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
352 (file (cvs-add-face (cvs-fileinfo->pp-name fileinfo)
29576
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
353 'cvs-filename-face t))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
354 (base (or (cvs-fileinfo->base-rev fileinfo) ""))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
355 (head (cvs-fileinfo->head-rev fileinfo))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
356 (type
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
357 (let ((str (case type
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
358 ;;(MOD-CONFLICT "Not Removed")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
359 (DEAD "")
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
360 (t (capitalize (symbol-name type)))))
29576
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
361 (face (let ((sym (intern
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
362 (concat "cvs-fi-"
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
363 (downcase (symbol-name type))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
364 "-face"))))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
365 (or (and (boundp sym) (symbol-value sym))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
366 'cvs-need-action-face))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
367 (cvs-add-face str face cvs-status-map)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
368 (side (or
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
369 ;; maybe a subtype
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
370 (when subtype (downcase (symbol-name subtype)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
371 ;; or the head-rev
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
372 (when (and head (not (string= head base))) head)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
373 ;; or nothing
28256
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
374 "")))
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
375 (format "%-11s %s %-11s %-11s %s"
06cfa273543d * pcvs.el: Add a minimal leading commentary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28088
diff changeset
376 side status type base file)))))))
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
377
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
378
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
379 (defun cvs-fileinfo-update (fi fi-new)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
380 "Update FI with the information provided in FI-NEW."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
381 (let ((type (cvs-fileinfo->type fi-new))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
382 (merge (cvs-fileinfo->merge fi-new)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
383 (setf (cvs-fileinfo->type fi) type)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
384 (setf (cvs-fileinfo->subtype fi) (cvs-fileinfo->subtype fi-new))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
385 (setf (cvs-fileinfo->full-log fi) (cvs-fileinfo->full-log fi-new))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
386 (setf (cvs-fileinfo->base-rev fi) (cvs-fileinfo->base-rev fi-new))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
387 (setf (cvs-fileinfo->head-rev fi) (cvs-fileinfo->head-rev fi-new))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
388 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
389 (merge (setf (cvs-fileinfo->merge fi) merge))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
390 ((memq type '(UP-TO-DATE NEED-UPDATE))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
391 (setf (cvs-fileinfo->merge fi) nil)))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
392
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
393 (defun cvs-fileinfo< (a b)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
394 "Compare fileinfo A with fileinfo B and return t if A is `less'.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
395 The ordering defined by this function is such that directories are
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
396 sorted alphabetically, and inside every directory the DIRCHANGE
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
397 fileinfo will appear first, followed by all files (alphabetically)."
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
398 (let ((subtypea (cvs-fileinfo->subtype a))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
399 (subtypeb (cvs-fileinfo->subtype b)))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
400 (cond
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
401 ;; Sort according to directories.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
402 ((string< (cvs-fileinfo->dir a) (cvs-fileinfo->dir b)) t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
403 ((not (string= (cvs-fileinfo->dir a) (cvs-fileinfo->dir b))) nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
404
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
405 ;; The DIRCHANGE entry is always first within the directory.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
406 ((eq (cvs-fileinfo->type b) 'DIRCHANGE) nil)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
407 ((eq (cvs-fileinfo->type a) 'DIRCHANGE) t)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
408
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
409 ;; All files are sorted by file name.
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
410 ((string< (cvs-fileinfo->file a) (cvs-fileinfo->file b))))))
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
411
29576
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
412 ;;;
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
413 ;;; Look at CVS/Entries to quickly find a first approximation of the status
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
414 ;;;
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
415
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
416 (defun cvs-fileinfo-from-entries (dir &optional all)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
417 "List of fileinfos for DIR, extracted from CVS/Entries.
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
418 Unless ALL is optional, returns only the files that are not up-to-date.
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
419 DIR can also be a file."
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
420 (let* ((singlefile
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
421 (cond
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
422 ((equal dir "") nil)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
423 ((file-directory-p dir) (setq dir (file-name-as-directory dir)) nil)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
424 (t (prog1 (file-name-nondirectory dir)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
425 (setq dir (or (file-name-directory dir) ""))))))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
426 (file (expand-file-name "CVS/Entries" dir))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
427 (fis nil))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
428 (if (not (file-readable-p file))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
429 (push (cvs-create-fileinfo (if singlefile 'UNKNOWN 'DIRCHANGE)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
430 dir (or singlefile ".") "") fis)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
431 (with-temp-buffer
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
432 (insert-file-contents file)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
433 (goto-char (point-min))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
434 ;; Select the single file entry in case we're only interested in a file.
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
435 (cond
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
436 ((not singlefile)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
437 (push (cvs-create-fileinfo 'DIRCHANGE dir "." "") fis))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
438 ((re-search-forward
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
439 (concat "^[^/]*/" (regexp-quote singlefile) "/.*") nil t)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
440 (setq all t)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
441 (goto-char (match-beginning 0))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
442 (narrow-to-region (point) (match-end 0)))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
443 (t
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
444 (push (cvs-create-fileinfo 'UNKNOWN dir singlefile "") fis)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
445 (narrow-to-region (point-min) (point-min))))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
446 (while (looking-at "\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)/")
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
447 (if (/= (match-beginning 1) (match-end 1))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
448 (setq fis (append (cvs-fileinfo-from-entries
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
449 (concat dir (file-name-as-directory
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
450 (match-string 2)))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
451 all)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
452 fis))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
453 (let ((f (match-string 2))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
454 (rev (match-string 3))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
455 (date (match-string 4))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
456 timestamp
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
457 (type 'MODIFIED)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
458 (subtype nil))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
459 (cond
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
460 ((equal (substring rev 0 1) "-")
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
461 (setq type 'REMOVED rev (substring rev 1)))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
462 ((not (file-exists-p (concat dir f))) (setq type 'MISSING))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
463 ((equal rev "0") (setq type 'ADDED rev nil))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
464 ((equal date "Result of merge") (setq subtype 'MERGED))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
465 ((let ((mtime (nth 5 (file-attributes (concat dir f))))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
466 (system-time-locale "C"))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
467 (equal (setq timestamp (format-time-string "%c" mtime 'utc))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
468 date))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
469 (setq type (if all 'UP-TO-DATE)))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
470 ((equal date (concat "Result of merge+" timestamp))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
471 (setq type 'CONFLICT)))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
472 (when type
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
473 (push (cvs-create-fileinfo type dir f ""
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
474 :base-rev rev :subtype subtype)
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
475 fis))))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
476 (forward-line 1))))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
477 fis))
961f303cda37 (cvs-fi-up-to-date-face, cvs-fi-unknown-face): New vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28256
diff changeset
478
28088
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
479 (provide 'pcvs-info)
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
480
b442dfc3cef0 *** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
481 ;;; pcl-cvs-info.el ends here