unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
@ 2012-11-26 18:29 Oleksandr Gavenko
  2012-11-26 21:46 ` Glenn Morris
  2012-11-27 21:01 ` Oleksandr Gavenko
  0 siblings, 2 replies; 12+ messages in thread
From: Oleksandr Gavenko @ 2012-11-26 18:29 UTC (permalink / raw)
  To: 13004

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!





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-26 18:29 bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend) Oleksandr Gavenko
@ 2012-11-26 21:46 ` Glenn Morris
  2012-11-26 21:49   ` Glenn Morris
  2012-11-27 21:01 ` Oleksandr Gavenko
  1 sibling, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2012-11-26 21:46 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 13004

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-26 21:46 ` Glenn Morris
@ 2012-11-26 21:49   ` Glenn Morris
  2012-11-26 21:54     ` Glenn Morris
  0 siblings, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2012-11-26 21:49 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 13004


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?





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-26 21:49   ` Glenn Morris
@ 2012-11-26 21:54     ` Glenn Morris
  2012-11-26 21:56       ` Glenn Morris
  2023-12-15 21:09       ` Dmitry Gutov
  0 siblings, 2 replies; 12+ messages in thread
From: Glenn Morris @ 2012-11-26 21:54 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 13004

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-26 21:54     ` Glenn Morris
@ 2012-11-26 21:56       ` Glenn Morris
  2012-11-27 19:27         ` Oleksandr Gavenko
  2023-12-15 21:09       ` Dmitry Gutov
  1 sibling, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2012-11-26 21:56 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 13004


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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-26 21:56       ` Glenn Morris
@ 2012-11-27 19:27         ` Oleksandr Gavenko
  2012-11-27 20:09           ` Glenn Morris
  0 siblings, 1 reply; 12+ messages in thread
From: Oleksandr Gavenko @ 2012-11-27 19:27 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 13004

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!





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-27 19:27         ` Oleksandr Gavenko
@ 2012-11-27 20:09           ` Glenn Morris
  2012-11-27 20:51             ` Oleksandr Gavenko
  0 siblings, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2012-11-27 20:09 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 13004

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-27 20:09           ` Glenn Morris
@ 2012-11-27 20:51             ` Oleksandr Gavenko
  2012-11-28 20:26               ` Glenn Morris
  0 siblings, 1 reply; 12+ messages in thread
From: Oleksandr Gavenko @ 2012-11-27 20:51 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 13004

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!





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-26 18:29 bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend) Oleksandr Gavenko
  2012-11-26 21:46 ` Glenn Morris
@ 2012-11-27 21:01 ` Oleksandr Gavenko
  2012-11-28 20:29   ` Glenn Morris
  1 sibling, 1 reply; 12+ messages in thread
From: Oleksandr Gavenko @ 2012-11-27 21:01 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 13004

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!





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-27 20:51             ` Oleksandr Gavenko
@ 2012-11-28 20:26               ` Glenn Morris
  0 siblings, 0 replies; 12+ messages in thread
From: Glenn Morris @ 2012-11-28 20:26 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 13004

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-27 21:01 ` Oleksandr Gavenko
@ 2012-11-28 20:29   ` Glenn Morris
  0 siblings, 0 replies; 12+ messages in thread
From: Glenn Morris @ 2012-11-28 20:29 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 13004

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend).
  2012-11-26 21:54     ` Glenn Morris
  2012-11-26 21:56       ` Glenn Morris
@ 2023-12-15 21:09       ` Dmitry Gutov
  1 sibling, 0 replies; 12+ messages in thread
From: Dmitry Gutov @ 2023-12-15 21:09 UTC (permalink / raw)
  To: Glenn Morris, Oleksandr Gavenko; +Cc: 13004-done

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-12-15 21:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-26 18:29 bug#13004: 24.2; vc-diff from vc-log doesn't show diff before renames (for Mercurial backend) Oleksandr Gavenko
2012-11-26 21:46 ` Glenn Morris
2012-11-26 21:49   ` Glenn Morris
2012-11-26 21:54     ` Glenn Morris
2012-11-26 21:56       ` Glenn Morris
2012-11-27 19:27         ` Oleksandr Gavenko
2012-11-27 20:09           ` Glenn Morris
2012-11-27 20:51             ` Oleksandr Gavenko
2012-11-28 20:26               ` Glenn Morris
2023-12-15 21:09       ` Dmitry Gutov
2012-11-27 21:01 ` Oleksandr Gavenko
2012-11-28 20:29   ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).