comparison lisp/vc-bzr.el @ 108009:17d3324f96dd

Make the log-edit comments use RFC822 format throughout. * vc.el (vc-checkin, vc-modify-change-comment): Adjust to new vc-start/finish-logentry. (vc-find-conflicted-file): New command. (vc-transfer-file): Adjust to new vc-checkin. (vc-next-action): Improve scoping. * vc-hg.el (vc-hg-log-edit-mode): Remove. (vc-hg-checkin): Remove extra arg. Use log-edit-extract-headers. * vc-git.el (vc-git-log-edit-mode): Remove. (vc-git-checkin): Remove extra arg. Use log-edit-extract-headers. (vc-git-commits-coding-system): Rename from git-commits-coding-system. * vc-dispatcher.el (vc-log-edit): Shorten names for log-edit-show-files. (vc-start-logentry): Remove argument `extra'. (vc-finish-logentry): Remove extra args. * vc-bzr.el (vc-bzr-log-edit-mode): Remove. (vc-bzr-checkin): Remove extra arg. Use log-edit-extract-headers. (vc-bzr-conflicted-files): New function. * log-edit.el (log-edit-extra-flags) (log-edit-before-checkin-process): Remove. (log-edit-summary, log-edit-header, log-edit-unknown-header): New faces. (log-edit-headers-alist): New var. (log-edit-header-contents-regexp): New const. (log-edit-match-to-eoh): New function. (log-edit-font-lock-keywords): Use them. (log-edit): Insert a "Summary:" header as default. (log-edit-mode): Mark font-lock rules as case-insensitive. (log-edit-done): Cleanup headers. (log-view-process-buffer): Remove. (log-edit-extract-headers): New function to replace it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 20 Apr 2010 22:05:24 -0400
parents bb75dfb8839a
children 4ae75c6f19d6
comparison
equal deleted inserted replaced
108008:3ccddf080698 108009:17d3324f96dd
449 449
450 (defun vc-bzr-unregister (file) 450 (defun vc-bzr-unregister (file)
451 "Unregister FILE from bzr." 451 "Unregister FILE from bzr."
452 (vc-bzr-command "remove" nil 0 file "--keep")) 452 (vc-bzr-command "remove" nil 0 file "--keep"))
453 453
454 (defun vc-bzr-checkin (files rev comment &optional extra-args) 454 (declare-function log-edit-extract-headers "log-edit" (headers string))
455
456 (defun vc-bzr-checkin (files rev comment)
455 "Check FILE in to bzr with log message COMMENT. 457 "Check FILE in to bzr with log message COMMENT.
456 REV non-nil gets an error." 458 REV non-nil gets an error."
457 (if rev (error "Can't check in a specific revision with bzr")) 459 (if rev (error "Can't check in a specific revision with bzr"))
458 (apply 'vc-bzr-command "commit" nil 0 files (append (list "-m" comment) extra-args))) 460 (apply 'vc-bzr-command "commit" nil 'async
461 files (cons "-m" (log-edit-extract-headers '(("Author" . "--author")
462 ("Fixes" . "--fixes"))
463 comment))))
459 464
460 (defun vc-bzr-find-revision (file rev buffer) 465 (defun vc-bzr-find-revision (file rev buffer)
461 "Fetch revision REV of file FILE and put it into BUFFER." 466 "Fetch revision REV of file FILE and put it into BUFFER."
462 (with-current-buffer buffer 467 (with-current-buffer buffer
463 (if (and rev (stringp rev) (not (string= rev ""))) 468 (if (and rev (stringp rev) (not (string= rev "")))
549 (progn 554 (progn
550 (beginning-of-line 0) 555 (beginning-of-line 0)
551 (setq found t)) 556 (setq found t))
552 (goto-char (point-min))) 557 (goto-char (point-min)))
553 found))) 558 found)))
554
555 (declare-function log-edit-mode "log-edit" ())
556 (defvar log-edit-extra-flags)
557 (defvar log-edit-before-checkin-process)
558
559 (define-derived-mode vc-bzr-log-edit-mode log-edit-mode "Bzr-Log-Edit"
560 "Mode for editing Bzr commit logs.
561 If a line like:
562 Author: NAME
563 is present in the log, it is removed, and
564 --author NAME
565 is passed to the bzr commit command. Similarly with Fixes: and --fixes."
566 (set (make-local-variable 'log-edit-extra-flags) nil)
567 (set (make-local-variable 'log-edit-before-checkin-process)
568 '(("^\\(Author\\|Fixes\\):[ \t]+\\(.*\\)[ \t]*$" .
569 (list (format "--%s" (downcase (match-string 1)))
570 (match-string 2))))))
571 559
572 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) 560 (defun vc-bzr-diff (files &optional rev1 rev2 buffer)
573 "VC bzr backend for diff." 561 "VC bzr backend for diff."
574 ;; `bzr diff' exits with code 1 if diff is non-empty. 562 ;; `bzr diff' exits with code 1 if diff is non-empty.
575 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 563 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*")
981 (push (match-string 1 loglines) vc-bzr-revisions) 969 (push (match-string 1 loglines) vc-bzr-revisions)
982 (setq start (+ start (match-end 0))) 970 (setq start (+ start (match-end 0)))
983 (setq loglines (buffer-substring-no-properties start (point-max)))))) 971 (setq loglines (buffer-substring-no-properties start (point-max))))))
984 vc-bzr-revisions)) 972 vc-bzr-revisions))
985 973
974 (defun vc-bzr-conflicted-files (dir)
975 (let ((default-directory (vc-bzr-root dir))
976 (files ()))
977 (with-temp-buffer
978 (vc-bzr-command "status" t 0 default-directory)
979 (goto-char (point-min))
980 (when (re-search-forward "^conflicts:\n" nil t)
981 (while (looking-at " \\(?:Text conflict in \\(.*\\)\\|.*\\)\n")
982 (if (match-end 1)
983 (push (expand-file-name (match-string 1)) files))
984 (goto-char (match-end 0)))))
985 files))
986
986 ;;; Revision completion 987 ;;; Revision completion
987 988
988 (eval-and-compile 989 (eval-and-compile
989 (defconst vc-bzr-revision-keywords 990 (defconst vc-bzr-revision-keywords
990 '("revno" "revid" "last" "before" 991 '("revno" "revid" "last" "before"