GNU bug report logs - #36534
25.2; mercurial vc-annotate sometimes fails when using the evolve mercurial extension

Previous Next

Package: emacs;

Reported by: Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>

Date: Sun, 7 Jul 2019 08:50:02 UTC

Severity: normal

Found in version 25.2

Fixed in version 28.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36534 in the body.
You can then email your comments to 36534 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36534; Package emacs. (Sun, 07 Jul 2019 08:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 07 Jul 2019 08:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; mercurial vc-annotate sometimes fails when using the evolve
 mercurial extension
Date: Sun, 7 Jul 2019 00:55:51 -0400
[Message part 1 (text/plain, inline)]
Sometimes, vc-annotate in a file tracked by mercurial returns an
error like this instead of a proper annotate buffer:

abort: mercurial/merge.py: no such file in rev 9117c6561b0b

Here is a reproduction (requires the evolve extension to
be enabled, for instance as described here:
https://www.mercurial-scm.org/wiki/EvolveExtension):

  rm -rf /tmp/test
  hg init /tmp/test
  cd /tmp/test
  echo b > b
  hg commit -Am0
  echo a > a
  hg commit -Am1
  hg commit --amend -m 2
  if [ $(hg log -r . -T {rev}) = 1 ]; then
      echo "Error: cannot test as evolve is not enabled"
      exit 1
  fi
  emacs -Q a -f 'vc-annotate'


What happens is:
1. vc-annotate calls vc-working-revision
2. vc-hg-working-revision calls hg parent --template {rev} file
3. that command fails saying something like "abort: filtered revision
'3ee3303ecf2621381e5d5ca14aba73f2835facb5'!"
4. vc-hg-working-revision thus returns 0
5. vc-annotate calls `hg annotate -r 0 file`, which correctly errors
out, saying "abort: file: no such file in hex-rev-of-rev-0".

Step 3 is probably an hg bug. However `hg parent` was deprecated in
2014, so people may be reluctant to change it. And it would be simpler
for vc-hg-working-revision to call `hg log -r . -T {rev}` (vc-git does
that, so I assume that it works in general on top of fixing the
current issue). `.` means the current revision, see `hg help revset`.

So something like this:
(defun vc-hg-working-revision (file)
  "Hg-specific version of `vc-working-revision'."
  (ignore-errors
    (with-output-to-string
      (vc-hg-command standard-output 0 nil
    "log" "-r" "." "--template" "{rev}"))))

(another reason to stop using `hg parents` is that during a merge, it
will in most cases print two revisions, so if you annotate a file that
was last changed in revision 123, emacs will likely get 123123 back
and `hg annotate -r 123123` will fail)



In GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.23.2)
 of 2018-08-27, modified by Debian built on lgw01-amd64-037
Windowing system distributor 'The X.Org Foundation', version 11.0.12001000
System Description: Ubuntu 18.10

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --build x86_64-linux-gnu
 --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-x=yes --with-x-toolkit=gtk3
 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-nDyT48/emacs-25.2+1=.
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: fr_FR.UTF-8
  value of $LC_NUMERIC: fr_FR.UTF-8
  value of $LC_TIME: fr_FR.UTF-8
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50ocaml-mode.el (source)...done
Loading /etc/emacs/site-start.d/51tuareg-mode.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Annotating...
vc-do-command: Running hg annotate -dq -n -u --follow -r0 merge.py...FAILED
(status 255)
Mark set
Making completion list...

Load-path shadows:
/usr/share/emacs/site-lisp/elpa/rust-mode-0.3.0/rust-mode-pkg hides
/usr/share/emacs/site-lisp/elpa-src/rust-mode-0.3.0/rust-mode-pkg
/usr/share/emacs/site-lisp/elpa/rust-mode-0.3.0/rust-mode hides
/usr/share/emacs/site-lisp/elpa-src/rust-mode-0.3.0/rust-mode
/usr/share/emacs/site-lisp/elpa/rust-mode-0.3.0/rust-mode-autoloads hides
/usr/share/emacs/site-lisp/elpa-src/rust-mode-0.3.0/rust-mode-autoloads

Features:
(shadow sort mail-extr emacsbug message dired rfc822 mml mml-sec epg
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils vc-annotate vc
vc-dispatcher vc-hg python tramp-sh tramp tramp-compat auth-source
cl-seq eieio eieio-core cl-macs gnus-util mm-util help-fns mail-prsvr
password-cache tramp-loaddefs trampver ucs-normalize shell pcomplete
format-spec advice json map comint ring ansi-color finder-inf info
package epg-config seq byte-opt gv bytecomp byte-compile cl-extra
help-mode easymenu cconv cl-loaddefs pcase cl-lib time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 240886 13755)
 (symbols 48 24982 0)
 (miscs 40 282 190)
 (strings 32 32555 6908)
 (string-bytes 1 1068597)
 (vectors 16 40552)
 (vector-slots 8 744800 4343)
 (floats 8 262 215)
 (intervals 56 506 0)
 (buffers 976 20))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36534; Package emacs. (Thu, 26 Nov 2020 11:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 36534 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>
Cc: 36534 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#36534: 25.2; mercurial vc-annotate sometimes fails when
 using the evolve mercurial extension
Date: Thu, 26 Nov 2020 12:56:39 +0100
Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com> writes:

> Sometimes, vc-annotate in a file tracked by mercurial returns an
> error like this instead of a proper annotate buffer:

[...]

> Step 3 is probably an hg bug. However `hg parent` was deprecated in
> 2014, so people may be reluctant to change it. And it would be simpler
> for vc-hg-working-revision to call `hg log -r . -T {rev}` (vc-git does
> that, so I assume that it works in general on top of fixing the
> current issue). `.` means the current revision, see `hg help revset`.
>
> So something like this:
> (defun vc-hg-working-revision (file)
>   "Hg-specific version of `vc-working-revision'."
>   (ignore-errors
>     (with-output-to-string
>       (vc-hg-command standard-output 0 nil
>     "log" "-r" "." "--template" "{rev}"))))

(This bug report unfortunately got no response at the time.)

I'm pretty unfamiliar with Mercurial, but perhaps Dmitry has some
comments here (added to the Cc's).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36534; Package emacs. (Sat, 28 Nov 2020 18:18:01 GMT) Full text and rfc822 format available.

Message #11 received at 36534 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>
Cc: 36534 <at> debbugs.gnu.org, Daniel Colascione <dancol <at> dancol.org>,
 Andrii Kolomoiets <andreyk.mad <at> gmail.com>
Subject: Re: bug#36534: 25.2; mercurial vc-annotate sometimes fails when using
 the evolve mercurial extension
Date: Sat, 28 Nov 2020 20:17:08 +0200
On 26.11.2020 13:56, Lars Ingebrigtsen wrote:
> Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com> writes:
> 
>> Sometimes, vc-annotate in a file tracked by mercurial returns an
>> error like this instead of a proper annotate buffer:
> 
> [...]
> 
>> Step 3 is probably an hg bug. However `hg parent` was deprecated in
>> 2014, so people may be reluctant to change it. And it would be simpler
>> for vc-hg-working-revision to call `hg log -r . -T {rev}` (vc-git does
>> that, so I assume that it works in general on top of fixing the
>> current issue). `.` means the current revision, see `hg help revset`.
>>
>> So something like this:
>> (defun vc-hg-working-revision (file)
>>    "Hg-specific version of `vc-working-revision'."
>>    (ignore-errors
>>      (with-output-to-string
>>        (vc-hg-command standard-output 0 nil
>>      "log" "-r" "." "--template" "{rev}"))))
> 
> (This bug report unfortunately got no response at the time.)
> 
> I'm pretty unfamiliar with Mercurial, but perhaps Dmitry has some
> comments here (added to the Cc's).

I have very little experience with Mercurial myself.

Perhaps Daniel or Andrii can comment.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36534; Package emacs. (Wed, 02 Dec 2020 11:19:01 GMT) Full text and rfc822 format available.

Message #14 received at 36534 <at> debbugs.gnu.org (full text, mbox):

From: Andrii Kolomoiets <andreyk.mad <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 36534 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Daniel Colascione <dancol <at> dancol.org>,
 Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>
Subject: Re: bug#36534: 25.2; mercurial vc-annotate sometimes fails when
 using the evolve mercurial extension
Date: Wed, 02 Dec 2020 13:17:56 +0200
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> On 26.11.2020 13:56, Lars Ingebrigtsen wrote:
>> Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com> writes:
>> 
>>> Sometimes, vc-annotate in a file tracked by mercurial returns an
>>> error like this instead of a proper annotate buffer:
>> [...]
>> 
>>> Step 3 is probably an hg bug. However `hg parent` was deprecated in
>>> 2014, so people may be reluctant to change it. And it would be simpler
>>> for vc-hg-working-revision to call `hg log -r . -T {rev}` (vc-git does
>>> that, so I assume that it works in general on top of fixing the
>>> current issue). `.` means the current revision, see `hg help revset`.
>>>
>>> So something like this:
>>> (defun vc-hg-working-revision (file)
>>>    "Hg-specific version of `vc-working-revision'."
>>>    (ignore-errors
>>>      (with-output-to-string
>>>        (vc-hg-command standard-output 0 nil
>>>      "log" "-r" "." "--template" "{rev}"))))
>> (This bug report unfortunately got no response at the time.)
>> I'm pretty unfamiliar with Mercurial, but perhaps Dmitry has some
>> comments here (added to the Cc's).
>
> I have very little experience with Mercurial myself.
>
> Perhaps Daniel or Andrii can comment.

Valentin did a pretty good investigation here.

But proposed change make the `vc-hg-working-revision` function ignore
the FILE arg, so the result will differ.

1. mkdir working-revision
2. cd working-revision
3. hg init
4. echo a > a
5. hg commit -Am0
6. echo b > b
7. hg commit -Am1
8. hg parent --template {rev} a
   => 0
   This is the old behavior of the `vc-hg-working-revision`
9. hg log -r . --template {rev}
   => 1
   And this is the new one.

Not sure what it may leads to.  Indeed the `vc-git-working-revision`
function ignores FILE as well.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36534; Package emacs. (Thu, 10 Dec 2020 00:27:01 GMT) Full text and rfc822 format available.

Message #17 received at 36534 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Andrii Kolomoiets <andreyk.mad <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>, 36534 <at> debbugs.gnu.org
Subject: Re: bug#36534: 25.2; mercurial vc-annotate sometimes fails when using
 the evolve mercurial extension
Date: Thu, 10 Dec 2020 02:26:18 +0200
Thanks Andrii,

On 02.12.2020 13:17, Andrii Kolomoiets wrote:
> Not sure what it may leads to.  Indeed the `vc-git-working-revision`
> function ignores FILE as well.

Sounds like it will indeed bring its behavior closer to vc-git's, which 
is generally better tested. Seems like a good thing.




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Thu, 10 Dec 2020 00:40:02 GMT) Full text and rfc822 format available.

Notification sent to Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>:
bug acknowledged by developer. (Thu, 10 Dec 2020 00:40:02 GMT) Full text and rfc822 format available.

Message #22 received at 36534-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>,
 36534-done <at> debbugs.gnu.org
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>,
 Andrii Kolomoiets <andreyk.mad <at> gmail.com>
Subject: Re: bug#36534: 25.2; mercurial vc-annotate sometimes fails when using
 the evolve mercurial extension
Date: Thu, 10 Dec 2020 02:39:41 +0200
Version: 28.1

Hi Valentin,

Sorry we're only doing this now.

On 07.07.2019 07:55, Valentin Gatien-Baron wrote:

> Step 3 is probably an hg bug. However `hg parent` was deprecated in
> 2014, so people may be reluctant to change it. And it would be simpler
> for vc-hg-working-revision to call `hg log -r . -T {rev}` (vc-git does
> that, so I assume that it works in general on top of fixing the
> current issue). `.` means the current revision, see `hg help revset`.
> 
> So something like this:
> (defun vc-hg-working-revision (file)
>    "Hg-specific version of `vc-working-revision'."
>    (ignore-errors
>      (with-output-to-string
>        (vc-hg-command standard-output 0 nil
>      "log" "-r" "." "--template" "{rev}"))))
> 
> (another reason to stop using `hg parents` is that during a merge, it
> will in most cases print two revisions, so if you annotate a file that
> was last changed in revision 123, emacs will likely get 123123 back
> and `hg annotate -r 123123` will fail)

Thanks for the thorough explanation. I have installed the patch in 
revision 4f352ad6f1 on master. Kinda messed up the attribution, but 
alas, not something I can fix now.

Aside from improved compatibility, the new implementation seems 
considerably faster, too. Like 100ms vs 600ms on mozilla-central, which 
is a huge repo.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36534; Package emacs. (Sat, 12 Dec 2020 18:56:01 GMT) Full text and rfc822 format available.

Message #25 received at 36534 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 36534 <at> debbugs.gnu.org
Cc: Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>, dgutov <at> yandex.ru
Subject: Re: bug#36534: closed (Re: bug#36534: 25.2;
 mercurial vc-annotate sometimes fails when using the evolve mercurial
 extension)
Date: Sat, 12 Dec 2020 13:54:53 -0500
Hi, this change causes a test failure.

Ref eg https://hydra.nixos.org/build/132497145




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36534; Package emacs. (Sun, 13 Dec 2020 01:58:01 GMT) Full text and rfc822 format available.

Message #28 received at 36534 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Glenn Morris <rgm <at> gnu.org>, 36534 <at> debbugs.gnu.org
Cc: Valentin Gatien-Baron <valentin.gatienbaron <at> gmail.com>
Subject: Re: bug#36534: closed (Re: bug#36534: 25.2; mercurial vc-annotate
 sometimes fails when using the evolve mercurial extension)
Date: Sun, 13 Dec 2020 03:57:12 +0200
Hi Glenn,

Thanks.

On 12.12.2020 20:54, Glenn Morris wrote:
> 
> Hi, this change causes a test failure.
> 
> Ref eg https://hydra.nixos.org/build/132497145

Apparently Hg shows revision "-1" for a file in a repository with no 
commits at all (which is confirmed by 
https://stackoverflow.com/a/28831490/615245).

I can't reproduce it locally, though. My Hg is 5.3.1, Hydra's is 4.7. 
Apparently that behavior changed at some point, but I can't find the 
exact version and change log entry.

The exact values are not very important for that test, so I'll just add 
another possible one.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 10 Jan 2021 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 106 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.