diff options
| author | Andrii Kolomoiets | 2020-08-09 14:35:26 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-08-09 14:35:26 +0200 |
| commit | d586bae501a3d6ec8e6a8088d05b0abfa541dece (patch) | |
| tree | ad9a4f906a5c3d75434351b5f8ef790caea5b7b0 | |
| parent | c789c3aac66943497f771896ec13bae618f86a01 (diff) | |
| download | emacs-d586bae501a3d6ec8e6a8088d05b0abfa541dece.tar.gz emacs-d586bae501a3d6ec8e6a8088d05b0abfa541dece.zip | |
vc-hg: use 'hg summary' to populate vc-dir headers
* lisp/vc/vc-hg.el (vc-hg-dir-extra-headers): Use 'hg summary' command.
(vc-hg-dir-extra-header): Remove unused function.
* etc/NEWS: Mention changes to vc-hg.el (bug#38387).
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/vc/vc-hg.el | 37 |
2 files changed, 25 insertions, 17 deletions
| @@ -236,6 +236,11 @@ Bookmark locations can refer to VC directory buffers. | |||
| 236 | *** New user option 'vc-hg-create-bookmark' controls whether a bookmark | 236 | *** New user option 'vc-hg-create-bookmark' controls whether a bookmark |
| 237 | or branch will be created when you invoke 'C-u C-x v s' ('vc-create-tag'). | 237 | or branch will be created when you invoke 'C-u C-x v s' ('vc-create-tag'). |
| 238 | 238 | ||
| 239 | --- | ||
| 240 | *** 'vc-hg' now uses 'hg summary' command to populate extra 'vc-dir' | ||
| 241 | headers. | ||
| 242 | |||
| 243 | |||
| 239 | ** Gnus | 244 | ** Gnus |
| 240 | 245 | ||
| 241 | --- | 246 | --- |
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 09f804357e0..cb0657e70a0 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el | |||
| @@ -1384,25 +1384,28 @@ REV is the revision to check out into WORKFILE." | |||
| 1384 | (vc-run-delayed | 1384 | (vc-run-delayed |
| 1385 | (vc-hg-after-dir-status update-function))) | 1385 | (vc-hg-after-dir-status update-function))) |
| 1386 | 1386 | ||
| 1387 | (defun vc-hg-dir-extra-header (name &rest commands) | ||
| 1388 | (concat (propertize name 'face 'font-lock-type-face) | ||
| 1389 | (propertize | ||
| 1390 | (with-temp-buffer | ||
| 1391 | (apply 'vc-hg-command (current-buffer) 0 nil commands) | ||
| 1392 | (buffer-substring-no-properties (point-min) (1- (point-max)))) | ||
| 1393 | 'face 'font-lock-variable-name-face))) | ||
| 1394 | |||
| 1395 | (defun vc-hg-dir-extra-headers (dir) | 1387 | (defun vc-hg-dir-extra-headers (dir) |
| 1396 | "Generate extra status headers for a Mercurial tree." | 1388 | "Generate extra status headers for a repository in DIR. |
| 1389 | This runs the command \"hg summary\"." | ||
| 1397 | (let ((default-directory dir)) | 1390 | (let ((default-directory dir)) |
| 1398 | (concat | 1391 | (with-temp-buffer |
| 1399 | (vc-hg-dir-extra-header "Root : " "root") "\n" | 1392 | (vc-hg-command t 0 nil "summary") |
| 1400 | (vc-hg-dir-extra-header "Branch : " "id" "-b") "\n" | 1393 | (goto-char (point-min)) |
| 1401 | (vc-hg-dir-extra-header "Tags : " "id" "-t") ; "\n" | 1394 | (mapconcat |
| 1402 | ;; these change after each commit | 1395 | #'identity |
| 1403 | ;; (vc-hg-dir-extra-header "Local num : " "id" "-n") "\n" | 1396 | (let (result) |
| 1404 | ;; (vc-hg-dir-extra-header "Global id : " "id" "-i") | 1397 | (while (not (eobp)) |
| 1405 | ))) | 1398 | (push |
| 1399 | (let ((entry (if (looking-at "\\([^ ].*\\): \\(.*\\)") | ||
| 1400 | (cons (capitalize (match-string 1)) (match-string 2)) | ||
| 1401 | (cons "" (buffer-substring (point) (line-end-position)))))) | ||
| 1402 | (concat | ||
| 1403 | (propertize (format "%-11s: " (car entry)) 'face 'font-lock-type-face) | ||
| 1404 | (propertize (cdr entry) 'face 'font-lock-variable-name-face))) | ||
| 1405 | result) | ||
| 1406 | (forward-line)) | ||
| 1407 | (nreverse result)) | ||
| 1408 | "\n")))) | ||
| 1406 | 1409 | ||
| 1407 | (defun vc-hg-log-incoming (buffer remote-location) | 1410 | (defun vc-hg-log-incoming (buffer remote-location) |
| 1408 | (vc-setup-buffer buffer) | 1411 | (vc-setup-buffer buffer) |