diff options
| author | Dan Nicolaescu | 2010-03-19 02:37:41 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-03-19 02:37:41 -0700 |
| commit | 09158997b552e31323410a8bfaa5a58a1a94b072 (patch) | |
| tree | 0e60de0711fe152bb49435db5877fef172d824b6 | |
| parent | f430423d720bb4c3a36e828999e5cdb675b29579 (diff) | |
| download | emacs-09158997b552e31323410a8bfaa5a58a1a94b072.tar.gz emacs-09158997b552e31323410a8bfaa5a58a1a94b072.zip | |
Add special markup processing for commit logs.
* log-edit.el (log-edit-extra-flags): New variable.
(log-edit): Add new argument MODE. Use that mode when non-nil
instead of the log-view-mode.
(log-view-process-buffer): New function.
* vc.el: Document that the checkin method takes optional
arguments. Document new backend specific method: log-view-mode.
(vc-default-log-edit-mode): New function.
(vc-checkin): Use a backend specific log-view-mode.
Pass extra arguments to the checkin method.
(vc-modify-change-comment): Pass a dummy extra argument.
* vc-dispatcher.el (vc-log-edit): Add a mode argument, pass it to
log-edit.
(vc-start-logentry): Add a mode argument, pass it to vc-log-edit.
(vc-finish-logentry): Process the log buffer before passing it
down. Pass log-edit-extra-flags.
* vc-bzr.el (vc-bzr-checkin): Pass extra arguments to the commit
command.
(log-edit-extra-flags, log-edit-before-checkin-process): New declarations.
* vc-hg.el (vc-hg-checkin): Pass extra arguments to the commit
command.
(log-edit-extra-flags, log-edit-before-checkin-process): New declarations.
(vc-hg-log-edit-mode): New derived mode.
* vc-arch.el (vc-arch-checkin):
* vc-cvs.el (vc-cvs-checkin):
* vc-git.el (vc-git-checkin):
* vc-mtn.el (vc-mtn-checkin):
* vc-rcs.el (vc-rcs-checkin):
* vc-sccs.el (vc-sccs-checkin):
* vc-svn.el (vc-svn-checkin): Add an optional ignored argument.
| -rw-r--r-- | etc/NEWS | 10 | ||||
| -rw-r--r-- | lisp/ChangeLog | 38 | ||||
| -rw-r--r-- | lisp/log-edit.el | 39 | ||||
| -rw-r--r-- | lisp/vc-arch.el | 2 | ||||
| -rw-r--r-- | lisp/vc-bzr.el | 18 | ||||
| -rw-r--r-- | lisp/vc-cvs.el | 2 | ||||
| -rw-r--r-- | lisp/vc-dispatcher.el | 18 | ||||
| -rw-r--r-- | lisp/vc-git.el | 2 | ||||
| -rw-r--r-- | lisp/vc-hg.el | 18 | ||||
| -rw-r--r-- | lisp/vc-mtn.el | 2 | ||||
| -rw-r--r-- | lisp/vc-rcs.el | 2 | ||||
| -rw-r--r-- | lisp/vc-sccs.el | 2 | ||||
| -rw-r--r-- | lisp/vc-svn.el | 2 | ||||
| -rw-r--r-- | lisp/vc.el | 19 |
14 files changed, 151 insertions, 23 deletions
| @@ -63,6 +63,16 @@ choose a color via list-colors-display. | |||
| 63 | 63 | ||
| 64 | *** vc-dir for Bzr supports viewing shelve contents and shelving snapshots. | 64 | *** vc-dir for Bzr supports viewing shelve contents and shelving snapshots. |
| 65 | 65 | ||
| 66 | *** Special markup can be added to log-edit buffers. | ||
| 67 | |||
| 68 | **** For Bzr, adding an | ||
| 69 | Author: NAME | ||
| 70 | line will add "--author NAME" to the "bzr commit" command. | ||
| 71 | |||
| 72 | **** For Hg, adding an | ||
| 73 | Author: NAME | ||
| 74 | line will add "--user NAME" to the "hg commit" command. | ||
| 75 | |||
| 66 | ** Directory local variables can apply to file-less buffers. | 76 | ** Directory local variables can apply to file-less buffers. |
| 67 | For example, adding "(diff-mode . ((mode . whitespace)))" to your | 77 | For example, adding "(diff-mode . ((mode . whitespace)))" to your |
| 68 | .dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* | 78 | .dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3ff90f20d21..66065601219 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,41 @@ | |||
| 1 | 2010-03-19 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | Add special markup processing for commit logs. | ||
| 4 | * log-edit.el (log-edit-extra-flags): New variable. | ||
| 5 | (log-edit): Add new argument MODE. Use that mode when non-nil | ||
| 6 | instead of the log-view-mode. | ||
| 7 | (log-view-process-buffer): New function. | ||
| 8 | |||
| 9 | * vc.el: Document that the checkin method takes optional | ||
| 10 | arguments. Document new backend specific method: log-view-mode. | ||
| 11 | (vc-default-log-edit-mode): New function. | ||
| 12 | (vc-checkin): Use a backend specific log-view-mode. | ||
| 13 | Pass extra arguments to the checkin method. | ||
| 14 | (vc-modify-change-comment): Pass a dummy extra argument. | ||
| 15 | |||
| 16 | * vc-dispatcher.el (vc-log-edit): Add a mode argument, pass it to | ||
| 17 | log-edit. | ||
| 18 | (vc-start-logentry): Add a mode argument, pass it to vc-log-edit. | ||
| 19 | (vc-finish-logentry): Process the log buffer before passing it | ||
| 20 | down. Pass log-edit-extra-flags. | ||
| 21 | |||
| 22 | * vc-bzr.el (vc-bzr-checkin): Pass extra arguments to the commit | ||
| 23 | command. | ||
| 24 | (log-edit-extra-flags, log-edit-before-checkin-process): New declarations. | ||
| 25 | |||
| 26 | * vc-hg.el (vc-hg-checkin): Pass extra arguments to the commit | ||
| 27 | command. | ||
| 28 | (log-edit-extra-flags, log-edit-before-checkin-process): New declarations. | ||
| 29 | (vc-hg-log-edit-mode): New derived mode. | ||
| 30 | |||
| 31 | * vc-arch.el (vc-arch-checkin): | ||
| 32 | * vc-cvs.el (vc-cvs-checkin): | ||
| 33 | * vc-git.el (vc-git-checkin): | ||
| 34 | * vc-mtn.el (vc-mtn-checkin): | ||
| 35 | * vc-rcs.el (vc-rcs-checkin): | ||
| 36 | * vc-sccs.el (vc-sccs-checkin): | ||
| 37 | * vc-svn.el (vc-svn-checkin): Add an optional ignored argument. | ||
| 38 | |||
| 1 | 2010-03-19 Stefan Monnier <monnier@iro.umontreal.ca> | 39 | 2010-03-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 40 | ||
| 3 | * outline.el (hide-sublevels): Don't hide trailing newline (and fix | 41 | * outline.el (hide-sublevels): Don't hide trailing newline (and fix |
diff --git a/lisp/log-edit.el b/lisp/log-edit.el index e26521642da..57f79bd4b13 100644 --- a/lisp/log-edit.el +++ b/lisp/log-edit.el | |||
| @@ -188,6 +188,25 @@ when this variable is set to nil.") | |||
| 188 | (defvar log-edit-callback nil) | 188 | (defvar log-edit-callback nil) |
| 189 | (defvar log-edit-diff-function nil) | 189 | (defvar log-edit-diff-function nil) |
| 190 | (defvar log-edit-listfun nil) | 190 | (defvar log-edit-listfun nil) |
| 191 | (defvar log-edit-extra-flags nil | ||
| 192 | "List of extra flags to pass to the check in command.") | ||
| 193 | (defvar log-edit-before-checkin-process nil | ||
| 194 | "Alist that contains instructions for processing the commit message before check in. | ||
| 195 | |||
| 196 | The format is: (REGEXP . INSTRUCTIONS). | ||
| 197 | |||
| 198 | All lines matching REGEXP are removed. | ||
| 199 | |||
| 200 | For example: | ||
| 201 | |||
| 202 | (\"^#.*\" . nil) | ||
| 203 | means: just remove all lines starting with #. This can be used | ||
| 204 | to insert lines in the commit buffer that contain, for example, the | ||
| 205 | list of files to be committed. | ||
| 206 | |||
| 207 | (\"Author: \\(.*\\)\" . (list \"--author\" (match-string 1))) | ||
| 208 | means: append (list \"--author\" (match-string 1)) to | ||
| 209 | `log-edit-extra-flags'.") | ||
| 191 | (defvar log-edit-parent-buffer nil) | 210 | (defvar log-edit-parent-buffer nil) |
| 192 | 211 | ||
| 193 | ;;; Originally taken from VC-Log mode | 212 | ;;; Originally taken from VC-Log mode |
| @@ -318,9 +337,10 @@ automatically." | |||
| 318 | (2 font-lock-function-name-face)))) | 337 | (2 font-lock-function-name-face)))) |
| 319 | 338 | ||
| 320 | ;;;###autoload | 339 | ;;;###autoload |
| 321 | (defun log-edit (callback &optional setup params buffer &rest ignore) | 340 | (defun log-edit (callback &optional setup params buffer mode &rest ignore) |
| 322 | "Setup a buffer to enter a log message. | 341 | "Setup a buffer to enter a log message. |
| 323 | \\<log-edit-mode-map>The buffer will be put in `log-edit-mode'. | 342 | \\<log-edit-mode-map>The buffer will be put in mode MODE or `log-edit-mode' |
| 343 | if MODE is nil. | ||
| 324 | If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run. | 344 | If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run. |
| 325 | Mark and point will be set around the entire contents of the buffer so | 345 | Mark and point will be set around the entire contents of the buffer so |
| 326 | that it is easy to kill the contents of the buffer with \\[kill-region]. | 346 | that it is easy to kill the contents of the buffer with \\[kill-region]. |
| @@ -341,7 +361,9 @@ uses the current buffer." | |||
| 341 | (when (and log-edit-setup-invert (not (eq setup 'force))) | 361 | (when (and log-edit-setup-invert (not (eq setup 'force))) |
| 342 | (setq setup (not setup))) | 362 | (setq setup (not setup))) |
| 343 | (when setup (erase-buffer)) | 363 | (when setup (erase-buffer)) |
| 344 | (log-edit-mode) | 364 | (if mode |
| 365 | (funcall mode) | ||
| 366 | (log-edit-mode)) | ||
| 345 | (set (make-local-variable 'log-edit-callback) callback) | 367 | (set (make-local-variable 'log-edit-callback) callback) |
| 346 | (if (listp params) | 368 | (if (listp params) |
| 347 | (dolist (crt params) | 369 | (dolist (crt params) |
| @@ -711,6 +733,17 @@ Sort REGIONS front-to-back first." | |||
| 711 | (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry)) | 733 | (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry)) |
| 712 | (when (cdr buffer-entry) (newline))))) | 734 | (when (cdr buffer-entry) (newline))))) |
| 713 | 735 | ||
| 736 | (defun log-view-process-buffer () | ||
| 737 | (when log-edit-before-checkin-process | ||
| 738 | (dolist (crt log-edit-before-checkin-process) | ||
| 739 | ;; Remove all lines matching (car crt) | ||
| 740 | ;; Append to `log-edit-extra-flags' the results of (cdr crt). | ||
| 741 | (goto-char (point-min)) | ||
| 742 | (while (re-search-forward (car crt) nil t) | ||
| 743 | (when (cdr crt) | ||
| 744 | (setq log-edit-extra-flags (append log-edit-extra-flags (eval (cdr crt))))) | ||
| 745 | (replace-match "" nil t))))) | ||
| 746 | |||
| 714 | (provide 'log-edit) | 747 | (provide 'log-edit) |
| 715 | 748 | ||
| 716 | ;; arch-tag: 8089b39c-983b-4e83-93cd-ed0a64c7fdcc | 749 | ;; arch-tag: 8089b39c-983b-4e83-93cd-ed0a64c7fdcc |
diff --git a/lisp/vc-arch.el b/lisp/vc-arch.el index b99c3de6875..80629ec0b4b 100644 --- a/lisp/vc-arch.el +++ b/lisp/vc-arch.el | |||
| @@ -428,7 +428,7 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see | |||
| 428 | (message "There are unresolved conflicts in %s" | 428 | (message "There are unresolved conflicts in %s" |
| 429 | (file-name-nondirectory rej)))))) | 429 | (file-name-nondirectory rej)))))) |
| 430 | 430 | ||
| 431 | (defun vc-arch-checkin (files rev comment) | 431 | (defun vc-arch-checkin (files rev comment &optional extra-args-ignored) |
| 432 | (if rev (error "Committing to a specific revision is unsupported")) | 432 | (if rev (error "Committing to a specific revision is unsupported")) |
| 433 | ;; FIXME: This implementation probably only works for singleton filesets | 433 | ;; FIXME: This implementation probably only works for singleton filesets |
| 434 | (let ((summary (file-relative-name (car files) (vc-arch-root (car files))))) | 434 | (let ((summary (file-relative-name (car files) (vc-arch-root (car files))))) |
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index 75845f0aa2c..9e13ca6320d 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el | |||
| @@ -451,11 +451,11 @@ or a superior directory.") | |||
| 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) | 454 | (defun vc-bzr-checkin (files rev comment &optional extra-args) |
| 455 | "Check FILE in to bzr with log message COMMENT. | 455 | "Check FILE in to bzr with log message COMMENT. |
| 456 | REV non-nil gets an error." | 456 | REV non-nil gets an error." |
| 457 | (if rev (error "Can't check in a specific revision with bzr")) | 457 | (if rev (error "Can't check in a specific revision with bzr")) |
| 458 | (vc-bzr-command "commit" nil 0 files "-m" comment)) | 458 | (apply 'vc-bzr-command "commit" nil 0 files (append (list "-m" comment) extra-args))) |
| 459 | 459 | ||
| 460 | (defun vc-bzr-find-revision (file rev buffer) | 460 | (defun vc-bzr-find-revision (file rev buffer) |
| 461 | "Fetch revision REV of file FILE and put it into BUFFER." | 461 | "Fetch revision REV of file FILE and put it into BUFFER." |
| @@ -545,6 +545,20 @@ REV non-nil gets an error." | |||
| 545 | (goto-char (point-min))) | 545 | (goto-char (point-min))) |
| 546 | found))) | 546 | found))) |
| 547 | 547 | ||
| 548 | (defvar log-edit-extra-flags) | ||
| 549 | (defvar log-edit-before-checkin-process) | ||
| 550 | |||
| 551 | (define-derived-mode vc-bzr-log-edit-mode log-edit-mode "Bzr-Log-Edit" | ||
| 552 | "Mode for editing Bzr commit logs. | ||
| 553 | If a line like: | ||
| 554 | Author: NAME | ||
| 555 | is present in the log, it is removed, and | ||
| 556 | --author NAME | ||
| 557 | is passed to the bzr commit command." | ||
| 558 | (set (make-local-variable 'log-edit-extra-flags) nil) | ||
| 559 | (set (make-local-variable 'log-edit-before-checkin-process) | ||
| 560 | '(("^Author:[ \t]+\\(.*\\)[ \t]*$" . (list "--author" (match-string 1)))))) | ||
| 561 | |||
| 548 | (defun vc-bzr-diff (files &optional rev1 rev2 buffer) | 562 | (defun vc-bzr-diff (files &optional rev1 rev2 buffer) |
| 549 | "VC bzr backend for diff." | 563 | "VC bzr backend for diff." |
| 550 | ;; `bzr diff' exits with code 1 if diff is non-empty. | 564 | ;; `bzr diff' exits with code 1 if diff is non-empty. |
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 1abef9f48b8..8f9d07723d8 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el | |||
| @@ -313,7 +313,7 @@ its parents." | |||
| 313 | (directory-file-name dir)))) | 313 | (directory-file-name dir)))) |
| 314 | (eq dir t))) | 314 | (eq dir t))) |
| 315 | 315 | ||
| 316 | (defun vc-cvs-checkin (files rev comment) | 316 | (defun vc-cvs-checkin (files rev comment &optional extra-args-ignored) |
| 317 | "CVS-specific version of `vc-backend-checkin'." | 317 | "CVS-specific version of `vc-backend-checkin'." |
| 318 | (unless (or (not rev) (vc-cvs-valid-revision-number-p rev)) | 318 | (unless (or (not rev) (vc-cvs-valid-revision-number-p rev)) |
| 319 | (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) | 319 | (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) |
diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el index 40223c9010d..8e6f5d5a1be 100644 --- a/lisp/vc-dispatcher.el +++ b/lisp/vc-dispatcher.el | |||
| @@ -522,20 +522,22 @@ NOT-URGENT means it is ok to continue if the user says not to save." | |||
| 522 | 522 | ||
| 523 | ;; Set up key bindings for use while editing log messages | 523 | ;; Set up key bindings for use while editing log messages |
| 524 | 524 | ||
| 525 | (defun vc-log-edit (fileset) | 525 | (defun vc-log-edit (fileset mode) |
| 526 | "Set up `log-edit' for use on FILE." | 526 | "Set up `log-edit' for use on FILE." |
| 527 | (setq default-directory | 527 | (setq default-directory |
| 528 | (with-current-buffer vc-parent-buffer default-directory)) | 528 | (with-current-buffer vc-parent-buffer default-directory)) |
| 529 | (log-edit 'vc-finish-logentry | 529 | (log-edit 'vc-finish-logentry |
| 530 | nil | 530 | nil |
| 531 | `((log-edit-listfun . (lambda () ',fileset)) | 531 | `((log-edit-listfun . (lambda () ',fileset)) |
| 532 | (log-edit-diff-function . (lambda () (vc-diff nil))))) | 532 | (log-edit-diff-function . (lambda () (vc-diff nil)))) |
| 533 | nil | ||
| 534 | mode) | ||
| 533 | (set (make-local-variable 'vc-log-fileset) fileset) | 535 | (set (make-local-variable 'vc-log-fileset) fileset) |
| 534 | (make-local-variable 'vc-log-extra) | 536 | (make-local-variable 'vc-log-extra) |
| 535 | (set-buffer-modified-p nil) | 537 | (set-buffer-modified-p nil) |
| 536 | (setq buffer-file-name nil)) | 538 | (setq buffer-file-name nil)) |
| 537 | 539 | ||
| 538 | (defun vc-start-logentry (files extra comment initial-contents msg logbuf action &optional after-hook) | 540 | (defun vc-start-logentry (files extra comment initial-contents msg logbuf mode action &optional after-hook) |
| 539 | "Accept a comment for an operation on FILES with extra data EXTRA. | 541 | "Accept a comment for an operation on FILES with extra data EXTRA. |
| 540 | If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the | 542 | If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the |
| 541 | action on close to ACTION. If COMMENT is a string and | 543 | action on close to ACTION. If COMMENT is a string and |
| @@ -560,7 +562,7 @@ for `vc-log-after-operation-hook'." | |||
| 560 | (set (make-local-variable 'vc-parent-buffer) parent) | 562 | (set (make-local-variable 'vc-parent-buffer) parent) |
| 561 | (set (make-local-variable 'vc-parent-buffer-name) | 563 | (set (make-local-variable 'vc-parent-buffer-name) |
| 562 | (concat " from " (buffer-name vc-parent-buffer))) | 564 | (concat " from " (buffer-name vc-parent-buffer))) |
| 563 | (vc-log-edit files) | 565 | (vc-log-edit files mode) |
| 564 | (make-local-variable 'vc-log-after-operation-hook) | 566 | (make-local-variable 'vc-log-after-operation-hook) |
| 565 | (when after-hook | 567 | (when after-hook |
| 566 | (setq vc-log-after-operation-hook after-hook)) | 568 | (setq vc-log-after-operation-hook after-hook)) |
| @@ -590,12 +592,16 @@ the buffer contents as a comment." | |||
| 590 | (or (vc-dispatcher-browsing) (vc-buffer-sync))) | 592 | (or (vc-dispatcher-browsing) (vc-buffer-sync))) |
| 591 | (unless vc-log-operation | 593 | (unless vc-log-operation |
| 592 | (error "No log operation is pending")) | 594 | (error "No log operation is pending")) |
| 595 | |||
| 596 | (log-view-process-buffer) | ||
| 597 | |||
| 593 | ;; save the parameters held in buffer-local variables | 598 | ;; save the parameters held in buffer-local variables |
| 594 | (let ((logbuf (current-buffer)) | 599 | (let ((logbuf (current-buffer)) |
| 595 | (log-operation vc-log-operation) | 600 | (log-operation vc-log-operation) |
| 596 | (log-fileset vc-log-fileset) | 601 | (log-fileset vc-log-fileset) |
| 597 | (log-extra vc-log-extra) | 602 | (log-extra vc-log-extra) |
| 598 | (log-entry (buffer-string)) | 603 | (log-entry (buffer-string)) |
| 604 | (extra-flags log-edit-extra-flags) | ||
| 599 | (after-hook vc-log-after-operation-hook) | 605 | (after-hook vc-log-after-operation-hook) |
| 600 | (tmp-vc-parent-buffer vc-parent-buffer)) | 606 | (tmp-vc-parent-buffer vc-parent-buffer)) |
| 601 | (pop-to-buffer vc-parent-buffer) | 607 | (pop-to-buffer vc-parent-buffer) |
| @@ -604,7 +610,9 @@ the buffer contents as a comment." | |||
| 604 | (funcall log-operation | 610 | (funcall log-operation |
| 605 | log-fileset | 611 | log-fileset |
| 606 | log-extra | 612 | log-extra |
| 607 | log-entry)) | 613 | log-entry |
| 614 | extra-flags | ||
| 615 | )) | ||
| 608 | ;; Remove checkin window (after the checkin so that if that fails | 616 | ;; Remove checkin window (after the checkin so that if that fails |
| 609 | ;; we don't zap the log buffer and the typing therein). | 617 | ;; we don't zap the log buffer and the typing therein). |
| 610 | ;; -- IMO this should be replaced with quit-window | 618 | ;; -- IMO this should be replaced with quit-window |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index eab3b650fa4..93f9d8c6797 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -541,7 +541,7 @@ or an empty string if none." | |||
| 541 | (vc-git-command nil 0 file "rm" "-f" "--cached" "--")) | 541 | (vc-git-command nil 0 file "rm" "-f" "--cached" "--")) |
| 542 | 542 | ||
| 543 | 543 | ||
| 544 | (defun vc-git-checkin (files rev comment) | 544 | (defun vc-git-checkin (files rev comment &optional extra-args-ignored) |
| 545 | (let ((coding-system-for-write git-commits-coding-system)) | 545 | (let ((coding-system-for-write git-commits-coding-system)) |
| 546 | (vc-git-command nil 0 files "commit" | 546 | (vc-git-command nil 0 files "commit" |
| 547 | "-m" comment "--only" "--"))) | 547 | "-m" comment "--only" "--"))) |
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index b6e1d39c2ff..85d48ba0bcc 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el | |||
| @@ -279,6 +279,20 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 279 | ("^date: \\(.+\\)" (1 'change-log-date)) | 279 | ("^date: \\(.+\\)" (1 'change-log-date)) |
| 280 | ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) | 280 | ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) |
| 281 | 281 | ||
| 282 | (defvar log-edit-extra-flags) | ||
| 283 | (defvar log-edit-before-checkin-process) | ||
| 284 | |||
| 285 | (define-derived-mode vc-hg-log-edit-mode log-edit-mode "Hg-log-edit" | ||
| 286 | "Mode for editing Hg commit logs. | ||
| 287 | If a line like: | ||
| 288 | Author: NAME | ||
| 289 | is present in the log, it is removed, and | ||
| 290 | --author NAME | ||
| 291 | is passed to the hg commit command." | ||
| 292 | (set (make-local-variable 'log-edit-extra-flags) nil) | ||
| 293 | (set (make-local-variable 'log-edit-before-checkin-process) | ||
| 294 | '(("^Author:[ \t]+\\(.*\\)[ \t]*$" . (list "--user" (match-string 1)))))) | ||
| 295 | |||
| 282 | (defun vc-hg-diff (files &optional oldvers newvers buffer) | 296 | (defun vc-hg-diff (files &optional oldvers newvers buffer) |
| 283 | "Get a difference report using hg between two revisions of FILES." | 297 | "Get a difference report using hg between two revisions of FILES." |
| 284 | (let* ((firstfile (car files)) | 298 | (let* ((firstfile (car files)) |
| @@ -401,10 +415,10 @@ COMMENT is ignored." | |||
| 401 | ;; "Unregister FILE from hg." | 415 | ;; "Unregister FILE from hg." |
| 402 | ;; (vc-hg-command nil nil file "remove")) | 416 | ;; (vc-hg-command nil nil file "remove")) |
| 403 | 417 | ||
| 404 | (defun vc-hg-checkin (files rev comment) | 418 | (defun vc-hg-checkin (files rev comment &optional extra-args) |
| 405 | "Hg-specific version of `vc-backend-checkin'. | 419 | "Hg-specific version of `vc-backend-checkin'. |
| 406 | REV is ignored." | 420 | REV is ignored." |
| 407 | (vc-hg-command nil 0 files "commit" "-m" comment)) | 421 | (apply 'vc-hg-command nil 0 files (append (list "commit" "-m" comment) extra-args))) |
| 408 | 422 | ||
| 409 | (defun vc-hg-find-revision (file rev buffer) | 423 | (defun vc-hg-find-revision (file rev buffer) |
| 410 | (let ((coding-system-for-read 'binary) | 424 | (let ((coding-system-for-read 'binary) |
diff --git a/lisp/vc-mtn.el b/lisp/vc-mtn.el index db9f5eb3333..d62fd1ea8c6 100644 --- a/lisp/vc-mtn.el +++ b/lisp/vc-mtn.el | |||
| @@ -172,7 +172,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 172 | (defun vc-mtn-responsible-p (file) (vc-mtn-root file)) | 172 | (defun vc-mtn-responsible-p (file) (vc-mtn-root file)) |
| 173 | (defun vc-mtn-could-register (file) (vc-mtn-root file)) | 173 | (defun vc-mtn-could-register (file) (vc-mtn-root file)) |
| 174 | 174 | ||
| 175 | (defun vc-mtn-checkin (files rev comment) | 175 | (defun vc-mtn-checkin (files rev comment &optional extra-args-ignored) |
| 176 | (vc-mtn-command nil 0 files "commit" "-m" comment)) | 176 | (vc-mtn-command nil 0 files "commit" "-m" comment)) |
| 177 | 177 | ||
| 178 | (defun vc-mtn-find-revision (file rev buffer) | 178 | (defun vc-mtn-find-revision (file rev buffer) |
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el index 91cae8ed970..9756ec21967 100644 --- a/lisp/vc-rcs.el +++ b/lisp/vc-rcs.el | |||
| @@ -348,7 +348,7 @@ whether to remove it." | |||
| 348 | (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) | 348 | (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) |
| 349 | (delete-directory dir)))) | 349 | (delete-directory dir)))) |
| 350 | 350 | ||
| 351 | (defun vc-rcs-checkin (files rev comment) | 351 | (defun vc-rcs-checkin (files rev comment &optional extra-args-ignored) |
| 352 | "RCS-specific version of `vc-backend-checkin'." | 352 | "RCS-specific version of `vc-backend-checkin'." |
| 353 | (let ((switches (vc-switches 'RCS 'checkin))) | 353 | (let ((switches (vc-switches 'RCS 'checkin))) |
| 354 | ;; Now operate on the files | 354 | ;; Now operate on the files |
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el index 43bbda42d3f..de476ded369 100644 --- a/lisp/vc-sccs.el +++ b/lisp/vc-sccs.el | |||
| @@ -235,7 +235,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." | |||
| 235 | (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") | 235 | (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") |
| 236 | (file-name-nondirectory file))))) | 236 | (file-name-nondirectory file))))) |
| 237 | 237 | ||
| 238 | (defun vc-sccs-checkin (files rev comment) | 238 | (defun vc-sccs-checkin (files rev comment &optional extra-args-ignored) |
| 239 | "SCCS-specific version of `vc-backend-checkin'." | 239 | "SCCS-specific version of `vc-backend-checkin'." |
| 240 | (dolist (file (vc-expand-dirs files)) | 240 | (dolist (file (vc-expand-dirs files)) |
| 241 | (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) | 241 | (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) |
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index 6883556f249..cd43d425af1 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el | |||
| @@ -282,7 +282,7 @@ to the SVN command." | |||
| 282 | "Return non-nil if FILE could be registered in SVN. | 282 | "Return non-nil if FILE could be registered in SVN. |
| 283 | This is only possible if SVN is responsible for FILE's directory.") | 283 | This is only possible if SVN is responsible for FILE's directory.") |
| 284 | 284 | ||
| 285 | (defun vc-svn-checkin (files rev comment) | 285 | (defun vc-svn-checkin (files rev comment &optional extra-args-ignored) |
| 286 | "SVN-specific version of `vc-backend-checkin'." | 286 | "SVN-specific version of `vc-backend-checkin'." |
| 287 | (if rev (error "Committing to a specific revision is unsupported in SVN")) | 287 | (if rev (error "Committing to a specific revision is unsupported in SVN")) |
| 288 | (let ((status (apply | 288 | (let ((status (apply |
diff --git a/lisp/vc.el b/lisp/vc.el index 2ca36ef4e01..dee4ce9c841 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -261,7 +261,7 @@ | |||
| 261 | ;; Unregister FILE from this backend. This is only needed if this | 261 | ;; Unregister FILE from this backend. This is only needed if this |
| 262 | ;; backend may be used as a "more local" backend for temporary editing. | 262 | ;; backend may be used as a "more local" backend for temporary editing. |
| 263 | ;; | 263 | ;; |
| 264 | ;; * checkin (files rev comment) | 264 | ;; * checkin (files rev comment &optional extra-args) |
| 265 | ;; | 265 | ;; |
| 266 | ;; Commit changes in FILES to this backend. If REV is non-nil, that | 266 | ;; Commit changes in FILES to this backend. If REV is non-nil, that |
| 267 | ;; should become the new revision number (not all backends do | 267 | ;; should become the new revision number (not all backends do |
| @@ -269,6 +269,7 @@ | |||
| 269 | ;; implementation should pass the value of vc-checkin-switches to | 269 | ;; implementation should pass the value of vc-checkin-switches to |
| 270 | ;; the backend command. (Note: in older versions of VC, this | 270 | ;; the backend command. (Note: in older versions of VC, this |
| 271 | ;; command took a single file argument and not a list.) | 271 | ;; command took a single file argument and not a list.) |
| 272 | ;; EXTRA-ARGS should be passed to the backend command. | ||
| 272 | ;; | 273 | ;; |
| 273 | ;; * find-revision (file rev buffer) | 274 | ;; * find-revision (file rev buffer) |
| 274 | ;; | 275 | ;; |
| @@ -477,6 +478,12 @@ | |||
| 477 | ;; Return the revision number that follows REV for FILE, or nil if no such | 478 | ;; Return the revision number that follows REV for FILE, or nil if no such |
| 478 | ;; revision exists. | 479 | ;; revision exists. |
| 479 | ;; | 480 | ;; |
| 481 | ;; - log-edit-mode () | ||
| 482 | ;; | ||
| 483 | ;; Turn on the mode used for editing the check in log. This | ||
| 484 | ;; defaults to `log-edit-mode'. If changed, it should use a mode | ||
| 485 | ;; derived from`log-edit-mode'. | ||
| 486 | ;; | ||
| 480 | ;; - check-headers () | 487 | ;; - check-headers () |
| 481 | ;; | 488 | ;; |
| 482 | ;; Return non-nil if the current buffer contains any version headers. | 489 | ;; Return non-nil if the current buffer contains any version headers. |
| @@ -1358,7 +1365,9 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." | |||
| 1358 | files rev comment initial-contents | 1365 | files rev comment initial-contents |
| 1359 | "Enter a change comment." | 1366 | "Enter a change comment." |
| 1360 | "*VC-log*" | 1367 | "*VC-log*" |
| 1361 | (lambda (files rev comment) | 1368 | (lambda () |
| 1369 | (vc-call-backend backend 'log-edit-mode)) | ||
| 1370 | (lambda (files rev comment extra-flags) | ||
| 1362 | (message "Checking in %s..." (vc-delistify files)) | 1371 | (message "Checking in %s..." (vc-delistify files)) |
| 1363 | ;; "This log message intentionally left almost blank". | 1372 | ;; "This log message intentionally left almost blank". |
| 1364 | ;; RCS 5.7 gripes about white-space-only comments too. | 1373 | ;; RCS 5.7 gripes about white-space-only comments too. |
| @@ -1369,7 +1378,7 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." | |||
| 1369 | ;; We used to change buffers to get local value of vc-checkin-switches, | 1378 | ;; We used to change buffers to get local value of vc-checkin-switches, |
| 1370 | ;; but 'the' local buffer is not a well-defined concept for filesets. | 1379 | ;; but 'the' local buffer is not a well-defined concept for filesets. |
| 1371 | (progn | 1380 | (progn |
| 1372 | (vc-call-backend backend 'checkin files rev comment) | 1381 | (vc-call-backend backend 'checkin files rev comment extra-flags) |
| 1373 | (mapc 'vc-delete-automatic-version-backups files)) | 1382 | (mapc 'vc-delete-automatic-version-backups files)) |
| 1374 | `((vc-state . up-to-date) | 1383 | `((vc-state . up-to-date) |
| 1375 | (vc-checkout-time . ,(nth 5 (file-attributes file))) | 1384 | (vc-checkout-time . ,(nth 5 (file-attributes file))) |
| @@ -1739,7 +1748,7 @@ The headers are reset to their non-expanded form." | |||
| 1739 | files rev oldcomment t | 1748 | files rev oldcomment t |
| 1740 | "Enter a replacement change comment." | 1749 | "Enter a replacement change comment." |
| 1741 | "*VC-log*" | 1750 | "*VC-log*" |
| 1742 | (lambda (files rev comment) | 1751 | (lambda (files rev comment ignored) |
| 1743 | (vc-call-backend | 1752 | (vc-call-backend |
| 1744 | ;; Less of a kluge than it looks like; log-view mode only passes | 1753 | ;; Less of a kluge than it looks like; log-view mode only passes |
| 1745 | ;; this function a singleton list. Arguments left in this form in | 1754 | ;; this function a singleton list. Arguments left in this form in |
| @@ -2424,6 +2433,8 @@ to provide the `find-revision' operation instead." | |||
| 2424 | 2433 | ||
| 2425 | (defalias 'vc-default-check-headers 'ignore) | 2434 | (defalias 'vc-default-check-headers 'ignore) |
| 2426 | 2435 | ||
| 2436 | (defun vc-default-log-edit-mode (backend) (log-edit-mode)) | ||
| 2437 | |||
| 2427 | (defun vc-default-log-view-mode (backend) (log-view-mode)) | 2438 | (defun vc-default-log-view-mode (backend) (log-view-mode)) |
| 2428 | 2439 | ||
| 2429 | (defun vc-default-show-log-entry (backend rev) | 2440 | (defun vc-default-show-log-entry (backend rev) |