aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc-hg.el
diff options
context:
space:
mode:
authorChong Yidong <[email protected]>2010-10-31 23:13:42 -0400
committerChong Yidong <[email protected]>2010-10-31 23:13:42 -0400
commit98cfec0d6935f25a54852caaa33112ea1ca4634b (patch)
tree95822bce29eaee01ee15f79a24405489e2eaf8d5 /lisp/vc-hg.el
parent6aad7ea061dac5966904f6a6b4f36816d9c87d10 (diff)
Backport VC improvements from trunk.
* vc/log-edit.el (log-edit-rewrite-fixes): New var. (log-edit-author): New dynamic var. (log-edit-changelog-ours-p, log-edit-insert-changelog-entries): Use it to return the author if different from committer. (log-edit-insert-changelog): Use them to add Author: and Fixes headers. * vc/vc-hooks.el (vc-default-mode-line-string): Doc fix. * vc/vc.el (vc-deduce-backend): New fun. Handle diff buffers. (vc-root-diff, vc-print-root-log, vc-log-incoming) (vc-log-outgoing): Use it. (vc-diff-internal): Set diff-vc-backend. * vc/diff-mode.el (diff-vc-backend): New var. * vc/vc.el (vc-diff-internal): Set `revert-buffer-function' buffer-locally to lambda that re-runs the vc diff command. (Bug#6447) * vc/log-view.el (log-view-mode-map): Bind revert-buffer. Make 'g' (AKA revert-buffer) rerun VC log, log-incoming and log-outgoing commands. * vc/vc.el (vc-log-internal-common): Add a new argument and use it to create a buffer local revert-buffer-function variable. (vc-print-log-internal, vc-log-incoming, vc-log-outgoing): Pass a revert-buffer-function lambda. Improve VC create/retrieve tag/branch. * vc.el (vc-create-tag): Do not read the directory name for VCs with repository revision granularity. Adjust the tag/branch prompt. Reset VC properties. (vc-retrieve-tag): Do not read the directory name for VCs with repository revision granularity. Reset VC properties. Add optional support for resetting VC properties. * vc-dispatcher.el (vc-resynch-window): Add new optional argument, call vc-file-clearprops when true. (vc-resynch-buffer): Add new optional argument, pass it down. (vc-resynch-buffers-in-directory): Likewise. Improve support for special markup in the VC commit message. * vc-mtn.el (vc-mtn-checkin): Support Author: and Date: markup. * vc-hg.el (vc-hg-checkin): Add support for Date:. * vc-git.el (vc-git-checkin): * vc-bzr.el (vc-bzr-checkin): Likewise. Add support for vc-log-incoming, improve vc-log-outgoing for Git. * vc-git.el (vc-git-log-view-mode): Fix font lock for incoming/outgoing logs. (vc-git-log-outgoing, vc-git-log-incoming): New functions. * vc-git.el (vc-git-log-outgoing): Use the same format as the short log. (vc-git-log-incoming): Likewise. Run "git fetch" before the log command Add bindings for vc-log-incoming and vc-log-outgoing. * vc-hooks.el (vc-prefix-map): Add bindings for vc-log-incoming and vc-log-outgoing. * vc-dir.el (vc-dir-menu-map): Add menu bindings for vc-log-incoming and vc-log-outgoing. Improve state updating for VC tag commands. * vc.el (vc-create-tag, vc-retrieve-tag): Call vc-resynch-buffer to update the state of all buffers in the directory. * vc-dir.el (vc-dir): Don't pop-up-windows. (Bug#6204) * 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-git.el (vc-git-checkin): 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-bzr.el (vc-bzr-checkin): Use log-edit-extract-headers. (vc-bzr-conflicted-files): New function. * log-edit.el (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-edit-extract-headers): New function to replace it. * vc-dispatcher.el (vc-finish-logentry): Don't mess so badly with the windows/frames. * vc-bzr.el (vc-bzr-shelve-apply): Don't use *vc-bzr-shelve*. * vc-dir.el (vc-dir-kill-line): New command. (vc-dir-mode-map): Bind it to C-k. (vc-dir-headers): Abbreviate the working dir. * vc-git.el (vc-git-revision-table): Include remote branches. New VC methods: vc-log-incoming and vc-log-outgoing. * vc.el (vc-print-log-setup-buttons, vc-log-internal-common) (vc-incoming-outgoing-internal, vc-log-incoming, vc-log-outgoing): New functions. (vc-print-log-internal): Just call vc-log-internal-common. (vc-log-view-type): New permanent local variable. * vc-hooks.el (vc-menu-map): Bind vc-log-incoming and vc-log-outgoing. * vc-bzr.el (vc-bzr-log-view-mode): Use vc-log-view-type instead of the dynamic bound vc-short-log. (vc-bzr-log-incoming, vc-bzr-log-outgoing): New functions. * vc-git.el (vc-git-log-outgoing): New function. (vc-git-log-view-mode): Use vc-log-view-type instead of the dynamic bound vc-short-log. * vc-hg.el (vc-hg-log-view-mode): Use vc-log-view-type instead of the dynamic bound vc-short-log. Highlight the tag. (vc-hg-log-incoming, vc-hg-log-outgoing): New functions. (vc-hg-outgoing, vc-hg-incoming, vc-hg-outgoing-mode): (vc-hg-incoming-mode): Remove. (vc-hg-extra-menu-map): Do not bind vc-hg-incoming and vc-hg-outgoing. Fix default-directory for vc-root-diff. * vc.el (vc-root-diff): Bind default-directory to the root directory for the diff command. * vc-hg.el (vc-hg-push, vc-hg-pull): Use `apply' when calling `vc-hg-command' with a list of flags. * vc-bzr.el (vc-bzr-log-edit-mode): Add --fixes support to log-edit-before-checkin-process. * vc.el (vc-modify-change-comment): Pass MODE to vc-start-logentry. * vc-bzr.el, vc-hg.el (log-edit-mode): Declare. * vc-dispatcher.el (vc-start-logentry): Doc fix. (log-view-process-buffer, log-edit-extra-flags): Declare. Add special markup processing for commit logs. * log-edit.el (log-edit): Add new argument MODE. Use that mode when non-nil instead of the log-view-mode. * vc.el (vc-default-log-edit-mode): New function. * vc-dispatcher.el (vc-log-edit): Add a mode argument, pass it to log-edit. Support for shelving snapshots and for showing shelves. * vc-bzr.el (vc-bzr-shelve-show, vc-bzr-shelve-show-at-point) (vc-bzr-shelve-apply-and-keep-at-point, vc-bzr-shelve-snapshot): New functions. (vc-bzr-shelve-map, vc-bzr-shelve-menu-map) (vc-bzr-extra-menu-map): Map them.
Diffstat (limited to 'lisp/vc-hg.el')
-rw-r--r--lisp/vc-hg.el89
1 files changed, 33 insertions, 56 deletions
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index b29f229e26..2339f887a3 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -256,33 +256,33 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(with-current-buffer
buffer
(apply 'vc-hg-command buffer 0 files "log"
- (append
+ (nconc
(when start-revision (list (format "-r%s:" start-revision)))
(when limit (list "-l" (format "%s" limit)))
- (when shortlog '("--style" "compact"))
+ (when shortlog (list "--style" "compact"))
vc-hg-log-switches)))))
(defvar log-view-message-re)
(defvar log-view-file-re)
(defvar log-view-font-lock-keywords)
(defvar log-view-per-file-logs)
-(defvar vc-short-log)
(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
(require 'add-log) ;; we need the add-log faces
(set (make-local-variable 'log-view-file-re) "\\`a\\`")
(set (make-local-variable 'log-view-per-file-logs) nil)
(set (make-local-variable 'log-view-message-re)
- (if vc-short-log
- "^\\([0-9]+\\)\\(?:\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$"
+ (if (eq vc-log-view-type 'short)
+ "^\\([0-9]+\\)\\(\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$"
"^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)"))
(set (make-local-variable 'log-view-font-lock-keywords)
- (if vc-short-log
+ (if (eq vc-log-view-type 'short)
(append `((,log-view-message-re
(1 'log-view-message-face)
- (2 'log-view-message-face)
- (3 'change-log-date)
- (4 'change-log-name))))
+ (2 'highlight nil lax)
+ (3 'log-view-message-face)
+ (4 'change-log-date)
+ (5 'change-log-name))))
(append
log-view-font-lock-keywords
'(
@@ -298,7 +298,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
(1 'change-log-email))
("^date: \\(.+\\)" (1 'change-log-date))
- ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
+ ("^tag: +\\([^ ]+\\)$" (1 'highlight))
+ ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
(defun vc-hg-diff (files &optional oldvers newvers buffer)
"Get a difference report using hg between two revisions of FILES."
@@ -423,10 +424,16 @@ COMMENT is ignored."
;; "Unregister FILE from hg."
;; (vc-hg-command nil nil file "remove"))
+(declare-function log-edit-extract-headers "log-edit" (headers string))
+
(defun vc-hg-checkin (files rev comment)
"Hg-specific version of `vc-backend-checkin'.
REV is ignored."
- (vc-hg-command nil 0 files "commit" "-m" comment))
+ (apply 'vc-hg-command nil 0 files
+ (nconc (list "commit" "-m")
+ (log-edit-extract-headers '(("Author" . "--user")
+ ("Date" . "--date"))
+ comment))))
(defun vc-hg-find-revision (file rev buffer)
(let ((coding-system-for-read 'binary)
@@ -460,8 +467,6 @@ REV is the revision to check out into WORKFILE."
(defvar vc-hg-extra-menu-map
(let ((map (make-sparse-keymap)))
- (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
- (define-key map [outgoing] '(menu-item "Show outgoing" vc-hg-outgoing))
map))
(defun vc-hg-extra-menu () vc-hg-extra-menu-map)
@@ -470,14 +475,6 @@ REV is the revision to check out into WORKFILE."
(defvar log-view-vc-backend)
-(define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing"
- "Mode for browsing Hg outgoing changes."
- (set (make-local-variable 'log-view-vc-backend) 'Hg))
-
-(define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming"
- "Mode for browsing Hg incoming changes."
- (set (make-local-variable 'log-view-vc-backend) 'Hg))
-
(defstruct (vc-hg-extra-fileinfo
(:copier nil)
(:constructor vc-hg-create-extra-fileinfo (rename-state extra-name))
@@ -583,33 +580,13 @@ REV is the revision to check out into WORKFILE."
;; (vc-hg-dir-extra-header "Global id : " "id" "-i")
)))
-;; FIXME: this adds another top level menu, instead figure out how to
-;; replace the Log-View menu.
-(easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map
- "Hg-outgoing Display Menu"
- `("Hg-outgoing"
- ["Push selected" vc-hg-push]))
-
-(easy-menu-define log-view-mode-menu vc-hg-incoming-mode-map
- "Hg-incoming Display Menu"
- `("Hg-incoming"
- ["Pull selected" vc-hg-pull]))
+(defun vc-hg-log-incoming (buffer remote-location)
+ (vc-hg-command buffer 1 nil "incoming" "-n" (unless (string= remote-location "")
+ remote-location)))
-(defun vc-hg-outgoing ()
- (interactive)
- (let ((bname "*Hg outgoing*")
- (vc-short-log nil))
- (vc-hg-command bname 1 nil "outgoing" "-n")
- (pop-to-buffer bname)
- (vc-hg-outgoing-mode)))
-
-(defun vc-hg-incoming ()
- (interactive)
- (let ((bname "*Hg incoming*")
- (vc-short-log nil))
- (vc-hg-command bname 0 nil "incoming" "-n")
- (pop-to-buffer bname)
- (vc-hg-incoming-mode)))
+(defun vc-hg-log-outgoing (buffer remote-location)
+ (vc-hg-command buffer 1 nil "outgoing" "-n" (unless (string= remote-location "")
+ remote-location)))
(declare-function log-view-get-marked "log-view" ())
@@ -618,22 +595,22 @@ REV is the revision to check out into WORKFILE."
(interactive)
(let ((marked-list (log-view-get-marked)))
(if marked-list
- (vc-hg-command
- nil 0 nil
- (cons "push"
+ (apply #'vc-hg-command
+ nil 0 nil
+ "push"
(apply 'nconc
- (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
- (error "No log entries selected for push"))))
+ (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
+ (error "No log entries selected for push"))))
(defun vc-hg-pull ()
(interactive)
(let ((marked-list (log-view-get-marked)))
(if marked-list
- (vc-hg-command
- nil 0 nil
- (cons "pull"
+ (apply #'vc-hg-command
+ nil 0 nil
+ "pull"
(apply 'nconc
- (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
+ (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
(error "No log entries selected for pull"))))
;;; Internal functions