GNU bug report logs - #13004
24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).

Previous Next

Package: emacs;

Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>

Date: Mon, 26 Nov 2012 18:32:02 UTC

Severity: minor

Found in version 24.2

Fixed in version 30.1

Done: Dmitry Gutov <dmitry <at> gutov.dev>

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 13004 in the body.
You can then email your comments to 13004 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#13004; Package emacs. (Mon, 26 Nov 2012 18:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleksandr Gavenko <gavenkoa <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 26 Nov 2012 18:32:03 GMT) Full text and rfc822 format available.

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

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Mon, 26 Nov 2012 20:29:08 +0200
As always:

  $ emacs -Q

Next I open any file from Mercurial repo which is "hg mv" or "hg cp".

If you build history "C-x v l" and try to look diff (log-view-diff or "d") for
changeset before rename you get message, like:

  Finding changes in /home/user/devel/my-devel/gadict/en-pronunciation_ru.rst...
  No changes between 214 and 215

while:

  $ hg diff -r 215 en-pronunciation_ru.rst

  diff --git a/en-spelling_ru.rst b/en-pronunciation_ru.rst
  copy from en-spelling_ru.rst
  copy to en-pronunciation_ru.rst
  --- a/en-spelling_ru.rst
  +++ b/en-pronunciation_ru.rst
  @@ -1,5 +1,4 @@
   .. -*- coding: utf-8 -*-
  -
   .. include:: header.rst

   ===================


In GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-09 on trouble, modified by Debian

Also reproduced in GNU Emacs 24.2.50.1 (x86_64-unknown-linux-gnu, GTK+ Version
2.24.10):

  $ bzr info -v

  Related branches:
    parent branch: bzr://bzr.savannah.gnu.org/emacs/emacs-24/

  Branch history:
    110934 revisions
     10084 days old
   first revision: Thu 1985-04-18 00:48:29 +0000
  latest revision: Wed 2012-11-21 21:28:14 +0200

I expect that vc-view-diff follow history on copy as this do original CLI
client "hg".

-- 
Best regards!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Mon, 26 Nov 2012 21:48:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Mon, 26 Nov 2012 16:46:00 -0500
Oleksandr Gavenko wrote:

>   $ hg diff -r 215 en-pronunciation_ru.rst

Right, but what does

hg log en-pronunciation_ru.rst

show?

Emacs just calls hg log. It seems that by default this does not follow
renames. You can add "-f" to vc-hg-log-switches. I don't think this
should be there by default if it is not the default behaviour of hg
itself.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Mon, 26 Nov 2012 21:51:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Mon, 26 Nov 2012 16:49:00 -0500
Sorry, I didn't read properly. You were talking about calling "diff"
from a log buffer. I still think using log -f may help, since otherwise
it presumably looks like there is nothing to take a diff of. Does it
help?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Mon, 26 Nov 2012 21:56:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Mon, 26 Nov 2012 16:54:02 -0500
Glenn Morris wrote:

> Sorry, I didn't read properly. You were talking about calling "diff"
> from a log buffer. I still think using log -f may help, since otherwise
> it presumably looks like there is nothing to take a diff of. Does it
> help?

Answering my own question, no.
But what does

hg diff -r 214 -r 215 en-pronunciation_ru.rst

report for you?

For me, an equivalent diff command does not report any differences.
So this looks like an hg issue, not an Emacs one.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Mon, 26 Nov 2012 21:59:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Mon, 26 Nov 2012 16:56:37 -0500
A minimal test case starting from scratch would be helpful.

mkdir /tmp/test
cd /tmp/test
touch 1
hg init
hg add
hg commit -m "commit 1"

etc




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Tue, 27 Nov 2012 19:30:02 GMT) Full text and rfc822 format available.

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

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Tue, 27 Nov 2012 21:27:42 +0200
On 2012-11-26, Glenn Morris wrote:

