Mercurial > emacs
comparison lisp/vc-bzr.el @ 91048:d38543a1c0f9
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 880-885)
- Remove RCS keywords from doc/misc/cc-mode.texi
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-264
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 13 Oct 2007 05:53:03 +0000 |
parents | 14c4a6aac623 b16f7408cd3f |
children | 4b09bb044f38 |
comparison
equal
deleted
inserted
replaced
91047:1cf8ecbaa1dc | 91048:d38543a1c0f9 |
---|---|
236 (unchanged . up-to-date))))))) | 236 (unchanged . up-to-date))))))) |
237 | 237 |
238 (defun vc-bzr-workfile-unchanged-p (file) | 238 (defun vc-bzr-workfile-unchanged-p (file) |
239 (eq 'unchanged (car (vc-bzr-status file)))) | 239 (eq 'unchanged (car (vc-bzr-status file)))) |
240 | 240 |
241 (defun vc-bzr-workfile-version (file) | 241 (defun vc-bzr-working-revision (file) |
242 (lexical-let* | 242 (lexical-let* |
243 ((rootdir (vc-bzr-root file)) | 243 ((rootdir (vc-bzr-root file)) |
244 (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file | 244 (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file |
245 rootdir)) | 245 rootdir)) |
246 (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir)) | 246 (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir)) |
282 | 282 |
283 (defun vc-bzr-register (files &optional rev comment) | 283 (defun vc-bzr-register (files &optional rev comment) |
284 "Register FILE under bzr. | 284 "Register FILE under bzr. |
285 Signal an error unless REV is nil. | 285 Signal an error unless REV is nil. |
286 COMMENT is ignored." | 286 COMMENT is ignored." |
287 (if rev (error "Can't register explicit version with bzr")) | 287 (if rev (error "Can't register explicit revision with bzr")) |
288 (vc-bzr-command "add" nil 0 files)) | 288 (vc-bzr-command "add" nil 0 files)) |
289 | 289 |
290 ;; Could run `bzr status' in the directory and see if it succeeds, but | 290 ;; Could run `bzr status' in the directory and see if it succeeds, but |
291 ;; that's relatively expensive. | 291 ;; that's relatively expensive. |
292 (defalias 'vc-bzr-responsible-p 'vc-bzr-root | 292 (defalias 'vc-bzr-responsible-p 'vc-bzr-root |
311 (vc-bzr-command "remove" nil 0 file)) | 311 (vc-bzr-command "remove" nil 0 file)) |
312 | 312 |
313 (defun vc-bzr-checkin (files rev comment) | 313 (defun vc-bzr-checkin (files rev comment) |
314 "Check FILE in to bzr with log message COMMENT. | 314 "Check FILE in to bzr with log message COMMENT. |
315 REV non-nil gets an error." | 315 REV non-nil gets an error." |
316 (if rev (error "Can't check in a specific version with bzr")) | 316 (if rev (error "Can't check in a specific revision with bzr")) |
317 (vc-bzr-command "commit" nil 0 files "-m" comment)) | 317 (vc-bzr-command "commit" nil 0 files "-m" comment)) |
318 | 318 |
319 (defun vc-bzr-checkout (file &optional editable rev destfile) | 319 (defun vc-bzr-checkout (file &optional editable rev destfile) |
320 "Checkout revision REV of FILE from bzr to DESTFILE. | 320 "Checkout revision REV of FILE from bzr to DESTFILE. |
321 EDITABLE is ignored." | 321 EDITABLE is ignored." |
363 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for | 363 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for |
364 ;; the buffer, or at least set the regexps right. | 364 ;; the buffer, or at least set the regexps right. |
365 (unless (fboundp 'vc-default-log-view-mode) | 365 (unless (fboundp 'vc-default-log-view-mode) |
366 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode))) | 366 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode))) |
367 | 367 |
368 (defun vc-bzr-show-log-entry (version) | 368 (defun vc-bzr-show-log-entry (revision) |
369 "Find entry for patch name VERSION in bzr change log buffer." | 369 "Find entry for patch name REVISION in bzr change log buffer." |
370 (goto-char (point-min)) | 370 (goto-char (point-min)) |
371 (let (case-fold-search) | 371 (let (case-fold-search) |
372 (if (re-search-forward (concat "^-+\nrevno: " version "$") nil t) | 372 (if (re-search-forward (concat "^-+\nrevno: " revision "$") nil t) |
373 (beginning-of-line 0) | 373 (beginning-of-line 0) |
374 (goto-char (point-min))))) | 374 (goto-char (point-min))))) |
375 | 375 |
376 (autoload 'vc-diff-switches-list "vc" nil nil t) | 376 (autoload 'vc-diff-switches-list "vc" nil nil t) |
377 | 377 |
378 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) | 378 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) |
379 "VC bzr backend for diff." | 379 "VC bzr backend for diff." |
380 (let ((working (vc-workfile-version (if (consp files) (car files) files)))) | 380 (let ((working (vc-working-revision (if (consp files) (car files) files)))) |
381 (if (and (equal rev1 working) (not rev2)) | 381 (if (and (equal rev1 working) (not rev2)) |
382 (setq rev1 nil)) | 382 (setq rev1 nil)) |
383 (if (and (not rev1) rev2) | 383 (if (and (not rev1) rev2) |
384 (setq rev1 working)) | 384 (setq rev1 working)) |
385 ;; bzr diff produces condition code 1 for some reason. | 385 ;; bzr diff produces condition code 1 for some reason. |
392 (list "-r" rev1)))))) | 392 (list "-r" rev1)))))) |
393 | 393 |
394 (defalias 'vc-bzr-diff-tree 'vc-bzr-diff) | 394 (defalias 'vc-bzr-diff-tree 'vc-bzr-diff) |
395 | 395 |
396 | 396 |
397 ;; FIXME: vc-{next,previous}-version need fixing in vc.el to deal with | 397 ;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with |
398 ;; straight integer versions. | 398 ;; straight integer revisions. |
399 | 399 |
400 (defun vc-bzr-delete-file (file) | 400 (defun vc-bzr-delete-file (file) |
401 "Delete FILE and delete it in the bzr repository." | 401 "Delete FILE and delete it in the bzr repository." |
402 (condition-case () | 402 (condition-case () |
403 (delete-file file) | 403 (delete-file file) |
410 | 410 |
411 (defvar vc-bzr-annotation-table nil | 411 (defvar vc-bzr-annotation-table nil |
412 "Internal use.") | 412 "Internal use.") |
413 (make-variable-buffer-local 'vc-bzr-annotation-table) | 413 (make-variable-buffer-local 'vc-bzr-annotation-table) |
414 | 414 |
415 (defun vc-bzr-annotate-command (file buffer &optional version) | 415 (defun vc-bzr-annotate-command (file buffer &optional revision) |
416 "Prepare BUFFER for `vc-annotate' on FILE. | 416 "Prepare BUFFER for `vc-annotate' on FILE. |
417 Each line is tagged with the revision number, which has a `help-echo' | 417 Each line is tagged with the revision number, which has a `help-echo' |
418 property containing author and date information." | 418 property containing author and date information." |
419 (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all" | 419 (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all" |
420 (if version (list "-r" version))) | 420 (if revision (list "-r" revision))) |
421 (with-current-buffer buffer | 421 (with-current-buffer buffer |
422 ;; Store the tags for the annotated source lines in a hash table | 422 ;; Store the tags for the annotated source lines in a hash table |
423 ;; to allow saving space by sharing the text properties. | 423 ;; to allow saving space by sharing the text properties. |
424 (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) | 424 (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) |
425 (goto-char (point-min)) | 425 (goto-char (point-min)) |
544 (match-end 0) (line-end-position)) | 544 (match-end 0) (line-end-position)) |
545 bzr-root-directory))) | 545 bzr-root-directory))) |
546 (vc-file-setprop file 'vc-state current-vc-state) | 546 (vc-file-setprop file 'vc-state current-vc-state) |
547 (vc-file-setprop file 'vc-bzr-state current-bzr-state) | 547 (vc-file-setprop file 'vc-bzr-state current-bzr-state) |
548 (when (eq 'added current-bzr-state) | 548 (when (eq 'added current-bzr-state) |
549 (vc-file-setprop file 'vc-workfile-version "0")))) | 549 (vc-file-setprop file 'vc-working-revision "0")))) |
550 (when (eq 'not-versioned current-bzr-state) | 550 (when (eq 'not-versioned current-bzr-state) |
551 (let ((file (expand-file-name | 551 (let ((file (expand-file-name |
552 (buffer-substring-no-properties | 552 (buffer-substring-no-properties |
553 (match-end 0) (line-end-position)) | 553 (match-end 0) (line-end-position)) |
554 bzr-root-directory))) | 554 bzr-root-directory))) |