comparison lisp/vc-git.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 c168d4537385
children 2ad33f941be2
comparison
equal deleted inserted replaced
108008:3ccddf080698 108009:17d3324f96dd
116 (string :tag "Argument String") 116 (string :tag "Argument String")
117 (repeat :tag "Argument List" :value ("") string)) 117 (repeat :tag "Argument List" :value ("") string))
118 :version "23.1" 118 :version "23.1"
119 :group 'vc) 119 :group 'vc)
120 120
121 (defvar git-commits-coding-system 'utf-8 121 (defvar vc-git-commits-coding-system 'utf-8
122 "Default coding system for git commits.") 122 "Default coding system for git commits.")
123 123
124 ;;; BACKEND PROPERTIES 124 ;;; BACKEND PROPERTIES
125 125
126 (defun vc-git-revision-granularity () 'repository) 126 (defun vc-git-revision-granularity () 'repository)
546 (defalias 'vc-git-responsible-p 'vc-git-root) 546 (defalias 'vc-git-responsible-p 'vc-git-root)
547 547
548 (defun vc-git-unregister (file) 548 (defun vc-git-unregister (file)
549 (vc-git-command nil 0 file "rm" "-f" "--cached" "--")) 549 (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
550 550
551 551 (declare-function log-edit-extract-headers "log-edit" (headers string))
552 (defun vc-git-checkin (files rev comment &optional extra-args) 552
553 (let ((coding-system-for-write git-commits-coding-system)) 553 (defun vc-git-checkin (files rev comment)
554 (let ((coding-system-for-write vc-git-commits-coding-system))
554 (apply 'vc-git-command nil 0 files 555 (apply 'vc-git-command nil 0 files
555 (nconc (list "commit" "-m" comment) extra-args (list "--only" "--"))))) 556 (nconc (list "commit" "-m")
557 (log-edit-extract-headers '(("Author" . "--author"))
558 comment)
559 (list "--only" "--")))))
556 560
557 (defun vc-git-find-revision (file rev buffer) 561 (defun vc-git-find-revision (file rev buffer)
558 (let* (process-file-side-effects 562 (let* (process-file-side-effects
559 (coding-system-for-read 'binary) 563 (coding-system-for-read 'binary)
560 (coding-system-for-write 'binary) 564 (coding-system-for-write 'binary)
580 584
581 (defun vc-git-print-log (files buffer &optional shortlog start-revision limit) 585 (defun vc-git-print-log (files buffer &optional shortlog start-revision limit)
582 "Get change log associated with FILES. 586 "Get change log associated with FILES.
583 Note that using SHORTLOG requires at least Git version 1.5.6, 587 Note that using SHORTLOG requires at least Git version 1.5.6,
584 for the --graph option." 588 for the --graph option."
585 (let ((coding-system-for-read git-commits-coding-system)) 589 (let ((coding-system-for-read vc-git-commits-coding-system))
586 ;; `vc-do-command' creates the buffer, but we need it before running 590 ;; `vc-do-command' creates the buffer, but we need it before running
587 ;; the command. 591 ;; the command.
588 (vc-setup-buffer buffer) 592 (vc-setup-buffer buffer)
589 ;; If the buffer exists from a previous invocation it might be 593 ;; If the buffer exists from a previous invocation it might be
590 ;; read-only. 594 ;; read-only.
791 (buffer-substring-no-properties 795 (buffer-substring-no-properties
792 (point) 796 (point)
793 (progn (forward-line 1) (1- (point))))))))) 797 (progn (forward-line 1) (1- (point)))))))))
794 (or (vc-git-symbolic-commit next-rev) next-rev))) 798 (or (vc-git-symbolic-commit next-rev) next-rev)))
795 799
796 (declare-function log-edit-mode "log-edit" ())
797 (defvar log-edit-extra-flags)
798 (defvar log-edit-before-checkin-process)
799
800 (define-derived-mode vc-git-log-edit-mode log-edit-mode "Git-log-edit"
801 "Mode for editing Git commit logs.
802 If a line like:
803 Author: NAME
804 is present in the log, it is removed, and
805 --author=NAME
806 is passed to the git commit command."
807 (set (make-local-variable 'log-edit-extra-flags) nil)
808 (set (make-local-variable 'log-edit-before-checkin-process)
809 '(("^Author:[ \t]+\\(.*\\)[ \t]*$" . (list "--author" (match-string 1))))))
810
811 (defun vc-git-delete-file (file) 800 (defun vc-git-delete-file (file)
812 (vc-git-command nil 0 file "rm" "-f" "--")) 801 (vc-git-command nil 0 file "rm" "-f" "--"))
813 802
814 (defun vc-git-rename-file (old new) 803 (defun vc-git-rename-file (old new)
815 (vc-git-command nil 0 (list old new) "mv" "-f" "--")) 804 (vc-git-command nil 0 (list old new) "mv" "-f" "--"))