> A minimal test case starting from scratch would be helpful.
>
> mkdir /tmp/test
> cd /tmp/test
> touch 1
> hg init
> hg add
> hg commit -m "commit 1"
>

  md /tmp/test
  hg init
  echo xxx >>README
  hg add
  hg ci -m init
  echo yyy >>README
  hg ci -m before
  hg mv README INSTALL
  hg ci -m rename
  echo zzz >>INSTALL
  hg ci -m after

Open INSTALL file in Emacs. "C-x v l" ("vc-print-log"). You get (I drop some
output):

  changeset:   3:00cf2a4ab691
  tag:         tip
  files:       INSTALL
  description:
  after

  changeset:   2:c6a81dfaea75
  files:       INSTALL README
  description:
  rename

  changeset:   1:9457c3fba41e
  files:       README
  description:
  before

  changeset:   0:ae606f956f03
  files:       README
  description:
  init

In changeset 3 "d" (log-view-diff) fine:

  diff --git a/INSTALL b/INSTALL
  --- a/INSTALL
  +++ b/INSTALL
  @@ -1,2 +1,3 @@
   xxx
   yyy
  +zzz

In changeset 2 "d" (log-view-diff) fine:

  diff --git a/README b/INSTALL
  copy from README
  copy to INSTALL

In changeset 1 "d" (log-view-diff) fail: empty *vc-diff* buffer and message:

  Finding changes in /tmp/test/INSTALL...
  No changes between 0 and 1

While I run in pure shell:

  $ hg diff -r 1 INSTALL
  diff --git a/README b/INSTALL
  rename from README
  rename to INSTALL
  --- a/README
  +++ b/INSTALL
  @@ -1,2 +1,3 @@
   xxx
   yyy
  +zzz

Also you ask to call:

  $ hg diff -r 1 -r 2 INSTALL
  diff --git a/README b/INSTALL
  copy from README
  copy to INSTALL

-- 
Best regards!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Tue, 27 Nov 2012 20:12:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Tue, 27 Nov 2012 15:09:47 -0500
Oleksandr Gavenko wrote:

>   md /tmp/test
>   hg init
>   echo xxx >>README
>   hg add
>   hg ci -m init
>   echo yyy >>README
>   hg ci -m before
>   hg mv README INSTALL
>   hg ci -m rename
>   echo zzz >>INSTALL
>   hg ci -m after

Perfect, thanks. (Assuming md == mkdir && cd)

> Open INSTALL file in Emacs. "C-x v l" ("vc-print-log"). You get (I drop some
> output):

I had to add -f to vc-hg-log-switches. I'm guessing you have it in .hgrc
maybe.

> In changeset 2 "d" (log-view-diff) fine:
>
>   diff --git a/README b/INSTALL
>   copy from README
>   copy to INSTALL

I had to add --git to vc-hg-diff-switches.

> In changeset 1 "d" (log-view-diff) fail: empty *vc-diff* buffer and message:
>
>   Finding changes in /tmp/test/INSTALL...
>   No changes between 0 and 1
[...]
>   $ hg diff -r 1 -r 2 INSTALL
>   diff --git a/README b/INSTALL
>   copy from README
>   copy to INSTALL

Obviously to compare with what you are asking Emacs to do, you need to run:

hg diff -r 0 -r 1 INSTALL

This prints nothing for me.

So I don't see any Emacs issue here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Tue, 27 Nov 2012 20:54:01 GMT) Full text and rfc822 format available.

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

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Tue, 27 Nov 2012 22:51:50 +0200
On 2012-11-27, Glenn Morris wrote:

