Mercurial > emacs
comparison lisp/vc-hg.el @ 107795:d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
* vc.el (vc-print-log-setup-buttons): New function split out from
vc-print-log-internal.
(vc-log-internal-common): New function, a parametrized version of
vc-print-log-internal.
(vc-print-log-internal): Just call vc-log-internal-common with the
right arguments.
(vc-incoming-outgoing-internal):
(vc-log-incoming, vc-log-outgoing): New functions.
(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.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Tue, 06 Apr 2010 22:56:35 -0700 |
parents | 94a453a3e40a |
children | c168d4537385 |
comparison
equal
deleted
inserted
replaced
107794:c4daeb1eaaf1 | 107795:d47e1fb98df3 |
---|---|
243 | 243 |
244 (defvar log-view-message-re) | 244 (defvar log-view-message-re) |
245 (defvar log-view-file-re) | 245 (defvar log-view-file-re) |
246 (defvar log-view-font-lock-keywords) | 246 (defvar log-view-font-lock-keywords) |
247 (defvar log-view-per-file-logs) | 247 (defvar log-view-per-file-logs) |
248 (defvar vc-short-log) | |
249 | 248 |
250 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" | 249 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" |
251 (require 'add-log) ;; we need the add-log faces | 250 (require 'add-log) ;; we need the add-log faces |
252 (set (make-local-variable 'log-view-file-re) "\\`a\\`") | 251 (set (make-local-variable 'log-view-file-re) "\\`a\\`") |
253 (set (make-local-variable 'log-view-per-file-logs) nil) | 252 (set (make-local-variable 'log-view-per-file-logs) nil) |
254 (set (make-local-variable 'log-view-message-re) | 253 (set (make-local-variable 'log-view-message-re) |
255 (if vc-short-log | 254 (if (eq vc-log-view-type 'short) |
256 "^\\([0-9]+\\)\\(?:\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$" | 255 "^\\([0-9]+\\)\\(\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$" |
257 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")) | 256 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")) |
258 (set (make-local-variable 'log-view-font-lock-keywords) | 257 (set (make-local-variable 'log-view-font-lock-keywords) |
259 (if vc-short-log | 258 (if (eq vc-log-view-type 'short) |
260 (append `((,log-view-message-re | 259 (append `((,log-view-message-re |
261 (1 'log-view-message-face) | 260 (1 'log-view-message-face) |
262 (2 'log-view-message-face) | 261 (2 'highlight nil lax) |
263 (3 'change-log-date) | 262 (3 'log-view-message-face) |
264 (4 'change-log-name)))) | 263 (4 'change-log-date) |
264 (5 'change-log-name)))) | |
265 (append | 265 (append |
266 log-view-font-lock-keywords | 266 log-view-font-lock-keywords |
267 '( | 267 '( |
268 ;; Handle the case: | 268 ;; Handle the case: |
269 ;; user: FirstName LastName <foo@bar> | 269 ;; user: FirstName LastName <foo@bar> |
275 ;; and | 275 ;; and |
276 ;; user: foo | 276 ;; user: foo |
277 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)" | 277 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)" |
278 (1 'change-log-email)) | 278 (1 'change-log-email)) |
279 ("^date: \\(.+\\)" (1 'change-log-date)) | 279 ("^date: \\(.+\\)" (1 'change-log-date)) |
280 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) | 280 ("^tag: +\\([^ ]+\\)$" (1 'highlight)) |
281 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) | |
281 | 282 |
282 (declare-function log-edit-mode "log-edit" ()) | 283 (declare-function log-edit-mode "log-edit" ()) |
283 (defvar log-edit-extra-flags) | 284 (defvar log-edit-extra-flags) |
284 (defvar log-edit-before-checkin-process) | 285 (defvar log-edit-before-checkin-process) |
285 | 286 |
452 | 453 |
453 ;;; Hg specific functionality. | 454 ;;; Hg specific functionality. |
454 | 455 |
455 (defvar vc-hg-extra-menu-map | 456 (defvar vc-hg-extra-menu-map |
456 (let ((map (make-sparse-keymap))) | 457 (let ((map (make-sparse-keymap))) |
457 (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming)) | |
458 (define-key map [outgoing] '(menu-item "Show outgoing" vc-hg-outgoing)) | |
459 map)) | 458 map)) |
460 | 459 |
461 (defun vc-hg-extra-menu () vc-hg-extra-menu-map) | 460 (defun vc-hg-extra-menu () vc-hg-extra-menu-map) |
462 | 461 |
463 (defun vc-hg-extra-status-menu () vc-hg-extra-menu-map) | 462 (defun vc-hg-extra-status-menu () vc-hg-extra-menu-map) |
464 | 463 |
465 (defvar log-view-vc-backend) | 464 (defvar log-view-vc-backend) |
466 | |
467 (define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing" | |
468 "Mode for browsing Hg outgoing changes." | |
469 (set (make-local-variable 'log-view-vc-backend) 'Hg)) | |
470 | |
471 (define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming" | |
472 "Mode for browsing Hg incoming changes." | |
473 (set (make-local-variable 'log-view-vc-backend) 'Hg)) | |
474 | 465 |
475 (defstruct (vc-hg-extra-fileinfo | 466 (defstruct (vc-hg-extra-fileinfo |
476 (:copier nil) | 467 (:copier nil) |
477 (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name)) | 468 (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name)) |
478 (:conc-name vc-hg-extra-fileinfo->)) | 469 (:conc-name vc-hg-extra-fileinfo->)) |
575 ;; these change after each commit | 566 ;; these change after each commit |
576 ;; (vc-hg-dir-extra-header "Local num : " "id" "-n") "\n" | 567 ;; (vc-hg-dir-extra-header "Local num : " "id" "-n") "\n" |
577 ;; (vc-hg-dir-extra-header "Global id : " "id" "-i") | 568 ;; (vc-hg-dir-extra-header "Global id : " "id" "-i") |
578 ))) | 569 ))) |
579 | 570 |
580 ;; FIXME: this adds another top level menu, instead figure out how to | 571 (defun vc-hg-log-incoming (buffer remote-location) |
581 ;; replace the Log-View menu. | 572 (vc-hg-command buffer 1 nil "incoming" "-n" (unless (string= remote-location "") |
582 (easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map | 573 remote-location))) |
583 "Hg-outgoing Display Menu" | 574 |
584 `("Hg-outgoing" | 575 (defun vc-hg-log-outgoing (buffer remote-location) |
585 ["Push selected" vc-hg-push])) | 576 (vc-hg-command buffer 1 nil "outgoing" "-n" (unless (string= remote-location "") |
586 | 577 remote-location))) |
587 (easy-menu-define log-view-mode-menu vc-hg-incoming-mode-map | |
588 "Hg-incoming Display Menu" | |
589 `("Hg-incoming" | |
590 ["Pull selected" vc-hg-pull])) | |
591 | |
592 (defun vc-hg-outgoing () | |
593 (interactive) | |
594 (let ((bname "*Hg outgoing*") | |
595 (vc-short-log nil)) | |
596 (vc-hg-command bname 1 nil "outgoing" "-n") | |
597 (pop-to-buffer bname) | |
598 (vc-hg-outgoing-mode))) | |
599 | |
600 (defun vc-hg-incoming () | |
601 (interactive) | |
602 (let ((bname "*Hg incoming*") | |
603 (vc-short-log nil)) | |
604 (vc-hg-command bname 0 nil "incoming" "-n") | |
605 (pop-to-buffer bname) | |
606 (vc-hg-incoming-mode))) | |
607 | 578 |
608 (declare-function log-view-get-marked "log-view" ()) | 579 (declare-function log-view-get-marked "log-view" ()) |
609 | 580 |
610 ;; XXX maybe also add key bindings for these functions. | 581 ;; XXX maybe also add key bindings for these functions. |
611 (defun vc-hg-push () | 582 (defun vc-hg-push () |