Subject: Re: bug#5428: vc-annotate for Bzr does not show the date

From: Dan Nicolaescu <[email-masked]>
Date: Thu, 21 Jan 2010 07:27:50 -0800 (PST)

tags 5428 patch
quit

Stefan Monnier <[email-masked]> writes:

  > > The date is in a very compact format YYYYMMDD, so it does not take much
  > > screen space.
  > 
  > In vc-annotate, horizontal space is at a premium, since we're adding
  > "margin text" to a file who's content should already be expected to be
  > "using up all space" (e.g. all 80 columns).

Can you please explain how was this different with CVS (and all other
VCs besides svn)?

If space is so important why isn't hiding the whole annotation
vc-annotate-toggle-annotation-visibility even more useful?

  > I'd oppose adding the date until it can be configured away.

So bzr should be less functional that all other VCs until someone cares
to implement a new feature?

Meanwhile here's a patch for people that want to be able to fully use of
vc-annotate with bzr.  Just removes a bunch of code and adjusts 2 regexps.

Index: vc-bzr.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-bzr.el,v
retrieving revision 1.94
diff -u -3 -p -u -p -r1.94 vc-bzr.el
--- vc-bzr.el	9 Dec 2009 06:04:12 -0000	1.94
+++ vc-bzr.el	21 Jan 2010 15:18:51 -0000
@@ -558,57 +585,25 @@ REV non-nil gets an error."
 Each line is tagged with the revision number, which has a `help-echo'
 property containing author and date information."
   (apply #'vc-bzr-command "annotate" buffer 'async file "--long" "--all"
-         (if revision (list "-r" revision)))
-  (lexical-let ((table (make-hash-table :test 'equal)))
-    (set-process-filter
-     (get-buffer-process buffer)
-     (lambda (proc string)
-       (when (process-buffer proc)
-         (with-current-buffer (process-buffer proc)
-           (setq string (concat (process-get proc :vc-left-over) string))
-           (while (string-match "^\\( *[0-9.]+ *\\) \\([^\n ]+\\) +\\([0-9]\\{8\\}\\)\\( |.*\n\\)" string)
-             (let* ((rev (match-string 1 string))
-                    (author (match-string 2 string))
-                    (date (match-string 3 string))
-                    (key (substring string (match-beginning 0)
-                                    (match-beginning 4)))
-                    (line (match-string 4 string))
-                    (tag (gethash key table))
-                    (inhibit-read-only t))
-               (setq string (substring string (match-end 0)))
-	       (unless tag
-		 (setq tag
-		       (propertize
-			(format "%s %-7.7s" rev author)
-			'help-echo (format "Revision: %d, author: %s, date: %s"
-					   (string-to-number rev)
-					   author date)
-			'mouse-face 'highlight))
-                 (puthash key tag table))
-               (goto-char (process-mark proc))
-               (insert tag line)
-               (move-marker (process-mark proc) (point))))
-           (process-put proc :vc-left-over string)))))))
+         (if revision (list "-r" revision))))
 
 (declare-function vc-annotate-convert-time "vc-annotate" (time))
 
 (defun vc-bzr-annotate-time ()
-  (when (re-search-forward "^ *[0-9.]+ +[^\n ]* +|" nil t)
-    (let ((prop (get-text-property (line-beginning-position) 'help-echo)))
-      (string-match "[0-9]+\\'" prop)
-      (let ((str (match-string-no-properties 0 prop)))
+  (when (re-search-forward "^[0-9.]+ +[^\n ]* +\\([0-9]\\{8\\}\\) |" nil t)
+    (let ((str (match-string-no-properties 1)))
       (vc-annotate-convert-time
        (encode-time 0 0 0
                       (string-to-number (substring str 6 8))
                       (string-to-number (substring str 4 6))
-                      (string-to-number (substring str 0 4))))))))
+                      (string-to-number (substring str 0 4)))))))
 
 (defun vc-bzr-annotate-extract-revision-at-line ()
   "Return revision for current line of annoation buffer, or nil.
 Return nil if current line isn't annotated."
   (save-excursion
     (beginning-of-line)
-    (if (looking-at "^ *\\([0-9.]+\\) +[^\n ]* +|")
+    (if (looking-at "^\\([0-9.]+\\) +[^\n ]* +\\([0-9]\\{8\\}\\) |")
         (match-string-no-properties 1))))
 
 (defun vc-bzr-command-discarding-stderr (command &rest args)