> Oleksandr Gavenko wrote:
>
>>   md /tmp/test
>>   hg init
>>   echo xxx >>README
>>   hg add
>>   hg ci -m init
>>   echo yyy >>README
>>   hg ci -m before
>>   hg mv README INSTALL
>>   hg ci -m rename
>>   echo zzz >>INSTALL
>>   hg ci -m after
>
> Perfect, thanks. (Assuming md == mkdir && cd)
>
>> Open INSTALL file in Emacs. "C-x v l" ("vc-print-log"). You get (I drop some
>> output):
>
> I had to add -f to vc-hg-log-switches. I'm guessing you have it in .hgrc
> maybe.
>
Yes.

>> In changeset 2 "d" (log-view-diff) fine:
>>
>>   diff --git a/README b/INSTALL
>>   copy from README
>>   copy to INSTALL
>
> I had to add --git to vc-hg-diff-switches.
>
>> In changeset 1 "d" (log-view-diff) fail: empty *vc-diff* buffer and message:
>>
>>   Finding changes in /tmp/test/INSTALL...
>>   No changes between 0 and 1
> [...]
>>   $ hg diff -r 1 -r 2 INSTALL
>>   diff --git a/README b/INSTALL
>>   copy from README
>>   copy to INSTALL
>
> Obviously to compare with what you are asking Emacs to do, you need to run:
>
> hg diff -r 0 -r 1 INSTALL
>
> This prints nothing for me.
>
> So I don't see any Emacs issue here.

Sorry. My fail. I understand that...

I put proxy utility to logging Emacs calls to 'hg':

  #!/bin/sh
  echo "$@" >>~/tmp/hg.log
  /usr/bin/hg "$@"

so seen:

  "diff" "-r" "0" "-r" "1" "INSTALL"

Next I reread "hg help diff". Previously I make call:

  $ hg diff -r 1 INSTALL

but actually mean with "-c":

  $ hg diff -c 1 INSTALL

But that command print nothing... So you right that I misunderstand.

I surprised that Mercurial doesn't allow follow history per file. Actually it
handle renames as special case for merges.

In case of SVN - Emacs work as I expect (more precisely I hoped that HG work
as SVN):

  mkdir /tmp/test-svn
  cd /tmp/test-svn
  svnadmin create server-repo
  svn co file:///tmp/test-svn/server-repo/ local-repo
  cd local-repo
  echo xxx >>README
  svn add README
  svn ci -m init
  echo yyy >>README
  svn ci -m before1
  echo mmm >>README
  svn ci -m before2
  svn mv README INSTALL
  svn ci -m rename
  echo zzz >>INSTALL
  svn ci -m after

So for revision r3 "before2" I get diff:

  Index: README
  ===================================================================
  --- README	(revision 2)
  +++ README	(revision 3)
  @@ -1,2 +1,3 @@
   xxx
   yyy
  +mmm

  "svn"  "diff" "-r" "2:3" "INSTALL"

So for revision r2 "before1" I get diff:

  Index: README
  ===================================================================
  --- README	(revision 1)
  +++ README	(revision 2)
  @@ -1 +1,2 @@
   xxx
  +yyy

  svn "diff" "-r" "1:2" "INSTALL"


**PS** Why Emacs uses -r R1 -r R2 for HG? "-c" - do job more better as it
       actually compares to its first parent.

-- 
Best regards!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Tue, 27 Nov 2012 21:04:02 GMT) Full text and rfc822 format available.

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

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Tue, 27 Nov 2012 23:01:41 +0200
Additional info.

As we get know that HG doesn't allow follow history for HG another Emacs vc
module work as not expected.

So make test repo:

  mkdir /tmp/test
  cd /tmp/test
  hg init
  echo xxx >>README
  hg add
  hg ci -m init
  echo yyy >>README
  hg ci -m before
  hg mv README INSTALL
  hg ci -m rename
  echo zzz >>INSTALL
  hg ci -m after

open INSTALL file and annotate content (C-x v g runs the command vc-annotate).
Next go to previous version by "a" (vc-annotate-revision-previous-to-line) on
second line:

  0 Tue Nov 27 21:12:00 2012 +0200  README: xxx
  1 Tue Nov 27 21:12:23 2012 +0200  README: yyy          (*1*)
  3 Tue Nov 27 21:13:15 2012 +0200 INSTALL: zzz

