Mercurial > emacs
comparison lisp/vc-bzr.el @ 91005:424b655804ca
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 846-851)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 88-92)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 242-244)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-246
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 13 Aug 2007 13:48:35 +0000 |
parents | 35e3789db058 e5a68f18fcb9 |
children | aaccdab0ee26 |
comparison
equal
deleted
inserted
replaced
91004:f72cf5b2ab11 | 91005:424b655804ca |
---|---|
1 ;;; vc-bzr.el --- VC backend for the bzr revision control system | 1 ;;; vc-bzr.el --- VC backend for the bzr revision control system |
2 | 2 |
3 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. |
4 | |
5 ;; NOTE: THIS IS A MODIFIED VERSION OF Dave Love's vc-bzr.el, | |
6 ;; which you can find at: http://www.loveshack.ukfsn.org/emacs/vc-bzr.el | |
7 ;; I could not get in touch with Dave Love by email, so | |
8 ;; I am releasing my changes separately. -- Riccardo | |
9 | 4 |
10 ;; Author: Dave Love <fx@gnu.org>, Riccardo Murri <riccardo.murri@gmail.com> | 5 ;; Author: Dave Love <fx@gnu.org>, Riccardo Murri <riccardo.murri@gmail.com> |
11 ;; Keywords: tools | 6 ;; Keywords: tools |
12 ;; Created: Sept 2006 | 7 ;; Created: Sept 2006 |
13 ;; Version: 2007-05-24 | 8 ;; Version: 2007-08-03 |
14 ;; URL: http://launchpad.net/vc-bzr | 9 ;; URL: http://launchpad.net/vc-bzr |
15 | 10 |
16 ;; This file is free software; you can redistribute it and/or modify | 11 ;; This file is free software; you can redistribute it and/or modify |
17 ;; it under the terms of the GNU General Public License as published by | 12 ;; it under the terms of the GNU General Public License as published by |
18 ;; the Free Software Foundation; either version 3, or (at your option) | 13 ;; the Free Software Foundation; either version 3, or (at your option) |
28 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
29 ;; Boston, MA 02110-1301, USA. | 24 ;; Boston, MA 02110-1301, USA. |
30 | 25 |
31 | 26 |
32 ;;; Commentary: | 27 ;;; Commentary: |
33 | |
34 ;; NOTE: THIS IS A MODIFIED VERSION OF Dave Love's vc-bzr.el, | |
35 ;; which you can find at: http://www.loveshack.ukfsn.org/emacs/vc-bzr.el | |
36 | 28 |
37 ;; See <URL:http://bazaar-vcs.org/> concerning bzr. | 29 ;; See <URL:http://bazaar-vcs.org/> concerning bzr. |
38 | 30 |
39 ;; Load this library to register bzr support in VC. It covers basic VC | 31 ;; Load this library to register bzr support in VC. It covers basic VC |
40 ;; functionality, but was only lightly exercised with a few Emacs/bzr | 32 ;; functionality, but was only lightly exercised with a few Emacs/bzr |
94 "Wrapper round `vc-do-command' using `vc-bzr-program' as COMMAND. | 86 "Wrapper round `vc-do-command' using `vc-bzr-program' as COMMAND. |
95 Invoke the bzr command adding `BZR_PROGRESS_BAR=none' to the environment." | 87 Invoke the bzr command adding `BZR_PROGRESS_BAR=none' to the environment." |
96 (let ((process-environment | 88 (let ((process-environment |
97 (list* "BZR_PROGRESS_BAR=none" ; Suppress progress output (bzr >=0.9) | 89 (list* "BZR_PROGRESS_BAR=none" ; Suppress progress output (bzr >=0.9) |
98 "LC_ALL=C" ; Force English output | 90 "LC_ALL=C" ; Force English output |
99 process-environment)) | 91 process-environment))) |
100 ;; bzr may attempt some kind of user interaction if its stdin/stdout | |
101 ;; is connected to a PTY; therefore, ask Emacs to use a pipe to | |
102 ;; communicate with it. | |
103 ;; This is redundant because vc-do-command does it already. --Stef | |
104 (process-connection-type nil)) | |
105 (apply 'vc-do-command buffer okstatus vc-bzr-program | 92 (apply 'vc-do-command buffer okstatus vc-bzr-program |
106 file-or-list bzr-command (append vc-bzr-program-args args)))) | 93 file-or-list bzr-command (append vc-bzr-program-args args)))) |
107 | 94 |
108 | 95 |
109 ;;;###autoload | 96 ;;;###autoload |
110 (defconst vc-bzr-admin-dirname ".bzr") ; FIXME: "_bzr" on w32? | 97 (defconst vc-bzr-admin-dirname ".bzr" ; FIXME: "_bzr" on w32? |
98 "Name of the directory containing Bzr repository status files.") | |
99 ;;;###autoload | |
100 (defconst vc-bzr-admin-checkout-format-file | |
101 (concat vc-bzr-admin-dirname "/checkout/format")) | |
102 (defconst vc-bzr-admin-dirstate | |
103 (concat vc-bzr-admin-dirname "/checkout/dirstate")) | |
104 (defconst vc-bzr-admin-branch-format-file | |
105 (concat vc-bzr-admin-dirname "/branch/format")) | |
106 (defconst vc-bzr-admin-revhistory | |
107 (concat vc-bzr-admin-dirname "/branch/revision-history")) | |
111 | 108 |
112 ;;;###autoload (defun vc-bzr-registered (file) | 109 ;;;###autoload (defun vc-bzr-registered (file) |
113 ;;;###autoload (if (vc-find-root file vc-bzr-admin-dirname) | 110 ;;;###autoload (if (vc-find-root file vc-bzr-admin-checkout-format-file) |
114 ;;;###autoload (progn | 111 ;;;###autoload (progn |
115 ;;;###autoload (load "vc-bzr") | 112 ;;;###autoload (load "vc-bzr") |
116 ;;;###autoload (vc-bzr-registered file)))) | 113 ;;;###autoload (vc-bzr-registered file)))) |
117 | 114 |
118 (defun vc-bzr-root-dir (file) | 115 (defun vc-bzr-root (file) |
119 "Return the root directory in the hierarchy above FILE. | 116 "Return the root directory of the bzr repository containing FILE." |
120 Return nil if there isn't one." | 117 ;; Cache technique copied from vc-arch.el. |
121 (vc-find-root file vc-bzr-admin-dirname)) | 118 (or (vc-file-getprop file 'bzr-root) |
119 (vc-file-setprop | |
120 file 'bzr-root | |
121 (vc-find-root file vc-bzr-admin-checkout-format-file)))) | |
122 | 122 |
123 (defun vc-bzr-registered (file) | 123 (defun vc-bzr-registered (file) |
124 "Return non-nil if FILE is registered with bzr." | 124 "Return non-nil if FILE is registered with bzr. |
125 (if (vc-bzr-root-dir file) ; Short cut. | 125 |
126 (vc-bzr-state file))) ; Expensive. | 126 For speed, this function tries first to parse Bzr internal file |
127 `checkout/dirstate', but it may fail if Bzr internal file format | |
128 has changed. As a safeguard, the `checkout/dirstate' file is | |
129 only parsed if it contains the string `#bazaar dirstate flat | |
130 format 3' in the first line. | |
131 | |
132 If the `checkout/dirstate' file cannot be parsed, fall back to | |
133 running `vc-bzr-state'." | |
134 (condition-case nil | |
135 (lexical-let ((root (vc-bzr-root file))) | |
136 (and root ; Short cut. | |
137 ;; This looks at internal files. May break if they change | |
138 ;; their format. | |
139 (lexical-let | |
140 ((dirstate-file (expand-file-name vc-bzr-admin-dirstate root))) | |
141 (if (file-exists-p dirstate-file) | |
142 (with-temp-buffer | |
143 (insert-file-contents dirstate-file) | |
144 (goto-char (point-min)) | |
145 (when (looking-at "#bazaar dirstate flat format 3") | |
146 (let* ((relfile (file-relative-name file root)) | |
147 (reldir (file-name-directory relfile))) | |
148 (re-search-forward | |
149 (concat "^\0" | |
150 (if reldir (regexp-quote (directory-file-name reldir))) | |
151 "\0" | |
152 (regexp-quote (file-name-nondirectory relfile)) | |
153 "\0") | |
154 nil t)))) | |
155 t)) | |
156 (vc-bzr-state file))) ; Expensive. | |
157 (file-error nil))) ; vc-bzr-program not found | |
127 | 158 |
128 (defun vc-bzr-buffer-nonblank-p (&optional buffer) | 159 (defun vc-bzr-buffer-nonblank-p (&optional buffer) |
129 "Return non-nil if BUFFER contains any non-blank characters." | 160 "Return non-nil if BUFFER contains any non-blank characters." |
130 (or (> (buffer-size buffer) 0) | 161 (or (> (buffer-size buffer) 0) |
131 (save-excursion | 162 (save-excursion |
132 (set-buffer (or buffer (current-buffer))) | 163 (set-buffer (or buffer (current-buffer))) |
133 (goto-char (point-min)) | 164 (goto-char (point-min)) |
134 (re-search-forward "[^ \t\n]" (point-max) t)))) | 165 (re-search-forward "[^ \t\n]" (point-max) t)))) |
135 | 166 |
136 (defconst vc-bzr-state-words | 167 (defconst vc-bzr-state-words |
137 "added\\|ignored\\|modified\\|removed\\|renamed\\|unknown" | 168 "added\\|ignored\\|kind changed\\|modified\\|removed\\|renamed\\|unknown" |
138 "Regexp matching file status words as reported in `bzr' output.") | 169 "Regexp matching file status words as reported in `bzr' output.") |
139 | 170 |
171 (defun vc-bzr-file-name-relative (filename) | |
172 "Return file name FILENAME stripped of the initial Bzr repository path." | |
173 (lexical-let* | |
174 ((filename* (expand-file-name filename)) | |
175 (rootdir (vc-bzr-root (file-name-directory filename*)))) | |
176 (and rootdir | |
177 (file-relative-name filename* rootdir)))) | |
178 | |
140 ;; FIXME: Also get this in a non-registered sub-directory. | 179 ;; FIXME: Also get this in a non-registered sub-directory. |
141 (defun vc-bzr-state (file) | 180 ;; It already works for me. -- Riccardo |
181 (defun vc-bzr-status (file) | |
182 "Return FILE status according to Bzr. | |
183 Return value is a cons (STATUS . WARNING), where WARNING is a | |
184 string or nil, and STATUS is one of the symbols: 'added, | |
185 'ignored, 'kindchange, 'modified, 'removed, 'renamed, 'unknown, | |
186 which directly correspond to `bzr status' output, or 'unchanged | |
187 for files whose copy in the working tree is identical to the one | |
188 in the branch repository, or nil for files that are not | |
189 registered with Bzr. | |
190 | |
191 If any error occurred in running `bzr status', then return nil." | |
192 (condition-case nil | |
142 (with-temp-buffer | 193 (with-temp-buffer |
143 (cd (file-name-directory file)) | 194 (let ((ret (vc-bzr-command "status" t 0 file)) |
144 (let ((ret (vc-bzr-command "status" t 255 file)) | 195 (status 'unchanged)) |
145 (state 'up-to-date)) | |
146 ;; the only secure status indication in `bzr status' output | 196 ;; the only secure status indication in `bzr status' output |
147 ;; is a couple of lines following the pattern:: | 197 ;; is a couple of lines following the pattern:: |
148 ;; | <status>: | 198 ;; | <status>: |
149 ;; | <file name> | 199 ;; | <file name> |
150 ;; if the file is up-to-date, we get no status report from `bzr', | 200 ;; if the file is up-to-date, we get no status report from `bzr', |
151 ;; so if the regexp search for the above pattern fails, we consider | 201 ;; so if the regexp search for the above pattern fails, we consider |
152 ;; the file to be up-to-date. | 202 ;; the file to be up-to-date. |
153 (goto-char (point-min)) | 203 (goto-char (point-min)) |
154 (when | 204 (when |
155 (re-search-forward | 205 (re-search-forward |
206 ;; bzr prints paths relative to the repository root | |
156 (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+" | 207 (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+" |
157 (file-name-nondirectory file) "[ \t\n]*$") | 208 (regexp-quote (vc-bzr-file-name-relative file)) |
209 (if (file-directory-p file) "/?" "") | |
210 "[ \t\n]*$") | |
158 (point-max) t) | 211 (point-max) t) |
159 (let ((start (match-beginning 0)) | 212 (let ((start (match-beginning 0)) |
160 (end (match-end 0))) | 213 (end (match-end 0))) |
161 (goto-char start) | 214 (goto-char start) |
162 (setq state | 215 (setq status |
163 (cond | 216 (cond |
164 ((not (equal ret 0)) nil) | 217 ((not (equal ret 0)) nil) |
165 ((looking-at "added\\|renamed\\|modified\\|removed") 'edited) | 218 ((looking-at "added") 'added) |
166 ((looking-at "unknown\\|ignored") nil))) | 219 ((looking-at "kind changed") 'kindchange) |
220 ((looking-at "renamed") 'renamed) | |
221 ((looking-at "modified") 'modified) | |
222 ((looking-at "removed") 'removed) | |
223 ((looking-at "ignored") 'ignored) | |
224 ((looking-at "unknown") 'unknown))) | |
167 ;; erase the status text that matched | 225 ;; erase the status text that matched |
168 (delete-region start end))) | 226 (delete-region start end))) |
169 (when (vc-bzr-buffer-nonblank-p) | 227 (if status |
170 ;; "bzr" will output some warnings and informational messages | 228 (cons status |
171 ;; to the user to stderr; due to Emacs' `vc-do-command' (and, | 229 ;; "bzr" will output warnings and informational messages to |
172 ;; it seems, `start-process' itself), we cannot catch stderr | 230 ;; stderr; due to Emacs' `vc-do-command' (and, it seems, |
231 ;; `start-process' itself) limitations, we cannot catch stderr | |
173 ;; and stdout into different buffers. So, if there's anything | 232 ;; and stdout into different buffers. So, if there's anything |
174 ;; left in the buffer after removing the above status | 233 ;; left in the buffer after removing the above status |
175 ;; keywords, let us just presume that any other message from | 234 ;; keywords, let us just presume that any other message from |
176 ;; "bzr" is a user warning, and display it. | 235 ;; "bzr" is a user warning, and display it. |
177 (message "Warnings in `bzr' output: %s" | 236 (if (vc-bzr-buffer-nonblank-p) |
178 (buffer-substring (point-min) (point-max)))) | 237 (buffer-substring (point-min) (point-max))))))) |
179 (when state | 238 (file-error nil))) ; vc-bzr-program not found |
180 (vc-file-setprop file 'vc-workfile-version | 239 |
181 (vc-bzr-workfile-version file)) | 240 (defun vc-bzr-state (file) |
182 (vc-file-setprop file 'vc-state state)) | 241 (lexical-let ((result (vc-bzr-status file))) |
183 state))) | 242 (when (consp result) |
243 (if (cdr result) | |
244 (message "Warnings in `bzr' output: %s" (cdr result))) | |
245 (cdr (assq (car result) | |
246 '((added . edited) | |
247 (kindchange . edited) | |
248 (renamed . edited) | |
249 (modified . edited) | |
250 (removed . edited) | |
251 (ignored . nil) | |
252 (unknown . nil) | |
253 (unchanged . up-to-date))))))) | |
184 | 254 |
185 (defun vc-bzr-workfile-unchanged-p (file) | 255 (defun vc-bzr-workfile-unchanged-p (file) |
186 (eq 'up-to-date (vc-bzr-state file))) | 256 (eq 'unchanged (car (vc-bzr-status file)))) |
187 | 257 |
188 (defun vc-bzr-workfile-version (file) | 258 (defun vc-bzr-workfile-version (file) |
189 ;; Looks like this could be obtained via counting lines in | 259 (lexical-let* |
190 ;; .bzr/branch/revision-history. | 260 ((rootdir (vc-bzr-root file)) |
261 (branch-format-file (concat rootdir "/" vc-bzr-admin-branch-format-file)) | |
262 (revhistory-file (concat rootdir "/" vc-bzr-admin-revhistory)) | |
263 (lastrev-file (concat rootdir "/" "branch/last-revision"))) | |
264 ;; Count lines in .bzr/branch/revision-history to avoid forking a | |
265 ;; bzr process. This looks at internal files. May break if they | |
266 ;; change their format. | |
267 (if (file-exists-p branch-format-file) | |
191 (with-temp-buffer | 268 (with-temp-buffer |
192 (vc-bzr-command "revno" t 0 file) | 269 (insert-file-contents branch-format-file) |
193 (goto-char (point-min)) | 270 (goto-char (point-min)) |
194 (buffer-substring (point) (line-end-position)))) | 271 (cond |
272 ((or | |
273 (looking-at "Bazaar-NG branch, format 0.0.4") | |
274 (looking-at "Bazaar-NG branch format 5")) | |
275 ;; count lines in .bzr/branch/revision-history | |
276 (insert-file-contents revhistory-file) | |
277 (number-to-string (count-lines (line-end-position) (point-max)))) | |
278 ((looking-at "Bazaar Branch Format 6 (bzr 0.15)") | |
279 ;; revno is the first number in .bzr/branch/last-revision | |
280 (insert-file-contents lastrev-file) | |
281 (goto-char (line-end-position)) | |
282 (if (re-search-forward "[0-9]+" nil t) | |
283 (buffer-substring (match-beginning 0) (match-end 0)))))) | |
284 ;; fallback to calling "bzr revno" | |
285 (lexical-let* | |
286 ((result (vc-bzr-command-discarding-stderr | |
287 vc-bzr-program "revno" file)) | |
288 (exitcode (car result)) | |
289 (output (cdr result))) | |
290 (cond | |
291 ((eq exitcode 0) (substring output 0 -1)) | |
292 (t nil)))))) | |
195 | 293 |
196 (defun vc-bzr-checkout-model (file) | 294 (defun vc-bzr-checkout-model (file) |
197 'implicit) | 295 'implicit) |
198 | 296 |
199 (defun vc-bzr-create-repo () | 297 (defun vc-bzr-create-repo () |
207 (if rev (error "Can't register explicit version with bzr")) | 305 (if rev (error "Can't register explicit version with bzr")) |
208 (vc-bzr-command "add" nil 0 files)) | 306 (vc-bzr-command "add" nil 0 files)) |
209 | 307 |
210 ;; Could run `bzr status' in the directory and see if it succeeds, but | 308 ;; Could run `bzr status' in the directory and see if it succeeds, but |
211 ;; that's relatively expensive. | 309 ;; that's relatively expensive. |
212 (defalias 'vc-bzr-responsible-p 'vc-bzr-root-dir | 310 (defalias 'vc-bzr-responsible-p 'vc-bzr-root |
213 "Return non-nil if FILE is (potentially) controlled by bzr. | 311 "Return non-nil if FILE is (potentially) controlled by bzr. |
214 The criterion is that there is a `.bzr' directory in the same | 312 The criterion is that there is a `.bzr' directory in the same |
215 or a superior directory.") | 313 or a superior directory.") |
216 | 314 |
217 (defun vc-bzr-could-register (file) | 315 (defun vc-bzr-could-register (file) |
248 (vc-bzr-command "cat" t 0 file "-r" rev) | 346 (vc-bzr-command "cat" t 0 file "-r" rev) |
249 (vc-bzr-command "cat" t 0 file))))) | 347 (vc-bzr-command "cat" t 0 file))))) |
250 | 348 |
251 (defun vc-bzr-revert (file &optional contents-done) | 349 (defun vc-bzr-revert (file &optional contents-done) |
252 (unless contents-done | 350 (unless contents-done |
253 (with-temp-buffer (vc-bzr-command "revert" t 'async file)))) | 351 (with-temp-buffer (vc-bzr-command "revert" t 0 file)))) |
254 | 352 |
255 (defvar log-view-message-re) | 353 (defvar log-view-message-re) |
256 (defvar log-view-file-re) | 354 (defvar log-view-file-re) |
257 (defvar log-view-font-lock-keywords) | 355 (defvar log-view-font-lock-keywords) |
258 (defvar log-view-current-tag-function) | 356 (defvar log-view-current-tag-function) |
292 (let (case-fold-search) | 390 (let (case-fold-search) |
293 (if (re-search-forward (concat "^-+\nrevno: " version "$") nil t) | 391 (if (re-search-forward (concat "^-+\nrevno: " version "$") nil t) |
294 (beginning-of-line 0) | 392 (beginning-of-line 0) |
295 (goto-char (point-min))))) | 393 (goto-char (point-min))))) |
296 | 394 |
297 ;; Fixem: vc-bzr-wash-log | |
298 | |
299 (autoload 'vc-diff-switches-list "vc" nil nil t) | 395 (autoload 'vc-diff-switches-list "vc" nil nil t) |
300 | 396 |
301 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) | 397 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) |
302 "VC bzr backend for diff." | 398 "VC bzr backend for diff." |
303 (let ((working (vc-workfile-version (car files)))) | 399 (let ((working (vc-workfile-version (if (consp files) (car files) files)))) |
304 (if (and (equal rev1 working) (not rev2)) | 400 (if (and (equal rev1 working) (not rev2)) |
305 (setq rev1 nil)) | 401 (setq rev1 nil)) |
306 (if (and (not rev1) rev2) | 402 (if (and (not rev1) rev2) |
307 (setq rev1 working)) | 403 (setq rev1 working)) |
308 ;; NB. Can't be async -- see `vc-bzr-post-command-function'. | 404 ;; NB. Can't be async -- see `vc-bzr-post-command-function'. |
315 (list "-r" (format "%s..%s" rev1 rev2)) | 411 (list "-r" (format "%s..%s" rev1 rev2)) |
316 (list "-r" rev1)))))) | 412 (list "-r" rev1)))))) |
317 | 413 |
318 (defalias 'vc-bzr-diff-tree 'vc-bzr-diff) | 414 (defalias 'vc-bzr-diff-tree 'vc-bzr-diff) |
319 | 415 |
320 ;; Fixme: implement vc-bzr-dir-state, vc-bzr-dired-state-info | 416 |
321 | 417 ;; FIXME: vc-{next,previous}-version need fixing in vc.el to deal with |
322 ;; Fixme: vc-{next,previous}-version need fixing in vc.el to deal with | |
323 ;; straight integer versions. | 418 ;; straight integer versions. |
324 | 419 |
325 (defun vc-bzr-delete-file (file) | 420 (defun vc-bzr-delete-file (file) |
326 "Delete FILE and delete it in the bzr repository." | 421 "Delete FILE and delete it in the bzr repository." |
327 (condition-case () | 422 (condition-case () |
397 (defun vc-bzr-annotate-difference (point) | 492 (defun vc-bzr-annotate-difference (point) |
398 (let ((next-time (vc-bzr-annotate-time))) | 493 (let ((next-time (vc-bzr-annotate-time))) |
399 (if next-time | 494 (if next-time |
400 (- (vc-annotate-convert-time (current-time)) next-time)))) | 495 (- (vc-annotate-convert-time (current-time)) next-time)))) |
401 | 496 |
402 ;; FIXME: `bzr root' will return the real path to the repository root, | 497 (defun vc-bzr-command-discarding-stderr (command &rest args) |
403 ;; that is, it can differ from the buffer's current directory name | 498 "Execute shell command COMMAND (with ARGS); return its output and exitcode. |
404 ;; if there are any symbolic links. | 499 Return value is a cons (EXITCODE . OUTPUT), where EXITCODE is |
405 (defun vc-bzr-root (dir) | 500 the (numerical) exit code of the process, and OUTPUT is a string |
406 "Return the root directory of the bzr repository containing DIR." | 501 containing whatever the process sent to its standard output |
407 ;; Cache technique copied from vc-arch.el. | 502 stream. Standard error output is discarded." |
408 (or (vc-file-getprop dir 'bzr-root) | 503 (with-temp-buffer |
409 (vc-file-setprop | 504 (cons |
410 dir 'bzr-root | 505 (apply #'call-process command nil (list (current-buffer) nil) nil args) |
411 (substring | 506 (buffer-substring (point-min) (point-max))))) |
412 (shell-command-to-string (concat vc-bzr-program " root " dir)) 0 -1)))) | |
413 | 507 |
414 ;; TODO: it would be nice to mark the conflicted files in VC Dired, | 508 ;; TODO: it would be nice to mark the conflicted files in VC Dired, |
415 ;; and implement a command to run ediff and `bzr resolve' once the | 509 ;; and implement a command to run ediff and `bzr resolve' once the |
416 ;; changes have been merged. | 510 ;; changes have been merged. |
417 (defun vc-bzr-dir-state (dir &optional localp) | 511 (defun vc-bzr-dir-state (dir &optional localp) |
451 (setq at-start nil) | 545 (setq at-start nil) |
452 (cond | 546 (cond |
453 ((looking-at "^added") | 547 ((looking-at "^added") |
454 (setq current-vc-state 'edited) | 548 (setq current-vc-state 'edited) |
455 (setq current-bzr-state 'added)) | 549 (setq current-bzr-state 'added)) |
550 ((looking-at "^kind changed") | |
551 (setq current-vc-state 'edited) | |
552 (setq current-bzr-state 'kindchange)) | |
456 ((looking-at "^modified") | 553 ((looking-at "^modified") |
457 (setq current-vc-state 'edited) | 554 (setq current-vc-state 'edited) |
458 (setq current-bzr-state 'modified)) | 555 (setq current-bzr-state 'modified)) |
459 ((looking-at "^renamed") | 556 ((looking-at "^renamed") |
460 (setq current-vc-state 'edited) | 557 (setq current-vc-state 'edited) |
497 ;; In case of just `(load "vc-bzr")', but that's probably the wrong | 594 ;; In case of just `(load "vc-bzr")', but that's probably the wrong |
498 ;; way to do it. | 595 ;; way to do it. |
499 (add-to-list 'vc-handled-backends 'Bzr) | 596 (add-to-list 'vc-handled-backends 'Bzr) |
500 | 597 |
501 (eval-after-load "vc" | 598 (eval-after-load "vc" |
502 '(add-to-list 'vc-directory-exclusion-list ".bzr" t)) | 599 '(add-to-list 'vc-directory-exclusion-list vc-bzr-admin-dirname t)) |
503 | 600 |
504 (defconst vc-bzr-unload-hook | 601 (defconst vc-bzr-unload-hook |
505 (lambda () | 602 (lambda () |
506 (setq vc-handled-backends (delq 'Bzr vc-handled-backends)) | 603 (setq vc-handled-backends (delq 'Bzr vc-handled-backends)) |
507 (remove-hook 'vc-post-command-functions 'vc-bzr-post-command-function))) | 604 (remove-hook 'vc-post-command-functions 'vc-bzr-post-command-function))) |