diff options
| author | Sam Steingold | 2008-06-04 14:04:28 +0000 |
|---|---|---|
| committer | Sam Steingold | 2008-06-04 14:04:28 +0000 |
| commit | fe4f86953e1dd494ca50c10cae4706fa21caf7c5 (patch) | |
| tree | f36256f1f4ee737382bcb1b3fa94cc8f63c48c15 /lisp | |
| parent | 50b3db29b32d1dc215bbf5e57055bad1bc37d865 (diff) | |
| download | emacs-fe4f86953e1dd494ca50c10cae4706fa21caf7c5.tar.gz emacs-fe4f86953e1dd494ca50c10cae4706fa21caf7c5.zip | |
(vc-hg-status-extra-header, vc-hg-status-extra-headers):
Generate extra status headers for a Mercurial tree.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc-hg.el | 26 |
2 files changed, 28 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c48d3c7e23e..807e8668934 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-06-04 Sam Steingold <sds@gnu.org> | ||
| 2 | |||
| 3 | * vc-hg.el (vc-hg-status-extra-header, vc-hg-status-extra-headers): | ||
| 4 | Generate extra status headers for a Mercurial tree. | ||
| 5 | |||
| 1 | 2008-06-04 John Paul Wallington <jpw@pobox.com> | 6 | 2008-06-04 John Paul Wallington <jpw@pobox.com> |
| 2 | 7 | ||
| 3 | * echistory.el (electric-history-map): Define within defvar. | 8 | * echistory.el (electric-history-map): Define within defvar. |
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index eb392291653..025b2d9500e 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el | |||
| @@ -284,7 +284,7 @@ | |||
| 284 | (defun vc-hg-annotate-command (file buffer &optional revision) | 284 | (defun vc-hg-annotate-command (file buffer &optional revision) |
| 285 | "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. | 285 | "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. |
| 286 | Optional arg REVISION is a revision to annotate from." | 286 | Optional arg REVISION is a revision to annotate from." |
| 287 | (vc-hg-command buffer 0 file "annotate" "-d" "-n" | 287 | (vc-hg-command buffer 0 file "annotate" "-d" "-n" |
| 288 | (when revision (concat "-r" revision))) | 288 | (when revision (concat "-r" revision))) |
| 289 | (with-current-buffer buffer | 289 | (with-current-buffer buffer |
| 290 | (goto-char (point-min)) | 290 | (goto-char (point-min)) |
| @@ -425,7 +425,7 @@ REV is the revision to check out into WORKFILE." | |||
| 425 | (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name)) | 425 | (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name)) |
| 426 | (:conc-name vc-hg-extra-fileinfo->)) | 426 | (:conc-name vc-hg-extra-fileinfo->)) |
| 427 | rename-state ;; rename or copy state | 427 | rename-state ;; rename or copy state |
| 428 | extra-name) ;; original name for copies and rename targets, new name for | 428 | extra-name) ;; original name for copies and rename targets, new name for |
| 429 | 429 | ||
| 430 | (defun vc-hg-status-printer (info) | 430 | (defun vc-hg-status-printer (info) |
| 431 | "Pretty-printer for the vc-dir-fileinfo structure." | 431 | "Pretty-printer for the vc-dir-fileinfo structure." |
| @@ -471,7 +471,7 @@ REV is the revision to check out into WORKFILE." | |||
| 471 | ;; For copied files the output looks like this: | 471 | ;; For copied files the output looks like this: |
| 472 | ;; A COPIED_FILE_NAME | 472 | ;; A COPIED_FILE_NAME |
| 473 | ;; ORIGINAL_FILE_NAME | 473 | ;; ORIGINAL_FILE_NAME |
| 474 | (setf (nth 2 last-added) | 474 | (setf (nth 2 last-added) |
| 475 | (vc-hg-create-extra-fileinfo 'copied file)) | 475 | (vc-hg-create-extra-fileinfo 'copied file)) |
| 476 | (setq last-line-copy t)) | 476 | (setq last-line-copy t)) |
| 477 | ((and last-line-copy (eq translated 'removed)) | 477 | ((and last-line-copy (eq translated 'removed)) |
| @@ -498,6 +498,26 @@ REV is the revision to check out into WORKFILE." | |||
| 498 | (vc-exec-after | 498 | (vc-exec-after |
| 499 | `(vc-hg-after-dir-status (quote ,update-function)))) | 499 | `(vc-hg-after-dir-status (quote ,update-function)))) |
| 500 | 500 | ||
| 501 | (defun vc-hg-status-extra-header (name &rest commands) | ||
| 502 | (concat (propertize name 'face 'font-lock-type-face) | ||
| 503 | (propertize | ||
| 504 | (with-temp-buffer | ||
| 505 | (apply 'vc-hg-command (current-buffer) 0 nil commands) | ||
| 506 | (buffer-substring-no-properties (point-min) (1- (point-max)))) | ||
| 507 | 'face 'font-lock-variable-name-face))) | ||
| 508 | |||
| 509 | (defun vc-hg-status-extra-headers (dir) | ||
| 510 | "Generate extra status headers for a Mercurial tree." | ||
| 511 | (let ((default-directory dir)) | ||
| 512 | (concat | ||
| 513 | (vc-hg-status-extra-header "Root : " "root") "\n" | ||
| 514 | (vc-hg-status-extra-header "Branch : " "id" "-b") "\n" | ||
| 515 | (vc-hg-status-extra-header "Tags : " "id" "-t") ; "\n" | ||
| 516 | ;; these change after each commit | ||
| 517 | ;; (vc-hg-status-extra-header "Local num : " "id" "-n") "\n" | ||
| 518 | ;; (vc-hg-status-extra-header "Global id : " "id" "-i") | ||
| 519 | ))) | ||
| 520 | |||
| 501 | ;; XXX this adds another top level menu, instead figure out how to | 521 | ;; XXX this adds another top level menu, instead figure out how to |
| 502 | ;; replace the Log-View menu. | 522 | ;; replace the Log-View menu. |
| 503 | (easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map | 523 | (easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map |