annotate lisp/vc-mtn.el @ 101720:02a61aa59953

*** empty log message ***
author Eli Zaretskii <eliz@gnu.org>
date Sat, 31 Jan 2009 18:53:50 +0000
parents a9dc0e7c3f2b
children 62b984273010
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1 ;;; vc-mtn.el --- VC backend for Monotone
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100182
diff changeset
3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
4
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
5 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
6 ;; Keywords:
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
7
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
8 ;; This file is part of GNU Emacs.
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
9
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
13 ;; (at your option) any later version.
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
14
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
18 ;; GNU General Public License for more details.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
19
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
22
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
23 ;;; Commentary:
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
24
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
25 ;;
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
26
96125
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
27 ;;; TODO:
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
28
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
29 ;; - The `previous-version' VC method needs to be supported, 'D' in
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
30 ;; log-view-mode uses it.
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
31
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
32 ;;; Code:
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
33
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
34 (eval-when-compile (require 'cl) (require 'vc))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
35
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
36 (defcustom vc-mtn-diff-switches t
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
37 "String or list of strings specifying switches for monotone diff under VC.
100182
880b72ca5f06 (vc-mtn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 100058
diff changeset
38 If nil, use the value of `vc-diff-switches'. If t, use no switches."
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
39 :type '(choice (const :tag "Unspecified" nil)
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
40 (const :tag "None" t)
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
41 (string :tag "Argument String")
100182
880b72ca5f06 (vc-mtn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 100058
diff changeset
42 (repeat :tag "Argument List" :value ("") string))
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
43 :version "23.1"
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
44 :group 'vc)
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
45
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
46 (define-obsolete-variable-alias 'vc-mtn-command 'vc-mtn-program "23.1")
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
47 (defcustom vc-mtn-program "mtn"
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
48 "Name of the monotone executable."
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
49 :type 'string
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
50 :group 'vc)
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
51
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
52 ;; Clear up the cache to force vc-call to check again and discover
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
53 ;; new functions when we reload this file.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
54 (put 'Mtn 'vc-functions nil)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
55
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
56 (unless (executable-find vc-mtn-program)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
57 ;; vc-mtn.el is 100% non-functional without the `mtn' executable.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
58 (setq vc-handled-backends (delq 'Mtn vc-handled-backends)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
59
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
60 ;;;###autoload
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
61 (defconst vc-mtn-admin-dir "_MTN")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
62 ;;;###autoload
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
63 (defconst vc-mtn-admin-format (concat vc-mtn-admin-dir "/format"))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
64
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
65 ;;;###autoload (defun vc-mtn-registered (file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
66 ;;;###autoload (if (vc-find-root file vc-mtn-admin-format)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
67 ;;;###autoload (progn
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
68 ;;;###autoload (load "vc-mtn")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
69 ;;;###autoload (vc-mtn-registered file))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
70
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
71 (defun vc-mtn-revision-granularity () 'repository)
94563
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94521
diff changeset
72 (defun vc-mtn-checkout-model (files) 'implicit)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
73
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
74 (defun vc-mtn-root (file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
75 (setq file (if (file-directory-p file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
76 (file-name-as-directory file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
77 (file-name-directory file)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
78 (or (vc-file-getprop file 'vc-mtn-root)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
79 (vc-file-setprop file 'vc-mtn-root
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
80 (vc-find-root file vc-mtn-admin-format))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
81
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
82
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
83 (defun vc-mtn-registered (file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
84 (let ((root (vc-mtn-root file)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
85 (when root
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
86 (vc-mtn-state file))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
87
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
88 (defun vc-mtn-command (buffer okstatus files &rest flags)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
89 "A wrapper around `vc-do-command' for use in vc-mtn.el."
93564
eeb1bb8489e4 (vc-mtn-command): Avoid localization of messages.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93144
diff changeset
90 (let ((process-environment
eeb1bb8489e4 (vc-mtn-command): Avoid localization of messages.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93144
diff changeset
91 ;; Avoid localization of messages so we can parse the output.
eeb1bb8489e4 (vc-mtn-command): Avoid localization of messages.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93144
diff changeset
92 (cons "LC_MESSAGES=C" process-environment)))
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
93 (apply 'vc-do-command (or buffer "*vc*") okstatus vc-mtn-program
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
94 files flags)))
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
95
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
96 (defun vc-mtn-state (file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
97 ;; If `mtn' fails or returns status>0, or if the search files, just
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
98 ;; return nil.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
99 (ignore-errors
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
100 (with-temp-buffer
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
101 (vc-mtn-command t 0 file "status")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
102 (goto-char (point-min))
93144
33c08cf9fb3a (vc-mtn-state): Support the added state.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92692
diff changeset
103 (re-search-forward
33c08cf9fb3a (vc-mtn-state): Support the added state.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92692
diff changeset
104 "^ \\(?:\\(patched\\)\\|\\(added\\) \\(?:.*\\)\\)\\|no changes$")
33c08cf9fb3a (vc-mtn-state): Support the added state.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92692
diff changeset
105 (cond ((match-end 1) 'edited)
33c08cf9fb3a (vc-mtn-state): Support the added state.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92692
diff changeset
106 ((match-end 2) 'added)
33c08cf9fb3a (vc-mtn-state): Support the added state.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92692
diff changeset
107 (t 'up-to-date)))))
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
108
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 78791
diff changeset
109 (defun vc-mtn-working-revision (file)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
110 ;; If `mtn' fails or returns status>0, or if the search fails, just
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
111 ;; return nil.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
112 (ignore-errors
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
113 (with-temp-buffer
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
114 (vc-mtn-command t 0 file "status")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
115 (goto-char (point-min))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
116 (re-search-forward "Current branch: \\(.*\\)\nChanges against parent \\(.*\\)")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
117 (match-string 2))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
118
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
119 (defun vc-mtn-workfile-branch (file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
120 ;; If `mtn' fails or returns status>0, or if the search files, just
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
121 ;; return nil.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
122 (ignore-errors
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
123 (with-temp-buffer
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
124 (vc-mtn-command t 0 file "status")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
125 (goto-char (point-min))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
126 (re-search-forward "Current branch: \\(.*\\)\nChanges against parent \\(.*\\)")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
127 (match-string 1))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
128
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
129 (defun vc-mtn-workfile-unchanged-p (file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
130 (not (eq (vc-mtn-state file) 'edited)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
131
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
132 ;; Mode-line rewrite code copied from vc-arch.el.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
133
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
134 (defcustom vc-mtn-mode-line-rewrite
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
135 '(("\\`[^:/#]*[:/#]" . "")) ;Drop the host part.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
136 "Rewrite rules to shorten Mtn's revision names on the mode-line."
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
137 :type '(repeat (cons regexp string))
80261
4af0bb174714 * textmodes/css-mode.el (css-indent-offset, css-electric-keys):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79721
diff changeset
138 :version "22.2"
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
139 :group 'vc)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
140
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
141 (defun vc-mtn-mode-line-string (file)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
142 "Return string for placement in modeline by `vc-mode-line' for FILE."
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
143 (let ((branch (vc-mtn-workfile-branch file)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
144 (dolist (rule vc-mtn-mode-line-rewrite)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
145 (if (string-match (car rule) branch)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
146 (setq branch (replace-match (cdr rule) t nil branch))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
147 (format "Mtn%c%s"
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
148 (case (vc-state file)
94521
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 93564
diff changeset
149 ((up-to-date needs-update) ?-)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
150 (added ?@)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
151 (t ?:))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
152 branch)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
153
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
154 (defun vc-mtn-register (files &optional rest)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
155 (vc-mtn-command nil 0 files "add"))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
156
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
157 (defun vc-mtn-responsible-p (file) (vc-mtn-root file))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
158 (defun vc-mtn-could-register (file) (vc-mtn-root file))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
159
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
160 (defun vc-mtn-checkin (files rev comment)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
161 (vc-mtn-command nil 0 files "commit" "-m" comment))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
162
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 78791
diff changeset
163 (defun vc-mtn-find-revision (file rev buffer)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
164 (vc-mtn-command buffer 0 file "cat" "-r" rev))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
165
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
166 ;; (defun vc-mtn-checkout (file &optional editable rev)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
167 ;; )
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
168
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
169 (defun vc-mtn-revert (file &optional contents-done)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
170 (unless contents-done
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
171 (vc-mtn-command nil 0 file "revert")))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
172
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
173 ;; (defun vc-mtn-roolback (files)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
174 ;; )
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
175
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
176 (defun vc-mtn-print-log (files &optional buffer)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
177 (vc-mtn-command buffer 0 files "log"))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
178
85478
786d3a985758 * term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85462
diff changeset
179 (defvar log-view-message-re)
786d3a985758 * term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85462
diff changeset
180 (defvar log-view-file-re)
786d3a985758 * term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85462
diff changeset
181 (defvar log-view-font-lock-keywords)
96125
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
182 (defvar log-view-per-file-logs)
85478
786d3a985758 * term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85462
diff changeset
183
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
184 (define-derived-mode vc-mtn-log-view-mode log-view-mode "Mtn-Log-View"
96125
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
185 ;; Don't match anything.
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
186 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
673e286487b1 (vc-mtn-log-view-mode): Set log-view-per-file-logs and
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94847
diff changeset
187 (set (make-local-variable 'log-view-per-file-logs) nil)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
188 ;; TODO: Use a more precise regexp than "[ |/]+" to avoid false positives
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
189 ;; in the ChangeLog text.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
190 (set (make-local-variable 'log-view-message-re)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
191 "^[ |/]+Revision: \\([0-9a-f]+\\)")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
192 (require 'add-log) ;For change-log faces.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
193 (set (make-local-variable 'log-view-font-lock-keywords)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
194 (append log-view-font-lock-keywords
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
195 '(("^[ |]+Author: \\(.*\\)" (1 'change-log-email))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
196 ("^[ |]+Date: \\(.*\\)" (1 'change-log-date-face))))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
197
85141
b16f7408cd3f Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
198 ;; (defun vc-mtn-show-log-entry (revision)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
199 ;; )
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
200
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
201 (defun vc-mtn-diff (files &optional rev1 rev2 buffer)
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
202 "Get a difference report using monotone between two revisions of FILES."
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
203 (apply 'vc-mtn-command (or buffer "*vc-diff*") 1 files "diff"
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
204 (append
100058
fc3d57499127 (vc-mtn-diff): No need to duplicate vc-switches logic.
Glenn Morris <rgm@gnu.org>
parents: 99785
diff changeset
205 (vc-switches 'mtn 'diff)
99785
0a12c040f6e2 (vc-mtn-diff-switches): New option.
Glenn Morris <rgm@gnu.org>
parents: 96213
diff changeset
206 (if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
207
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
208 (defun vc-mtn-annotate-command (file buf &optional rev)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
209 (apply 'vc-mtn-command buf 0 file "annotate"
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
210 (if rev (list "-r" rev))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
211
96213
09da7727f35f * vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96125
diff changeset
212 (declare-function vc-annotate-convert-time "vc-annotate" (time))
09da7727f35f * vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96125
diff changeset
213
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
214 (defconst vc-mtn-annotate-full-re
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
215 "^ *\\([0-9a-f]+\\)\\.* by [^ ]+ \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\): ")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
216 (defconst vc-mtn-annotate-any-re
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
217 (concat "^\\(?: +: \\|" vc-mtn-annotate-full-re "\\)"))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
218
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
219 (defun vc-mtn-annotate-time ()
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
220 (when (looking-at vc-mtn-annotate-any-re)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
221 (goto-char (match-end 0))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
222 (let ((year (match-string 2)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
223 (if (not year)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
224 ;; Look for the date on a previous line.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
225 (save-excursion
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
226 (get-text-property (1- (previous-single-property-change
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
227 (point) 'vc-mtn-time nil (point-min)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
228 'vc-mtn-time))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
229 (let ((time (vc-annotate-convert-time
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
230 (encode-time 0 0 0
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
231 (string-to-number (match-string 4))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
232 (string-to-number (match-string 3))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
233 (string-to-number year)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
234 t))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
235 (let ((inhibit-read-only t)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
236 (inhibit-modification-hooks t))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
237 (put-text-property (match-beginning 0) (match-end 0)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
238 'vc-mtn-time time))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
239 time)))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
240
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
241 (defun vc-mtn-annotate-extract-revision-at-line ()
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
242 (save-excursion
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
243 (when (or (looking-at vc-mtn-annotate-full-re)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
244 (re-search-backward vc-mtn-annotate-full-re nil t))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
245 (match-string 1))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
246
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
247 ;;; Revision completion.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
248
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
249 (defun vc-mtn-list-tags ()
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
250 (with-temp-buffer
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
251 (vc-mtn-command t 0 nil "list" "tags")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
252 (goto-char (point-min))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
253 (let ((tags ()))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
254 (while (re-search-forward "^[^ ]+" nil t)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
255 (push (match-string 0) tags))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
256 tags)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
257
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
258 (defun vc-mtn-list-branches ()
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
259 (with-temp-buffer
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
260 (vc-mtn-command t 0 nil "list" "branches")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
261 (goto-char (point-min))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
262 (let ((branches ()))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
263 (while (re-search-forward "^.+" nil t)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
264 (push (match-string 0) branches))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
265 branches)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
266
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
267 (defun vc-mtn-list-revision-ids (prefix)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
268 (with-temp-buffer
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
269 (vc-mtn-command t 0 nil "complete" "revision" prefix)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
270 (goto-char (point-min))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
271 (let ((ids ()))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
272 (while (re-search-forward "^.+" nil t)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
273 (push (match-string 0) ids))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
274 ids)))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
275
85461
abd6fdb45765 (vc-mtn-revision-completion-table):Make it work when the arg is a list of files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
276 (defun vc-mtn-revision-completion-table (files)
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
277 ;; TODO: Implement completion for for selectors
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
278 ;; TODO: Implement completion for composite selectors.
85461
abd6fdb45765 (vc-mtn-revision-completion-table):Make it work when the arg is a list of files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
279 (lexical-let ((files files))
abd6fdb45765 (vc-mtn-revision-completion-table):Make it work when the arg is a list of files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
280 ;; What about using `files'?!? --Stef
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
281 (lambda (string pred action)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
282 (cond
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
283 ;; "Tag" selectors.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
284 ((string-match "\\`t:" string)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
285 (complete-with-action action
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
286 (mapcar (lambda (tag) (concat "t:" tag))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
287 (vc-mtn-list-tags))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
288 string pred))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
289 ;; "Branch" selectors.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
290 ((string-match "\\`b:" string)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
291 (complete-with-action action
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
292 (mapcar (lambda (tag) (concat "b:" tag))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
293 (vc-mtn-list-branches))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
294 string pred))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
295 ;; "Head" selectors. Not sure how they differ from "branch" selectors.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
296 ((string-match "\\`h:" string)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
297 (complete-with-action action
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
298 (mapcar (lambda (tag) (concat "h:" tag))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
299 (vc-mtn-list-branches))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
300 string pred))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
301 ;; "ID" selectors.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
302 ((string-match "\\`i:" string)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
303 (complete-with-action action
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
304 (mapcar (lambda (tag) (concat "i:" tag))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
305 (vc-mtn-list-revision-ids
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
306 (substring string (match-end 0))))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
307 string pred))
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
308 (t
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
309 (complete-with-action action
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
310 '("t:" "b:" "h:" "i:"
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
311 ;; Completion not implemented for these.
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
312 "a:" "c:" "d:" "e:" "l:")
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
313 string pred))))))
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
314
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94563
diff changeset
315
78791
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
316
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
317 (provide 'vc-mtn)
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
318
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
319 ;; arch-tag: 2b89ffbc-cbb8-405a-9080-2eafd4becb70
60dfb3143910 Add vc-mtn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
320 ;;; vc-mtn.el ends here