summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2023-12-29 08:59:23 -0500
committerDmitry Gutov <dmitry@gutov.dev>2024-01-01 19:56:02 +0200
commit73126d62a8bb4b69692c03304e16007c45258ff2 (patch)
tree9942fcb3c7483556f22ce76905b087328f860fb3
parent1c369263db826a02e01d4209c7b6b8617971c37c (diff)
downloademacs-73126d62a8bb4b69692c03304e16007c45258ff2.tar.gz
Fix vg-hg-annotate-time bug
* lisp/vc/vc-hg.el (vc-hg-annotate-time): Fix extraction of timestamp from string. * test/lisp/vc/vc-hg-tests.el (vc-hg-annotate-time): Test that the correct timestamp is found. Copyright-paperwork-exempt: yes
-rw-r--r--lisp/vc/vc-hg.el4
-rw-r--r--test/lisp/vc/vc-hg-tests.el4
2 files changed, 5 insertions, 3 deletions
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index d6dadb74469..10be29c45af 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -584,8 +584,8 @@ Optional arg REVISION is a revision to annotate from."
(vc-annotate-convert-time
(let ((str (match-string-no-properties 2)))
(encode-time 0 0 0
- (string-to-number (substring str 6 8))
- (string-to-number (substring str 4 6))
+ (string-to-number (substring str 8 10))
+ (string-to-number (substring str 5 7))
(string-to-number (substring str 0 4)))))))
(defun vc-hg-annotate-extract-revision-at-line ()
diff --git a/test/lisp/vc/vc-hg-tests.el b/test/lisp/vc/vc-hg-tests.el
index 89d518b2a91..43bb922d567 100644
--- a/test/lisp/vc/vc-hg-tests.el
+++ b/test/lisp/vc/vc-hg-tests.el
@@ -53,6 +53,8 @@
(ert-deftest vc-hg-annotate-time ()
(with-temp-buffer
(save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:"))
- (should (floatp (vc-hg-annotate-time)))))
+ (should (equal (vc-hg-annotate-time)
+ (vc-annotate-convert-time
+ (encode-time 0 0 0 28 11 2014))))))
;;; vc-hg-tests.el ends here