aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2007-08-29 18:15:16 +0000
committerDan Nicolaescu2007-08-29 18:15:16 +0000
commitf0230324e9fb189b79f2307e47bdfd8c37a9a15f (patch)
tree9262844e8d7c53f466bbfc9c28da77a3c3998bb2
parentdc8ceca12c54bf9fb5f208bdb853f8cb94f650e9 (diff)
downloademacs-f0230324e9fb189b79f2307e47bdfd8c37a9a15f.tar.gz
emacs-f0230324e9fb189b79f2307e47bdfd8c37a9a15f.zip
(vc-hg-extra-menu-map): New variable.
(vc-hg-extra-menu, vc-hg-outgoing, vc-hg-incoming, vc-hg-push) (vc-hg-pull): New functions. (vc-hg-outgoing-mode, vc-hg-incoming-mode): New derived modes.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc-hg.el68
2 files changed, 71 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3371affe2a2..d493241daaf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12007-08-29 Dan Nicolaescu <dann@ics.uci.edu> 12007-08-29 Dan Nicolaescu <dann@ics.uci.edu>
2 2
3 * vc-hg.el (vc-hg-extra-menu-map): New variable.
4 (vc-hg-extra-menu, vc-hg-outgoing, vc-hg-incoming, vc-hg-push)
5 (vc-hg-pull): New functions.
6 (vc-hg-outgoing-mode, vc-hg-incoming-mode): New derived modes.
7
3 * term/mac-win.el: Don't require url, only autoloaded url 8 * term/mac-win.el: Don't require url, only autoloaded url
4 functions are used in this file. 9 functions are used in this file.
5 10
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index 1415f8d9499..6b9565b8bd8 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -257,8 +257,7 @@
257(defvar log-view-font-lock-keywords) 257(defvar log-view-font-lock-keywords)
258 258
259(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" 259(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
260 (require 'add-log) ;; we need the faces add-log 260 (require 'add-log) ;; we need the add-log faces
261 ;; Don't have file markers, so use impossible regexp.
262 (set (make-local-variable 'log-view-file-re) "^File:[ \t]+\\(.+\\)") 261 (set (make-local-variable 'log-view-file-re) "^File:[ \t]+\\(.+\\)")
263 (set (make-local-variable 'log-view-message-re) 262 (set (make-local-variable 'log-view-message-re)
264 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)") 263 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")
@@ -443,6 +442,71 @@ REV is the revision to check out into WORKFILE."
443 (unless contents-done 442 (unless contents-done
444 (with-temp-buffer (vc-hg-command t 0 file "revert")))) 443 (with-temp-buffer (vc-hg-command t 0 file "revert"))))
445 444
445;;; Hg specific functionality.
446
447;;; XXX This functionality is experimental/work in progress. It might
448;;; change without notice.
449(defvar vc-hg-extra-menu-map
450 (let ((map (make-sparse-keymap)))
451 (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
452 (define-key map [outgoing] '(menu-item "Show outgoing" vc-hg-outgoing))
453 map))
454
455(defun vc-hg-extra-menu () vc-hg-extra-menu-map)
456
457(define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing")
458
459(define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming")
460
461;; XXX this adds another top level menu, instead figure out how to
462;; replace the Log-View menu.
463(easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map
464 "Hg-outgoing Display Menu"
465 `("Hg-outgoing"
466 ["Push selected" vc-hg-push]))
467
468(easy-menu-define log-view-mode-menu vc-hg-incoming-mode-map
469 "Hg-incoming Display Menu"
470 `("Hg-incoming"
471 ["Pull selected" vc-hg-pull]))
472
473(defun vc-hg-outgoing ()
474 (interactive)
475 (let ((bname "*Hg outgoing*"))
476 (vc-hg-command bname 0 nil "outgoing" "-n")
477 (pop-to-buffer bname)
478 (vc-hg-outgoing-mode)))
479
480(defun vc-hg-incoming ()
481 (interactive)
482 (let ((bname "*Hg incoming*"))
483 (vc-hg-command bname 0 nil "incoming" "-n")
484 (pop-to-buffer bname)
485 (vc-hg-incoming-mode)))
486
487;; XXX maybe also add key bindings for these functions.
488(defun vc-hg-push ()
489 (interactive)
490 (let ((marked-list (log-view-get-marked)))
491 (if marked-list
492 (vc-hg-command
493 nil 0 nil
494 (cons "push"
495 (apply 'nconc
496 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
497 (error "No log entries selected for push"))))
498
499(defun vc-hg-pull ()
500 (interactive)
501 (let ((marked-list (log-view-get-marked)))
502 (if marked-list
503 (vc-hg-command
504 nil 0 nil
505 (cons "pull"
506 (apply 'nconc
507 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
508 (error "No log entries selected for pull"))))
509
446;;; Internal functions 510;;; Internal functions
447 511
448(defun vc-hg-command (buffer okstatus file-or-list &rest flags) 512(defun vc-hg-command (buffer okstatus file-or-list &rest flags)