aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDan Nicolaescu2019-06-27 20:13:14 +0200
committerLars Ingebrigtsen2019-06-27 21:00:36 +0200
commitb93e5463885f9c99e74b52d2f569ad06ec2d0ff8 (patch)
treea5924bda8ebf66891e773d791d44a237b5aa9e0e /lisp
parentb98b843a5b6df987d3dba3e66fe637570c06cd0d (diff)
downloademacs-b93e5463885f9c99e74b52d2f569ad06ec2d0ff8.tar.gz
emacs-b93e5463885f9c99e74b52d2f569ad06ec2d0ff8.zip
Include the date in the bzr annotation buffer
* lisp/vc/vc-bzr.el (vc-bzr-annotate-command) (vc-bzr-annotate-time) (vc-bzr-annotate-extract-revision-at-line): Include a date in the bzr annotation buffer (bug#5428).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/vc/vc-bzr.el50
1 files changed, 7 insertions, 43 deletions
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index ee1646cae5a..89f1fcce376 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -869,61 +869,25 @@ Each line is tagged with the revision number, which has a `help-echo'
869property containing author and date information." 869property containing author and date information."
870 (apply #'vc-bzr-command "annotate" buffer 'async file "--long" "--all" 870 (apply #'vc-bzr-command "annotate" buffer 'async file "--long" "--all"
871 (append (vc-switches 'bzr 'annotate) 871 (append (vc-switches 'bzr 'annotate)
872 (if revision (list "-r" revision)))) 872 (if revision (list "-r" revision)))))
873 (let ((table (make-hash-table :test 'equal)))
874 (set-process-filter
875 (get-buffer-process buffer)
876 (lambda (proc string)
877 (when (process-buffer proc)
878 (with-current-buffer (process-buffer proc)
879 (setq string (concat (process-get proc :vc-left-over) string))
880 ;; Eg: 102020 Gnus developers 20101020 | regexp."
881 ;; As of bzr 2.2.2, no email address in whoami (which can
882 ;; lead to spaces in the author field) is allowed but discouraged.
883 ;; See bug#7792.
884 (while (string-match "^\\( *[0-9.]+ *\\) \\(.+?\\) +\\([0-9]\\{8\\}\\)\\( |.*\n\\)" string)
885 (let* ((rev (match-string 1 string))
886 (author (match-string 2 string))
887 (date (match-string 3 string))
888 (key (substring string (match-beginning 0)
889 (match-beginning 4)))
890 (line (match-string 4 string))
891 (tag (gethash key table))
892 (inhibit-read-only t))
893 (setq string (substring string (match-end 0)))
894 (unless tag
895 (setq tag
896 (propertize
897 (format "%s %-7.7s" rev author)
898 'help-echo (format "Revision: %d, author: %s, date: %s"
899 (string-to-number rev)
900 author date)
901 'mouse-face 'highlight))
902 (puthash key tag table))
903 (goto-char (process-mark proc))
904 (insert tag line)
905 (move-marker (process-mark proc) (point))))
906 (process-put proc :vc-left-over string)))))))
907 873
908(declare-function vc-annotate-convert-time "vc-annotate" (&optional time)) 874(declare-function vc-annotate-convert-time "vc-annotate" (&optional time))
909 875
910(defun vc-bzr-annotate-time () 876(defun vc-bzr-annotate-time ()
911 (when (re-search-forward "^ *[0-9.]+ +.+? +|" nil t) 877 (when (re-search-forward "^[0-9.]+ +[^\n ]* +\\([0-9]\\{8\\}\\) |" nil t)
912 (let ((prop (get-text-property (line-beginning-position) 'help-echo))) 878 (let ((str (match-string-no-properties 1)))
913 (string-match "[0-9]+\\'" prop)
914 (let ((str (match-string-no-properties 0 prop)))
915 (vc-annotate-convert-time 879 (vc-annotate-convert-time
916 (encode-time 0 0 0 880 (encode-time 0 0 0
917 (string-to-number (substring str 6 8)) 881 (string-to-number (substring str 6 8))
918 (string-to-number (substring str 4 6)) 882 (string-to-number (substring str 4 6))
919 (string-to-number (substring str 0 4)))))))) 883 (string-to-number (substring str 0 4)))))))
920 884
921(defun vc-bzr-annotate-extract-revision-at-line () 885(defun vc-bzr-annotate-extract-revision-at-line ()
922 "Return revision for current line of annotation buffer, or nil. 886 "Return revision for current line of annotation buffer, or nil.
923Return nil if current line isn't annotated." 887Return nil if current line isn't annotated."
924 (save-excursion 888 (save-excursion
925 (beginning-of-line) 889 (beginning-of-line)
926 (if (looking-at "^ *\\([0-9.]+\\) +.* +|") 890 (if (looking-at "^\\([0-9.]+\\) +[^\n ]* +\\([0-9]\\{8\\}\\) |")
927 (match-string-no-properties 1)))) 891 (match-string-no-properties 1))))
928 892
929(defun vc-bzr-command-discarding-stderr (command &rest args) 893(defun vc-bzr-command-discarding-stderr (command &rest args)