Mercurial > emacs
annotate lisp/vc-arch.el @ 87032:9ff81ab8950c
(password-read, password-cache-add, password-cache-remove):
No need to autoload, since mml-sec requires password.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 04 Dec 2007 04:05:45 +0000 |
parents | 613df1ba1584 |
children | 21fcd219fd6e 880960b70474 |
rev | line source |
---|---|
54396 | 1 ;;; vc-arch.el --- VC backend for the Arch version-control system |
2 | |
75347 | 3 ;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
54396 | 4 |
5 ;; Author: FSF (see vc.el for full credits) | |
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org> | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76769
diff
changeset
|
12 ;; the Free Software Foundation; either version 3, or (at your option) |
54396 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64091 | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02110-1301, USA. | |
54396 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; The home page of the Arch version control system is at | |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
28 ;; |
54396 | 29 ;; http://www.gnuarch.org/ |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
30 ;; |
54396 | 31 ;; This is derived from vc-mcvs.el as follows: |
32 ;; - cp vc-mcvs.el vc-arch.el and then M-% mcvs RET arch RET | |
33 ;; | |
34 ;; Then of course started the hacking. | |
35 ;; | |
36 ;; What has been partly tested: | |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
37 ;; - Open a file. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
38 ;; - C-x v = without any prefix arg. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
39 ;; - C-x v v to commit a change to a single file. |
54396 | 40 |
41 ;; Bugs: | |
42 | |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
43 ;; - *VC-log*'s initial content lacks the `Summary:' lines. |
54396 | 44 ;; - All files under the tree are considered as "under Arch's control" |
45 ;; without regards to =tagging-method and such. | |
46 ;; - Files are always considered as `edited'. | |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
47 ;; - C-x v l does not work. |
54396 | 48 ;; - C-x v i does not work. |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
49 ;; - C-x v ~ does not work. |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
50 ;; - C-x v u does not work. |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
51 ;; - C-x v s does not work. |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
52 ;; - C-x v r does not work. |
54396 | 53 ;; - VC-dired does not work. |
54 ;; - And more... | |
55 | |
56 ;;; Code: | |
57 | |
54532
87ca639a4eca
Require CL for `case'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54531
diff
changeset
|
58 (eval-when-compile (require 'vc) (require 'cl)) |
54396 | 59 |
60 ;;; | |
61 ;;; Customization options | |
62 ;;; | |
63 | |
64 (defvar vc-arch-command | |
81379
fa58a242b75e
(vc-arch-command): Remove bzr. It's a different program.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81326
diff
changeset
|
65 (let ((candidates '("tla" "baz"))) |
54396 | 66 (while (and candidates (not (executable-find (car candidates)))) |
67 (setq candidates (cdr candidates))) | |
68 (or (car candidates) "tla"))) | |
69 | |
70 ;; Clear up the cache to force vc-call to check again and discover | |
71 ;; new functions when we reload this file. | |
72 (put 'Arch 'vc-functions nil) | |
73 | |
74 ;;;###autoload (defun vc-arch-registered (file) | |
57094
7883de80034e
(vc-arch-root, vc-arch-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57026
diff
changeset
|
75 ;;;###autoload (if (vc-find-root file "{arch}/=tagging-method") |
7883de80034e
(vc-arch-root, vc-arch-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57026
diff
changeset
|
76 ;;;###autoload (progn |
7883de80034e
(vc-arch-root, vc-arch-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57026
diff
changeset
|
77 ;;;###autoload (load "vc-arch") |
7883de80034e
(vc-arch-root, vc-arch-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57026
diff
changeset
|
78 ;;;###autoload (vc-arch-registered file)))) |
54396 | 79 |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
80 (defun vc-arch-add-tagline () |
54396 | 81 "Add an `arch-tag' to the end of the current file." |
82 (interactive) | |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
83 (comment-normalize-vars) |
54396 | 84 (goto-char (point-max)) |
85 (forward-comment -1) | |
81620
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
86 (skip-chars-forward " \t\n") |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
87 (cond |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
88 ((not (bolp)) (insert "\n\n")) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
89 ((not (eq ?\n (char-before (1- (point))))) (insert "\n"))) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
90 (let ((beg (point)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
91 (idfile (and buffer-file-name |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
92 (expand-file-name |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
93 (concat ".arch-ids/" |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
94 (file-name-nondirectory buffer-file-name) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
95 ".id") |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
96 (file-name-directory buffer-file-name))))) |
54396 | 97 (insert "arch-tag: ") |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
98 (if (and idfile (file-exists-p idfile)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
99 ;; If the file is unreadable, we do want to get an error here. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
100 (progn |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
101 (insert-file-contents idfile) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
102 (forward-line 1) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
103 (delete-file idfile)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
104 (condition-case nil |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
105 (call-process "uuidgen" nil t) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
106 (file-error (insert (format "%s <%s> %s" |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
107 (current-time-string) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
108 user-mail-address |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
109 (+ (nth 2 (current-time)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
110 (buffer-size))))))) |
54396 | 111 (comment-region beg (point)))) |
112 | |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
113 (defconst vc-arch-tagline-re "^\\W*arch-tag:[ \t]*\\(.*[^ \t\n]\\)") |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
114 |
76769
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
115 (defmacro vc-with-current-file-buffer (file &rest body) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
116 (declare (indent 2) (debug t)) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
117 `(let ((-kill-buf- nil) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
118 (-file- ,file)) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
119 (with-current-buffer (or (find-buffer-visiting -file-) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
120 (setq -kill-buf- (generate-new-buffer " temp"))) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
121 ;; Avoid find-file-literally since it can do many undesirable extra |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
122 ;; things (among which, call us back into an infinite loop). |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
123 (if -kill-buf- (insert-file-contents -file-)) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
124 (unwind-protect |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
125 (progn ,@body) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
126 (if (buffer-live-p -kill-buf-) (kill-buffer -kill-buf-)))))) |
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
127 |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
128 (defun vc-arch-file-source-p (file) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
129 "Can return nil, `maybe' or a non-nil value. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
130 Only the value `maybe' can be trusted :-(." |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
131 ;; FIXME: Check the tag and name of parent dirs. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
132 (unless (string-match "\\`[,+]" (file-name-nondirectory file)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
133 (or (string-match "\\`{arch}/" |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
134 (file-relative-name file (vc-arch-root file))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
135 (file-exists-p |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
136 ;; Check the presence of an ID file. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
137 (expand-file-name |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
138 (concat ".arch-ids/" (file-name-nondirectory file) ".id") |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
139 (file-name-directory file))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
140 ;; Check the presence of a tagline. |
76769
3693d2ee35b8
(vc-with-current-file-buffer): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75469
diff
changeset
|
141 (vc-with-current-file-buffer file |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
142 (save-excursion |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
143 (goto-char (point-max)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
144 (or (re-search-backward vc-arch-tagline-re (- (point) 1000) t) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
145 (progn |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
146 (goto-char (point-min)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
147 (re-search-forward vc-arch-tagline-re (+ (point) 1000) t))))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
148 ;; FIXME: check =tagging-method to see whether untagged files might |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
149 ;; be source or not. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
150 (with-current-buffer |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
151 (find-file-noselect (expand-file-name "{arch}/=tagging-method" |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
152 (vc-arch-root file))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
153 (let ((untagged-source t)) ;Default is `names'. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
154 (save-excursion |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
155 (goto-char (point-min)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
156 (if (re-search-forward "^[ \t]*\\(\\(tagline\\|implicit\\|names\\)\\|explicit\\)" nil t) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
157 (setq untagged-source (match-end 2))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
158 (if (re-search-forward "^[ \t]*untagged-source[ \t]+\\(\\(source\\)\\|precious\\|backup\\|junk\\|unrecognized\\)" nil t) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
159 (setq untagged-source (match-end 2)))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
160 (if untagged-source 'maybe)))))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
161 |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
162 (defun vc-arch-file-id (file) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
163 ;; Don't include the kind of ID this is because it seems to be too messy. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
164 (let ((idfile (expand-file-name |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
165 (concat ".arch-ids/" (file-name-nondirectory file) ".id") |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
166 (file-name-directory file)))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
167 (if (file-exists-p idfile) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
168 (with-temp-buffer |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
169 (insert-file-contents idfile) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
170 (looking-at ".*[^ \n\t]") |
75469
d2adef0ec2f0
(vc-arch-file-id): Move with-current-buffer inside the if.
Richard M. Stallman <rms@gnu.org>
parents:
75347
diff
changeset
|
171 (match-string 0)) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
172 (with-current-buffer (find-file-noselect file) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
173 (save-excursion |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
174 (goto-char (point-max)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
175 (if (or (re-search-backward vc-arch-tagline-re (- (point) 1000) t) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
176 (progn |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
177 (goto-char (point-min)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
178 (re-search-forward vc-arch-tagline-re (+ (point) 1000) t))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
179 (match-string 1) |
75469
d2adef0ec2f0
(vc-arch-file-id): Move with-current-buffer inside the if.
Richard M. Stallman <rms@gnu.org>
parents:
75347
diff
changeset
|
180 (concat "./" (file-relative-name file (vc-arch-root file))))))))) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
181 |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
182 (defun vc-arch-tagging-method (file) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
183 (with-current-buffer |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
184 (find-file-noselect |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
185 (expand-file-name "{arch}/=tagging-method" (vc-arch-root file))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
186 (save-excursion |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
187 (goto-char (point-min)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
188 (if (re-search-forward |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
189 "^[ \t]*\\(tagline\\|implicit\\|names\\|explicit\\)" nil t) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
190 (intern (match-string 1)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
191 'names)))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
192 |
54396 | 193 (defun vc-arch-root (file) |
194 "Return the root directory of a Arch project, if any." | |
195 (or (vc-file-getprop file 'arch-root) | |
63423
8269aa11cce4
(vc-arch-checkin, vc-arch-diff): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents:
59444
diff
changeset
|
196 (vc-file-setprop |
57094
7883de80034e
(vc-arch-root, vc-arch-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57026
diff
changeset
|
197 ;; Check the =tagging-method, in case someone naively manually |
7883de80034e
(vc-arch-root, vc-arch-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57026
diff
changeset
|
198 ;; creates a {arch} directory somewhere. |
7883de80034e
(vc-arch-root, vc-arch-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57026
diff
changeset
|
199 file 'arch-root (vc-find-root file "{arch}/=tagging-method")))) |
54396 | 200 |
81960
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
201 (defun vc-arch-register (files &optional rev comment) |
54806
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
202 (if rev (error "Explicit initial revision not supported for Arch")) |
81960
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
203 (dolist (file files) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
204 (let ((tagmet (vc-arch-tagging-method file))) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
205 (if (and (memq tagmet '(tagline implicit)) comment-start) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
206 (with-current-buffer (find-file-noselect file) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
207 (if (buffer-modified-p) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
208 (error "Save %s first" (buffer-name))) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
209 (vc-arch-add-tagline) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
210 (save-buffer))))) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
211 (vc-arch-command nil 0 files "add")) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
212 |
54396 | 213 (defun vc-arch-registered (file) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
214 ;; Don't seriously check whether it's source or not. Checking would |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
215 ;; require running TLA, so it's better to not do it, so it also works if |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
216 ;; TLA is not installed. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
217 (and (vc-arch-root file) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
218 (vc-arch-file-source-p file))) |
54396 | 219 |
220 (defun vc-arch-default-version (file) | |
221 (or (vc-file-getprop (vc-arch-root file) 'arch-default-version) | |
222 (let* ((root (vc-arch-root file)) | |
223 (f (expand-file-name "{arch}/++default-version" root))) | |
224 (if (file-readable-p f) | |
225 (vc-file-setprop | |
226 root 'arch-default-version | |
227 (with-temp-buffer | |
228 (insert-file-contents f) | |
229 ;; Strip the terminating newline. | |
230 (buffer-substring (point-min) (1- (point-max))))))))) | |
231 | |
54409
a9f1e9611612
(vc-arch-workfile-unchanged-p): Define to avoid dup-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54396
diff
changeset
|
232 (defun vc-arch-workfile-unchanged-p (file) |
a9f1e9611612
(vc-arch-workfile-unchanged-p): Define to avoid dup-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54396
diff
changeset
|
233 "Check if FILE is unchanged by diffing against the master version. |
a9f1e9611612
(vc-arch-workfile-unchanged-p): Define to avoid dup-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54396
diff
changeset
|
234 Return non-nil if FILE is unchanged." |
a9f1e9611612
(vc-arch-workfile-unchanged-p): Define to avoid dup-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54396
diff
changeset
|
235 nil) |
a9f1e9611612
(vc-arch-workfile-unchanged-p): Define to avoid dup-diff.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54396
diff
changeset
|
236 |
54396 | 237 (defun vc-arch-state (file) |
238 ;; There's no checkout operation and merging is not done from VC | |
239 ;; so the only operation that's state dependent that VC supports is commit | |
240 ;; which is only activated if the file is `edited'. | |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
241 (let* ((root (vc-arch-root file)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
242 (ver (vc-arch-default-version file)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
243 (pat (concat "\\`" (subst-char-in-string ?/ ?% ver))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
244 (dir (expand-file-name ",,inode-sigs/" |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
245 (expand-file-name "{arch}" root))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
246 (sigfile nil)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
247 (dolist (f (if (file-directory-p dir) (directory-files dir t pat))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
248 (if (or (not sigfile) (file-newer-than-file-p f sigfile)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
249 (setq sigfile f))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
250 (if (not sigfile) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
251 'edited ;We know nothing. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
252 (let ((id (vc-arch-file-id file))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
253 (setq id (replace-regexp-in-string "[ \t]" "_" id)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
254 (with-current-buffer (find-file-noselect sigfile) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
255 (goto-char (point-min)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
256 (while (and (search-forward id nil 'move) |
57026
992d9837a265
(vc-arch-state): Fix parsing for `names' method.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56954
diff
changeset
|
257 (save-excursion |
992d9837a265
(vc-arch-state): Fix parsing for `names' method.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56954
diff
changeset
|
258 (goto-char (- (match-beginning 0) 2)) |
992d9837a265
(vc-arch-state): Fix parsing for `names' method.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56954
diff
changeset
|
259 ;; For `names', the lines start with `?./foo/bar'. |
992d9837a265
(vc-arch-state): Fix parsing for `names' method.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56954
diff
changeset
|
260 ;; For others there's 2 chars before the ./foo/bar. |
992d9837a265
(vc-arch-state): Fix parsing for `names' method.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56954
diff
changeset
|
261 (or (not (or (bolp) (looking-at "\n?"))) |
992d9837a265
(vc-arch-state): Fix parsing for `names' method.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56954
diff
changeset
|
262 ;; Ignore E_ entries used for foo.id files. |
992d9837a265
(vc-arch-state): Fix parsing for `names' method.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56954
diff
changeset
|
263 (looking-at "E_"))))) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
264 (if (eobp) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
265 ;; ID not found. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
266 (if (equal (file-name-nondirectory sigfile) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
267 (subst-char-in-string |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84374
diff
changeset
|
268 ?/ ?% (vc-arch-working-revision file))) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
269 'added |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
270 ;; Might be `added' or `up-to-date' as well. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
271 ;; FIXME: Check in the patch logs to find out. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
272 'edited) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
273 ;; Found the ID, let's check the inode. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
274 (if (not (re-search-forward |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
275 "\t.*mtime=\\([0-9]+\\):size=\\([0-9]+\\)" |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
276 (line-end-position) t)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
277 ;; Buh? Unexpected format. |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
278 'edited |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
279 (let ((ats (file-attributes file))) |
55873
304d478aa594
(vc-arch-state): Don't assume the file exists.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55814
diff
changeset
|
280 (if (and (eq (nth 7 ats) (string-to-number (match-string 2))) |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
281 (equal (format-time-string "%s" (nth 5 ats)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
282 (match-string 1))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
283 'up-to-date |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
284 'edited))))))))) |
54806
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
285 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84374
diff
changeset
|
286 (defun vc-arch-working-revision (file) |
54396 | 287 (let* ((root (expand-file-name "{arch}" (vc-arch-root file))) |
288 (defbranch (vc-arch-default-version file))) | |
59313
ad91f130fbdf
(vc-arch-workfile-version): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59312
diff
changeset
|
289 (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch)) |
54396 | 290 (let* ((archive (match-string 1 defbranch)) |
291 (category (match-string 4 defbranch)) | |
292 (branch (match-string 3 defbranch)) | |
293 (version (match-string 2 defbranch)) | |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
294 (sealed nil) (rev-nb 0) |
54396 | 295 (rev nil) |
296 logdir tmp) | |
297 (setq logdir (expand-file-name category root)) | |
298 (setq logdir (expand-file-name branch logdir)) | |
299 (setq logdir (expand-file-name version logdir)) | |
300 (setq logdir (expand-file-name archive logdir)) | |
301 (setq logdir (expand-file-name "patch-log" logdir)) | |
57566
d50f313f6fdd
(vc-arch-workfile-version): Don't burp if the patch-log directory is missing.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57094
diff
changeset
|
302 (dolist (file (if (file-directory-p logdir) (directory-files logdir))) |
d50f313f6fdd
(vc-arch-workfile-version): Don't burp if the patch-log directory is missing.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57094
diff
changeset
|
303 ;; Revision names go: base-0, patch-N, version-0, versionfix-M. |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
304 (when (and (eq (aref file 0) ?v) (not sealed)) |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
305 (setq sealed t rev-nb 0)) |
54396 | 306 (if (and (string-match "-\\([0-9]+\\)\\'" file) |
307 (setq tmp (string-to-number (match-string 1 file))) | |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
308 (or (not sealed) (eq (aref file 0) ?v)) |
54396 | 309 (>= tmp rev-nb)) |
310 (setq rev-nb tmp rev file))) | |
56954
242cddb00aef
(vc-arch-workfile-version): Handle the special case before the first commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56283
diff
changeset
|
311 ;; Use "none-000" if the tree hasn't yet been committed on the |
242cddb00aef
(vc-arch-workfile-version): Handle the special case before the first commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56283
diff
changeset
|
312 ;; default branch. We'll then get "Arch:000[branch]" on the mode-line. |
242cddb00aef
(vc-arch-workfile-version): Handle the special case before the first commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56283
diff
changeset
|
313 (concat defbranch "--" (or rev "none-000")))))) |
54396 | 314 |
315 | |
316 (defcustom vc-arch-mode-line-rewrite | |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
317 '(("\\`.*--\\(.*--.*\\)--\\(v?\\).*-\\([0-9]+\\)\\'" . "\\2\\3[\\1]")) |
54396 | 318 "Rewrite rules to shorten Arch's revision names on the mode-line." |
56283
9d529d2aac14
(vc-arch-mode-line-rewrite): Add :group 'vc.
Kim F. Storm <storm@cua.dk>
parents:
55873
diff
changeset
|
319 :type '(repeat (cons regexp string)) |
9d529d2aac14
(vc-arch-mode-line-rewrite): Add :group 'vc.
Kim F. Storm <storm@cua.dk>
parents:
55873
diff
changeset
|
320 :group 'vc) |
54396 | 321 |
322 (defun vc-arch-mode-line-string (file) | |
323 "Return string for placement in modeline by `vc-mode-line' for FILE." | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84374
diff
changeset
|
324 (let ((rev (vc-working-revision file))) |
54396 | 325 (dolist (rule vc-arch-mode-line-rewrite) |
326 (if (string-match (car rule) rev) | |
327 (setq rev (replace-match (cdr rule) t nil rev)))) | |
328 (format "Arch%c%s" | |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
329 (case (vc-state file) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
330 ((up-to-date needs-patch) ?-) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
331 (added ?@) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
332 (t ?:)) |
54396 | 333 rev))) |
334 | |
335 (defun vc-arch-diff3-rej-p (rej) | |
54531
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
336 (let ((attrs (file-attributes rej))) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
337 (and attrs (< (nth 7 attrs) 60) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
338 (with-temp-buffer |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
339 (insert-file-contents rej) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
340 (goto-char (point-min)) |
2ae29225b85c
(vc-arch-diff): Handle the special case where `newvers' is equivalent to nil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54415
diff
changeset
|
341 (looking-at "Conflicts occured, diff3 conflict markers left in file\\."))))) |
54396 | 342 |
343 (defun vc-arch-delete-rej-if-obsolete () | |
54806
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
344 "For use in `after-save-hook'." |
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
345 (save-excursion |
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
346 (let ((rej (concat buffer-file-name ".rej"))) |
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
347 (when (and buffer-file-name (vc-arch-diff3-rej-p rej)) |
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
348 (if (not (re-search-forward "^<<<<<<< " nil t)) |
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
349 ;; The .rej file is obsolete. |
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
350 (condition-case nil (delete-file rej) (error nil))))))) |
54396 | 351 |
352 (defun vc-arch-find-file-hook () | |
353 (let ((rej (concat buffer-file-name ".rej"))) | |
354 (when (and buffer-file-name (file-exists-p rej)) | |
355 (if (vc-arch-diff3-rej-p rej) | |
356 (save-excursion | |
357 (goto-char (point-min)) | |
54806
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
358 (if (not (re-search-forward "^<<<<<<< " nil t)) |
54396 | 359 ;; The .rej file is obsolete. |
360 (condition-case nil (delete-file rej) (error nil)) | |
361 (smerge-mode 1) | |
54806
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
362 (add-hook 'after-save-hook |
54396 | 363 'vc-arch-delete-rej-if-obsolete nil t) |
364 (message "There are unresolved conflicts in this file"))) | |
365 (message "There are unresolved conflicts in %s" | |
366 (file-name-nondirectory rej)))))) | |
367 | |
368 (defun vc-arch-checkout-model (file) 'implicit) | |
369 | |
81960
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
370 (defun vc-arch-checkin (files rev comment) |
63423
8269aa11cce4
(vc-arch-checkin, vc-arch-diff): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents:
59444
diff
changeset
|
371 (if rev (error "Committing to a specific revision is unsupported")) |
81960
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
372 ;; FIXME: This implementation probably only works for singleton filesets |
84374
1224dec49333
(vc-arch-checkin): Fix typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82502
diff
changeset
|
373 (let ((summary (file-relative-name (car files) (vc-arch-root (car files))))) |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
374 ;; Extract a summary from the comment. |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
375 (when (or (string-match "\\`Summary:[ \t]*\\(.*[^ \t\n]\\)\\([ \t]*\n\\)*" comment) |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
376 (string-match "\\`[ \t]*\\(.*[^ \t\n]\\)[ \t]*\\(\n?\\'\\|\n\\([ \t]*\n\\)+\\)" comment)) |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
377 (setq summary (match-string 1 comment)) |
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
378 (setq comment (substring comment (match-end 0)))) |
81960
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
379 (vc-arch-command nil 0 files "commit" "-s" summary "-L" comment "--" |
54415
504aef04e493
(vc-arch-workfile-version, vc-arch-mode-line-rewrite):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54409
diff
changeset
|
380 (vc-switches 'Arch 'checkin)))) |
54396 | 381 |
81960
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
382 (defun vc-arch-diff (files &optional oldvers newvers buffer) |
5a8f965c55ba
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81804
diff
changeset
|
383 "Get a difference report using Arch between two versions of FILES." |
82000
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
384 ;; FIXME: This implementation only works for singleton filesets. To make |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
385 ;; it work for more cases, we have to either call `file-diffs' manually on |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
386 ;; each and every `file' in the fileset, or use `changes --diffs' (and |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
387 ;; variants) and maybe filter the output with `filterdiff' to only include |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
388 ;; the files in which we're interested. |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
389 (let ((file (car files))) |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
390 (if (and newvers |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
391 (vc-up-to-date-p file) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84374
diff
changeset
|
392 (equal newvers (vc-working-revision file))) |
82000
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
393 ;; Newvers is the base revision and the current file is unchanged, |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
394 ;; so we can diff with the current file. |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
395 (setq newvers nil)) |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
396 (if newvers |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
397 (error "Diffing specific revisions not implemented") |
86002
613df1ba1584
* vc.el (vc-diff-internal): Make the *vc-diff* buffer read only.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85457
diff
changeset
|
398 (let* ((async (not vc-disable-async-diff)) |
82000
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
399 ;; Run the command from the root dir. |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
400 (default-directory (vc-arch-root file)) |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
401 (status |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
402 (vc-arch-command |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
403 (or buffer "*vc-diff*") |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
404 (if async 'async 1) |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
405 nil "file-diffs" |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
406 ;; Arch does not support the typical flags. |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
407 ;; (vc-switches 'Arch 'diff) |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
408 (file-relative-name file) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84374
diff
changeset
|
409 (if (equal oldvers (vc-working-revision file)) |
82000
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
410 nil |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
411 oldvers)))) |
066eaef90bfb
(vc-arch-diff): Fix last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81960
diff
changeset
|
412 (if async 1 status))))) ; async diff, pessimistic assumption. |
54396 | 413 |
414 (defun vc-arch-delete-file (file) | |
415 (vc-arch-command nil 0 file "rm")) | |
416 | |
417 (defun vc-arch-rename-file (old new) | |
418 (vc-arch-command nil 0 new "mv" (file-relative-name old))) | |
419 | |
54806
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
420 (defalias 'vc-arch-responsible-p 'vc-arch-root) |
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
421 |
54396 | 422 (defun vc-arch-command (buffer okstatus file &rest flags) |
423 "A wrapper around `vc-do-command' for use in vc-arch.el." | |
424 (apply 'vc-do-command buffer okstatus vc-arch-command file flags)) | |
425 | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84374
diff
changeset
|
426 (defun vc-arch-init-revision () nil) |
54806
e16241d08bbc
(vc-arch-root): Be a bit more careful.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54532
diff
changeset
|
427 |
81620
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
428 ;;; Completion of versions and revisions. |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
429 |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
430 (defun vc-arch--version-completion-table (root string) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
431 (delq nil |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
432 (mapcar |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
433 (lambda (d) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
434 (when (string-match "/\\([^/]+\\)/\\([^/]+\\)\\'" d) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
435 (concat (match-string 2 d) "/" (match-string 1 d)))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
436 (let ((default-directory root)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
437 (file-expand-wildcards |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
438 (concat "*/*/" |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
439 (if (string-match "/" string) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
440 (concat (substring string (match-end 0)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
441 "*/" (substring string 0 (match-beginning 0))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
442 (concat "*/" string)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
443 "*")))))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
444 |
85457
e58eb1e72d23
(vc-arch-revision-completion-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85139
diff
changeset
|
445 (defun vc-arch-revision-completion-table (files) |
e58eb1e72d23
(vc-arch-revision-completion-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85139
diff
changeset
|
446 (lexical-let ((files files)) |
81620
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
447 (lambda (string pred action) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
448 ;; FIXME: complete revision patches as well. |
85457
e58eb1e72d23
(vc-arch-revision-completion-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85139
diff
changeset
|
449 (let* ((root (expand-file-name "{arch}" (vc-arch-root (car files)))) |
81804
0e6cd7deb746
(vc-arch-complete): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81620
diff
changeset
|
450 (table (vc-arch--version-completion-table root string))) |
0e6cd7deb746
(vc-arch-complete): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81620
diff
changeset
|
451 (complete-with-action action table string pred))))) |
81620
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
452 |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
453 ;;; Trimming revision libraries. |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
454 |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
455 ;; This code is not directly related to VC and there are many variants of |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
456 ;; this functionality available as scripts, but I like this version better, |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
457 ;; so maybe others will like it too. |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
458 |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
459 (defun vc-arch-trim-find-least-useful-rev (revs) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
460 (let* ((first (pop revs)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
461 (second (pop revs)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
462 (third (pop revs)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
463 ;; We try to give more importance to recent revisions. The idea is |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
464 ;; that it's OK if checking out a revision 1000-patch-old is ten |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
465 ;; times slower than checking out a revision 100-patch-old. But at |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
466 ;; the same time a 2-patch-old rev isn't really ten times more |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
467 ;; important than a 20-patch-old, so we use an arbitrary constant |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
468 ;; "100" to reduce this effect for recent revisions. Making this |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
469 ;; constant a float has the side effect of causing the subsequent |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
470 ;; computations to be done as floats as well. |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
471 (max (+ 100.0 (car (or (car (last revs)) third)))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
472 (cost (lambda () (/ (- (car third) (car first)) (- max (car second))))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
473 (minrev second) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
474 (mincost (funcall cost))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
475 (while revs |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
476 (setq first second) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
477 (setq second third) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
478 (setq third (pop revs)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
479 (when (< (funcall cost) mincost) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
480 (setq minrev second) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
481 (setq mincost (funcall cost)))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
482 minrev)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
483 |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
484 (defun vc-arch-trim-make-sentinel (revs) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
485 (if (null revs) (lambda (proc msg) (message "VC-Arch trimming ... done")) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
486 `(lambda (proc msg) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
487 (message "VC-Arch trimming %s..." ',(file-name-nondirectory (car revs))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
488 (rename-file ,(car revs) ,(concat (car revs) "*rm*")) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
489 (setq proc (start-process "vc-arch-trim" nil |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
490 "rm" "-rf" ',(concat (car revs) "*rm*"))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
491 (set-process-sentinel proc (vc-arch-trim-make-sentinel ',(cdr revs)))))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
492 |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
493 (defun vc-arch-trim-one-revlib (dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
494 "Delete half of the revisions in the revision library." |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
495 (interactive "Ddirectory: ") |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
496 (let ((revs |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
497 (sort (delq nil |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
498 (mapcar |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
499 (lambda (f) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
500 (when (string-match "-\\([0-9]+\\)\\'" f) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
501 (cons (string-to-number (match-string 1 f)) f))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
502 (directory-files dir nil nil 'nosort))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
503 'car-less-than-car)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
504 (subdirs nil)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
505 (when (cddr revs) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
506 (dotimes (i (/ (length revs) 2)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
507 (let ((minrev (vc-arch-trim-find-least-useful-rev revs))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
508 (setq revs (delq minrev revs)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
509 (push minrev subdirs))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
510 (funcall (vc-arch-trim-make-sentinel |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
511 (mapcar (lambda (x) (expand-file-name (cdr x) dir)) subdirs)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
512 nil nil)))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
513 |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
514 (defun vc-arch-trim-revlib () |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
515 "Delete half of the revisions in the revision library." |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
516 (interactive) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
517 (let ((rl-dir (with-output-to-string |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
518 (call-process vc-arch-command nil standard-output nil |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
519 "my-revision-library")))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
520 (while (string-match "\\(.*\\)\n" rl-dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
521 (let ((dir (match-string 1 rl-dir))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
522 (setq rl-dir |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
523 (if (and (file-directory-p dir) (file-writable-p dir)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
524 dir |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
525 (substring rl-dir (match-end 0)))))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
526 (unless (file-writable-p rl-dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
527 (error "No writable revlib directory found")) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
528 (message "Revlib at %s" rl-dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
529 (let* ((archives (directory-files rl-dir 'full "[^.]\\|...")) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
530 (categories |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
531 (apply 'append |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
532 (mapcar (lambda (dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
533 (when (file-directory-p dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
534 (directory-files dir 'full "[^.]\\|..."))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
535 archives))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
536 (branches |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
537 (apply 'append |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
538 (mapcar (lambda (dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
539 (when (file-directory-p dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
540 (directory-files dir 'full "[^.]\\|..."))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
541 categories))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
542 (versions |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
543 (apply 'append |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
544 (mapcar (lambda (dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
545 (when (file-directory-p dir) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
546 (directory-files dir 'full "--.*--"))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
547 branches)))) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
548 (mapc 'vc-arch-trim-one-revlib versions)) |
205f0e2270e9
(vc-arch-add-tagline): Do a slightly cleaner job.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81379
diff
changeset
|
549 )) |
82502
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
550 |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
551 (defvar vc-arch-extra-menu-map |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
552 (let ((map (make-sparse-keymap))) |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
553 (define-key map [add-tagline] |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
554 '(menu-item "Add tagline" vc-arch-add-tagline)) |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
555 map)) |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
556 |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
557 (defun vc-arch-extra-menu () vc-arch-extra-menu-map) |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
558 |
2a2056106d16
(vc-arch-extra-menu-map): New var and fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
559 |
74940
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
560 ;;; Less obvious implementations. |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
561 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
84374
diff
changeset
|
562 (defun vc-arch-find-revision (file rev buffer) |
74940
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
563 (let ((out (make-temp-file "vc-out"))) |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
564 (unwind-protect |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
565 (progn |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
566 (with-temp-buffer |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
567 (vc-arch-command (current-buffer) 1 nil "file-diffs" file rev) |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
568 (call-process-region (point-min) (point-max) |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
569 "patch" nil nil nil "-R" "-o" out file)) |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
570 (with-current-buffer buffer |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
571 (insert-file-contents out))) |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
572 (delete-file out)))) |
f0d812b53a76
(vc-arch-find-version): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
573 |
54396 | 574 (provide 'vc-arch) |
575 | |
56954
242cddb00aef
(vc-arch-workfile-version): Handle the special case before the first commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56283
diff
changeset
|
576 ;; arch-tag: a35c7c1c-5237-429d-88ef-3d718fd2e704 |
54396 | 577 ;;; vc-arch.el ends here |