So you move to:

  0 Tue Nov 27 21:12:00 2012 +0200 README: xxx           (*2*)

If you try move forward by "w" (vc-annotate-working-revision) Emacs print
error:

  vc-annotate-warp-revision: Invalid argument to vc-annotate-warp-revision

While in case of SVN we back to original state (*1*).

-- 
Best regards!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Wed, 28 Nov 2012 20:29:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Wed, 28 Nov 2012 15:26:33 -0500
Oleksandr Gavenko wrote:

> **PS** Why Emacs uses -r R1 -r R2 for HG? "-c" - do job more better as it
>        actually compares to its first parent.

Because the Emacs command is a specific instance of the general question
"find the difference between revisions R1 and R2". Naively, I expect
these two to be exactly equivalent when R2 = R1 + 1. `bzr help diff'
says they are, I didn't check.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13004; Package emacs. (Wed, 28 Nov 2012 20:32:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004 <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2;
	vc-diff from vc-log doesn't show diff before renames (for Mercurial
	backend).
Date: Wed, 28 Nov 2012 15:29:14 -0500
Oleksandr Gavenko wrote:

> Additional info.

(Seems more like a different bug report to me.)

> Next go to previous version by "a" (vc-annotate-revision-previous-to-line) on
> second line:
>
>   0 Tue Nov 27 21:12:00 2012 +0200  README: xxx
>   1 Tue Nov 27 21:12:23 2012 +0200  README: yyy          (*1*)
>   3 Tue Nov 27 21:13:15 2012 +0200 INSTALL: zzz
>
> So you move to:
>
>   0 Tue Nov 27 21:12:00 2012 +0200 README: xxx           (*2*)

Emacs is now looking at revision 0 of file "README".

> If you try move forward by "w" (vc-annotate-working-revision) Emacs print
> error:
>
>   vc-annotate-warp-revision: Invalid argument to vc-annotate-warp-revision

Ie, you try to jump to the working revision of file "README".
But file README has no working revision, hence the error.

I have no idea what, if anything, to do about that.




Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 28 Nov 2012 20:32:02 GMT) Full text and rfc822 format available.

Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Fri, 15 Dec 2023 21:10:02 GMT) Full text and rfc822 format available.

Notification sent to Oleksandr Gavenko <gavenkoa <at> gmail.com>:
bug acknowledged by developer. (Fri, 15 Dec 2023 21:10:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Glenn Morris <rgm <at> gnu.org>, Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 13004-done <at> debbugs.gnu.org
Subject: Re: bug#13004: 24.2; vc-diff from vc-log doesn't show diff before
 renames (for Mercurial backend).
Date: Fri, 15 Dec 2023 23:09:48 +0200
Version: 30.1

On 26/11/2012 23:54, Glenn Morris wrote:
> Glenn Morris wrote:
> 
>> Sorry, I didn't read properly. You were talking about calling "diff"
>> from a log buffer. I still think using log -f may help, since otherwise
>> it presumably looks like there is nothing to take a diff of. Does it
>> help?
> Answering my own question, no.
> But what does
> 
> hg diff -r 214 -r 215 en-pronunciation_ru.rst
> 
> report for you?
> 
> For me, an equivalent diff command does not report any differences.
> So this looks like an hg issue, not an Emacs one.

It can be called an Hg issue, but it resembles Git in this: both 'diff' 
and 'blame' commands require the file names that feature in the revision 
asked about, not the "current" ones.

In the course of fixing bug#55871, I've also added Hg support, so now 
you should have a button at the end of the revision history, if the last 
commit contains renames, to show the log for the previous name(s).

Note that for this to work, "-f" should _not_ be in vc-hg-log-switches.

Closing, but feedback welcome.




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

This bug report was last modified 110 days ago.

Previous Next


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