Mercurial > emacs
comparison lisp/vc-arch.el @ 54415:504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Take sealed revisions into account.
(vc-arch-checkin): Extract a summary line from the message.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 18 Mar 2004 02:48:06 +0000 |
parents | a9f1e9611612 |
children | 2ae29225b85c |
comparison
equal
deleted
inserted
replaced
54414:c9a4b36c9ee0 | 54415:504aef04e493 |
---|---|
38 ;; - C-x v = without any prefix arg | 38 ;; - C-x v = without any prefix arg |
39 ;; - C-x v v to commit a change to a single file | 39 ;; - C-x v v to commit a change to a single file |
40 | 40 |
41 ;; Bugs: | 41 ;; Bugs: |
42 | 42 |
43 ;; - Opening a new file prompts "blabla was lost; check out? (yes or no)". | |
44 ;; - *VC-log*'s initial content lacks the `Summary:' lines. | |
43 ;; - All files under the tree are considered as "under Arch's control" | 45 ;; - All files under the tree are considered as "under Arch's control" |
44 ;; without regards to =tagging-method and such. | 46 ;; without regards to =tagging-method and such. |
45 ;; - Files are always considered as `edited'. | 47 ;; - Files are always considered as `edited'. |
48 ;; - C-x v l does not work. | |
46 ;; - C-x v i does not work. | 49 ;; - C-x v i does not work. |
50 ;; - C-x v ~ does not work. | |
51 ;; - C-x v u does not work. | |
52 ;; - C-x v s does not work. | |
53 ;; - C-x v r does not work. | |
47 ;; - VC-dired does not work. | 54 ;; - VC-dired does not work. |
48 ;; - And more... | 55 ;; - And more... |
49 | 56 |
50 ;;; Code: | 57 ;;; Code: |
51 | 58 |
139 (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*\\)--.*\\)--.*\\)\\'" defbranch)) | 146 (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*\\)--.*\\)--.*\\)\\'" defbranch)) |
140 (let* ((archive (match-string 1 defbranch)) | 147 (let* ((archive (match-string 1 defbranch)) |
141 (category (match-string 4 defbranch)) | 148 (category (match-string 4 defbranch)) |
142 (branch (match-string 3 defbranch)) | 149 (branch (match-string 3 defbranch)) |
143 (version (match-string 2 defbranch)) | 150 (version (match-string 2 defbranch)) |
144 (rev-nb 0) | 151 (sealed nil) (rev-nb 0) |
145 (rev nil) | 152 (rev nil) |
146 logdir tmp) | 153 logdir tmp) |
147 (setq logdir (expand-file-name category root)) | 154 (setq logdir (expand-file-name category root)) |
148 (setq logdir (expand-file-name branch logdir)) | 155 (setq logdir (expand-file-name branch logdir)) |
149 (setq logdir (expand-file-name version logdir)) | 156 (setq logdir (expand-file-name version logdir)) |
150 (setq logdir (expand-file-name archive logdir)) | 157 (setq logdir (expand-file-name archive logdir)) |
151 (setq logdir (expand-file-name "patch-log" logdir)) | 158 (setq logdir (expand-file-name "patch-log" logdir)) |
159 ;; Revision names go: base-0, patch-N, version-0, versionfix-N. | |
152 (dolist (file (directory-files logdir)) | 160 (dolist (file (directory-files logdir)) |
161 (when (and (eq (aref file 0) ?v) (not sealed)) | |
162 (setq sealed t rev-nb 0)) | |
153 (if (and (string-match "-\\([0-9]+\\)\\'" file) | 163 (if (and (string-match "-\\([0-9]+\\)\\'" file) |
154 (setq tmp (string-to-number (match-string 1 file))) | 164 (setq tmp (string-to-number (match-string 1 file))) |
165 (or (not sealed) (eq (aref file 0) ?v)) | |
155 (>= tmp rev-nb)) | 166 (>= tmp rev-nb)) |
156 (setq rev-nb tmp rev file))) | 167 (setq rev-nb tmp rev file))) |
157 (concat defbranch "--" rev))))) | 168 (concat defbranch "--" rev))))) |
158 | 169 |
159 | 170 |
160 (defcustom vc-arch-mode-line-rewrite | 171 (defcustom vc-arch-mode-line-rewrite |
161 '(("\\`.*--\\(.*--.*\\)--.*-\\([0-9]+\\)\\'" . "\\2[\\1]")) | 172 '(("\\`.*--\\(.*--.*\\)--\\(v?\\).*-\\([0-9]+\\)\\'" . "\\2\\3[\\1]")) |
162 "Rewrite rules to shorten Arch's revision names on the mode-line." | 173 "Rewrite rules to shorten Arch's revision names on the mode-line." |
163 :type '(repeat (cons regexp string))) | 174 :type '(repeat (cons regexp string))) |
164 | 175 |
165 (defun vc-arch-mode-line-string (file) | 176 (defun vc-arch-mode-line-string (file) |
166 "Return string for placement in modeline by `vc-mode-line' for FILE." | 177 "Return string for placement in modeline by `vc-mode-line' for FILE." |
207 | 218 |
208 (defun vc-arch-checkout-model (file) 'implicit) | 219 (defun vc-arch-checkout-model (file) 'implicit) |
209 | 220 |
210 (defun vc-arch-checkin (file rev comment) | 221 (defun vc-arch-checkin (file rev comment) |
211 (if rev (error "Committing to a specific revision is unsupported.")) | 222 (if rev (error "Committing to a specific revision is unsupported.")) |
212 (vc-arch-command nil 0 file "commit" "-L" comment "--" | 223 (let ((summary (file-relative-name file (vc-arch-root file)))) |
213 (vc-switches 'Arch 'checkin))) | 224 ;; Extract a summary from the comment. |
225 (when (or (string-match "\\`Summary:[ \t]*\\(.*[^ \t\n]\\)\\([ \t]*\n\\)*" comment) | |
226 (string-match "\\`[ \t]*\\(.*[^ \t\n]\\)[ \t]*\\(\n?\\'\\|\n\\([ \t]*\n\\)+\\)" comment)) | |
227 (setq summary (match-string 1 comment)) | |
228 (setq comment (substring comment (match-end 0)))) | |
229 (vc-arch-command nil 0 file "commit" "-s" summary "-L" comment "--" | |
230 (vc-switches 'Arch 'checkin)))) | |
214 | 231 |
215 (defun vc-arch-diff (file &optional oldvers newvers) | 232 (defun vc-arch-diff (file &optional oldvers newvers) |
216 "Get a difference report using Arch between two versions of FILE." | 233 "Get a difference report using Arch between two versions of FILE." |
217 (if newvers | 234 (if newvers |
218 (error "Diffing specific revisions not implemented.") | 235 (error "Diffing specific revisions not implemented.") |