From unknown Sat Sep 20 02:56:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68117: [PATCH] vc-hg-annotate-time extracts incorrect dates Resent-From: Kjetil =?UTF-8?Q?=C3=98rbekk?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Dec 2023 01:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68117 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 68117@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17038986953128 (code B ref -1); Sat, 30 Dec 2023 01:12:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Dec 2023 01:11:35 +0000 Received: from localhost ([127.0.0.1]:42615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJNt0-0000oM-3R for submit@debbugs.gnu.org; Fri, 29 Dec 2023 20:11:34 -0500 Received: from lists.gnu.org ([2001:470:142::17]:60324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJDmt-0006O1-K2 for submit@debbugs.gnu.org; Fri, 29 Dec 2023 09:24:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJDmo-0000aL-Cz for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 09:24:30 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJDmm-0008FQ-Hw for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 09:24:30 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C7D845C0170 for ; Fri, 29 Dec 2023 09:24:26 -0500 (EST) Received: from imap44 ([10.202.2.94]) by compute6.internal (MEProxy); Fri, 29 Dec 2023 09:24:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbekk.com; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1703859866; x=1703946266; bh=HqsgczN2CwcHKuHjXRbBN7J+VCglvew7 jAefFL9T+aA=; b=K/XE2B/USOjWD5nUQxEu+0dhgGRsRqPRLiAKKP7uPSu8bXtR XnCaXw5kOIn7kqPwvJCgUjS8HfG6bjZK+dtLvGovyNKhP2YquYQx2eJ74u0Ws7mI ioGaq9ht3py0PvrdXpCISuMoJVxiJ15gJxPbeLBai97ASzOiJ37qE7k2GDecoxEx 5BFiy3epKUDGu22Oi4/NvS3kCvWA8HnmZ0xTIvN54ci45h+oUjkJgd7Q6nQ0U6Xb wUKXDLzhm19vdTs+anluIevZLFaOJ64NsXCfQPDglNiFJz22XwzNgXgL2QVPtMqx 8wazsrTcLGkWvw2xIH5aqizCVq88Tod6dxBk7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1703859866; x=1703946266; bh=HqsgczN2CwcHKuHjXRbBN7J+VCglvew7jAe fFL9T+aA=; b=QV1UkJcP5hOOgPEonlEkSB7b8dsw8tCcJzUKn8XZRCqKASTAika UN29fSiILyFshSWHWpcCmaGJHs3SLnlCgX1rzKmaVLh8H8s5nY2YHGnLIhhvK8EZ 8+cuSlqsISv8DCC3i+IqYPCQgIafy3a0mStDXrim6zVz5IXbD19A10q5DLjVO2mU Eui1g9HB2WMRUP4BQd4X5xai+k+Yca6RcFVAH+aH8/2slDvCazkm9b7sRF8zV80c qzCNWt3s4xIq9TA+I8ybIQwOZeFzJiU9p3kb1GsA3b1NDJQj0d59cX8qql+OvZ/k twcLd+vcR7As2CGIFZqHOJquUF+Xhe6H2cA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeffedgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefohffvufffkfggtgesmhdtreerre dtjeenucfhrhhomhepmfhjvghtihhlucnrrhgsvghkkhcuoehkjhesohhrsggvkhhkrdgt ohhmqeenucggtffrrghtthgvrhhnpedvueejueeugfelhedvudffvedttdelteeijefgud eljeelleelffetteekgeeuffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehkjhesohhrsggvkhhkrdgtohhm X-ME-Proxy: Feedback-ID: i1b4944d9:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7801536A0076; Fri, 29 Dec 2023 09:24:26 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface From: Kjetil =?UTF-8?Q?=C3=98rbekk?= Date: Fri, 29 Dec 2023 09:21:52 -0500 Message-ID: <8734vldr7j.fsf@orbekk.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=66.111.4.27; envelope-from=kj@orbekk.com; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Mailman-Approved-At: Fri, 29 Dec 2023 20:11:32 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) --=-=-= Content-Type: text/plain Hi, I noticed that vc-hg-annotate-time constructs a timestamp based on incorrect strings. E.g., the date "2014-11-28" is interpreted as year 2014, day -1, month 1. Please see the attached patch for a fix. -- Kjetil --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-vg-hg-annotate-time-bug.patch Content-Description: Fix vg-hg-annotate-time bug >From 47274868e458f92073eb75bb48f6e34564f020e5 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Fri, 29 Dec 2023 08:59:23 -0500 Subject: [PATCH] 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 --- lisp/vc/vc-hg.el | 4 ++-- test/lisp/vc/vc-hg-tests.el | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index d6dadb7..10be29c 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -584,8 +584,8 @@ vc-hg-annotate-time (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 89d518b..43bb922 100644 --- a/test/lisp/vc/vc-hg-tests.el +++ b/test/lisp/vc/vc-hg-tests.el @@ -53,6 +53,8 @@ vc-hg-annotate-extract-revision-at-line-with-both (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 -- 2.42.0 --=-=-=-- From unknown Sat Sep 20 02:56:13 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Kjetil =?UTF-8?Q?=C3=98rbekk?= Subject: bug#68117: closed (Re: bug#68117: [PATCH] vc-hg-annotate-time extracts incorrect dates) Message-ID: References: <54b94775-7b75-466f-9033-a3887bbceddf@gutov.dev> <8734vldr7j.fsf@orbekk.com> X-Gnu-PR-Message: they-closed 68117 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 68117@debbugs.gnu.org Date: Mon, 01 Jan 2024 17:58:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1704131882-19443-1" This is a multi-part message in MIME format... ------------=_1704131882-19443-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #68117: [PATCH] vc-hg-annotate-time extracts incorrect dates which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 68117@debbugs.gnu.org. --=20 68117: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D68117 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1704131882-19443-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 68117-done) by debbugs.gnu.org; 1 Jan 2024 17:57:11 +0000 Received: from localhost ([127.0.0.1]:48707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rKMXG-00052Q-Qj for submit@debbugs.gnu.org; Mon, 01 Jan 2024 12:57:11 -0500 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:38419) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rKMXE-000529-0m for 68117-done@debbugs.gnu.org; Mon, 01 Jan 2024 12:57:09 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id CB6023200C0E; Mon, 1 Jan 2024 12:56:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 01 Jan 2024 12:57:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1704131819; x=1704218219; bh=E+ZoglyGOc/5I4/27JfDf0/kRwsbEdhARzYmdH3AC40=; b= J98EK21TMhMOxpRgbLflyJoROoZ6B7tF3YTBDo7+gypbkWd6m7/FdiuakJDTY5UC vlbfkRcnpNagoCeROcbqmUlcu6rzFVCMp55LgpWPWIB0hpBzoxlKvvo1GlvXFwHh HpBduomNy8KyYHMMARGM2toYsexc/x2WIxc2sl7GmB/ClpVI0ygEhM5i7QOuCoY1 QmqmOuJu4+9my2FPKp0Zza3reXCqNppfbPwCJeX4lVORAyeM53XZQ+Z31RrI8FiK Vjf3xSLHLEm0g3jQjG9kxsmbtyCrYoY3gdHhHK2eejboWRGAv9KH7KtxRPtgow72 Q2n0eEOezvDvxbZ+RxMFwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704131819; x= 1704218219; bh=E+ZoglyGOc/5I4/27JfDf0/kRwsbEdhARzYmdH3AC40=; b=k 8uHEmzy3WhCvcMGFr+IDucQ8SBt6H3Nlw/bs5nh31Rn+QYyJUHlNUww0CycKcGsC EH/kHutdfcmzNX87NyFtSjR+QKvPBhSJjHq8mk+EtCNuM990u14XKdkG30xxTFJT bPw47a4qxhJp2Ftehw6aeyrQ55UG2+L/fVFT1wZ1RZmY6cyUvXICSRXiYTNeHHE9 M6HFmTid+8xwiZYFkWzOAC3NJDCqTmxAPc4lDrhQMYzvF0V9Nb/cVlT6IeXGFPjS k1mtW2xU5rlJoWijHNml4EntHBxjEt4vpmT1nth+bIj+kPwbdGf1g4D2U9QvJj0R h+FanGOv9jJT06ohAV4lg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdegtddguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesth ekredttddvjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehg uhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpeegueegteffuddvjeevvdelleeitd eftdduhfeffeffjedukeevjedvfeffgfevgeenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Jan 2024 12:56:58 -0500 (EST) Message-ID: <54b94775-7b75-466f-9033-a3887bbceddf@gutov.dev> Date: Mon, 1 Jan 2024 19:56:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#68117: [PATCH] vc-hg-annotate-time extracts incorrect dates Content-Language: en-US To: =?UTF-8?Q?Kjetil_=C3=98rbekk?= , 68117-done@debbugs.gnu.org References: <8734vldr7j.fsf@orbekk.com> From: Dmitry Gutov In-Reply-To: <8734vldr7j.fsf@orbekk.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 68117-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Version: 30.1 On 29/12/2023 16:21, Kjetil Ørbekk wrote: > Hi, > > I noticed that vc-hg-annotate-time constructs a timestamp based on > incorrect strings. E.g., the date "2014-11-28" is interpreted as year > 2014, day -1, month 1. > > Please see the attached patch for a fix. Thanks! Installed. ------------=_1704131882-19443-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 30 Dec 2023 01:11:35 +0000 Received: from localhost ([127.0.0.1]:42615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJNt0-0000oM-3R for submit@debbugs.gnu.org; Fri, 29 Dec 2023 20:11:34 -0500 Received: from lists.gnu.org ([2001:470:142::17]:60324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJDmt-0006O1-K2 for submit@debbugs.gnu.org; Fri, 29 Dec 2023 09:24:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJDmo-0000aL-Cz for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 09:24:30 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rJDmm-0008FQ-Hw for bug-gnu-emacs@gnu.org; Fri, 29 Dec 2023 09:24:30 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C7D845C0170 for ; Fri, 29 Dec 2023 09:24:26 -0500 (EST) Received: from imap44 ([10.202.2.94]) by compute6.internal (MEProxy); Fri, 29 Dec 2023 09:24:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbekk.com; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1703859866; x=1703946266; bh=HqsgczN2CwcHKuHjXRbBN7J+VCglvew7 jAefFL9T+aA=; b=K/XE2B/USOjWD5nUQxEu+0dhgGRsRqPRLiAKKP7uPSu8bXtR XnCaXw5kOIn7kqPwvJCgUjS8HfG6bjZK+dtLvGovyNKhP2YquYQx2eJ74u0Ws7mI ioGaq9ht3py0PvrdXpCISuMoJVxiJ15gJxPbeLBai97ASzOiJ37qE7k2GDecoxEx 5BFiy3epKUDGu22Oi4/NvS3kCvWA8HnmZ0xTIvN54ci45h+oUjkJgd7Q6nQ0U6Xb wUKXDLzhm19vdTs+anluIevZLFaOJ64NsXCfQPDglNiFJz22XwzNgXgL2QVPtMqx 8wazsrTcLGkWvw2xIH5aqizCVq88Tod6dxBk7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1703859866; x=1703946266; bh=HqsgczN2CwcHKuHjXRbBN7J+VCglvew7jAe fFL9T+aA=; b=QV1UkJcP5hOOgPEonlEkSB7b8dsw8tCcJzUKn8XZRCqKASTAika UN29fSiILyFshSWHWpcCmaGJHs3SLnlCgX1rzKmaVLh8H8s5nY2YHGnLIhhvK8EZ 8+cuSlqsISv8DCC3i+IqYPCQgIafy3a0mStDXrim6zVz5IXbD19A10q5DLjVO2mU Eui1g9HB2WMRUP4BQd4X5xai+k+Yca6RcFVAH+aH8/2slDvCazkm9b7sRF8zV80c qzCNWt3s4xIq9TA+I8ybIQwOZeFzJiU9p3kb1GsA3b1NDJQj0d59cX8qql+OvZ/k twcLd+vcR7As2CGIFZqHOJquUF+Xhe6H2cA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeffedgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefohffvufffkfggtgesmhdtreerre dtjeenucfhrhhomhepmfhjvghtihhlucnrrhgsvghkkhcuoehkjhesohhrsggvkhhkrdgt ohhmqeenucggtffrrghtthgvrhhnpedvueejueeugfelhedvudffvedttdelteeijefgud eljeelleelffetteekgeeuffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehkjhesohhrsggvkhhkrdgtohhm X-ME-Proxy: Feedback-ID: i1b4944d9:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7801536A0076; Fri, 29 Dec 2023 09:24:26 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface From: =?utf-8?Q?Kjetil_=C3=98rbekk?= To: bug-gnu-emacs@gnu.org Subject: [PATCH] vc-hg-annotate-time extracts incorrect dates Date: Fri, 29 Dec 2023 09:21:52 -0500 Message-ID: <8734vldr7j.fsf@orbekk.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=66.111.4.27; envelope-from=kj@orbekk.com; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 29 Dec 2023 20:11:32 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) --=-=-= Content-Type: text/plain Hi, I noticed that vc-hg-annotate-time constructs a timestamp based on incorrect strings. E.g., the date "2014-11-28" is interpreted as year 2014, day -1, month 1. Please see the attached patch for a fix. -- Kjetil --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-vg-hg-annotate-time-bug.patch Content-Description: Fix vg-hg-annotate-time bug >From 47274868e458f92073eb75bb48f6e34564f020e5 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Fri, 29 Dec 2023 08:59:23 -0500 Subject: [PATCH] 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 --- lisp/vc/vc-hg.el | 4 ++-- test/lisp/vc/vc-hg-tests.el | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index d6dadb7..10be29c 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -584,8 +584,8 @@ vc-hg-annotate-time (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 89d518b..43bb922 100644 --- a/test/lisp/vc/vc-hg-tests.el +++ b/test/lisp/vc/vc-hg-tests.el @@ -53,6 +53,8 @@ vc-hg-annotate-extract-revision-at-line-with-both (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 -- 2.42.0 --=-=-=-- ------------=_1704131882-19443-1--