1. TortoiseHg
  2. TortoiseHg
  3. thg
  4. Issues
Issue #2313 resolved

Diff selected file revisions not working after move/rename

Anonymous created an issue

Hello,

If I move files to a directory above or do a rename, and then do a "guess rename" and commit to inform Mercurial of my actions, I notice that TortoiseHG is then not able to show me the changes between a revision after the rename and one before that rename.

The file from the revision after the rename is properly shown in the left hand-side of the diffing tool, but in the right-hand side I get a "[non-existant]", followed by the revision number.

The hg file log viewer show me all the revisions for this files, so the history is definitely still there, and I'm able to extract a previous version of this file from the repository.

I believe that it is due to the fact that when the external file rename is launched, TortoiseHG might try to find the previous version of file using its old path / file name? I've tried using BeyondCompare3 and TortoiseMerge.

I'm however still able to do the diffing through Visual Studio using hgsccpackage. I noticed that hgsccpackage extracts the file from the previous revision to a temporary file, and then uses it for the compare.

This seems a good workaround for this problem and I was wondering if the same could be done implemented in TortoiseHG, as a failover to the current method? (unless it already is and some option needs to be enabled?)

Thank you.

Comments (4)

  1. Yuya Nishihara

    I couldn't reproduce the issue by the following history, using kdiff3:

    % hg log -pv --style compact
    1[tip]   996a7c40036a   2012-12-09 17:25 +0900   Yuya Nishihara <yuya@tcha.org>
      rename bar/baz qux
    
    diff --git a/bar/baz b/qux
    rename from bar/baz
    rename to qux
    
    0   4627d0c6dde9   2012-12-09 17:24 +0900   Yuya Nishihara <yuya@tcha.org>
      add bar/baz
    
    diff --git a/bar/baz b/bar/baz
    new file mode 100644
    --- /dev/null
    +++ b/bar/baz
    @@ -0,0 +1,1 @@
    +quick fox
    

    Both visual diff 1-to-0 and 0-to-1 worked without non-existant message.

    Could you attach a simple repro case?

  2. Kharlos Dominguez

    Thank you. Here is how to reproduce it. I'm using the latest version (2.6) on Windows XP x64.


    md renametest

    cd renametest

    hg init

    md originaldir

    cd originaldir

    md originalsubdir

    cd originalsubdir

    echo First line>test.txt

    hg add test.txt

    hg commit -m "Initial commit."

    Echo Move the file to the parent directory above...

    move test.txt ..\

    cd..

    hg addremove

    echo Second Line >>test.txt

    hg commit -m "Moved the test.txt file one level above and added a second line."


    Then, I right click on my test.txt file and click TortoiseHg -> Revision History Then I select both versions and choose "Diff selected file versions", as shown in the picture below. http://s10.postimage.org/ja82r0cyx/tortoisehg.png

    Then Kdiff3 opens, like in the picture below: http://s10.postimage.org/4st91zf6x/Kdiff3.png

    Kdiff3 has been opened with the following parameters:

    "C:\Program Files\TortoiseHg\kdiff3.exe" --L1 "originaldir/test.txt@1:2a9f6e3e8431" --L2 "[non-existant]Sanjit Saluja:85b63e766c28" "c:\docume~1\user\locals~1\temp\thg.aq4gwy\renametest.1.1\originaldir/test.txt" "c:\docume~1\user\locals~1\temp\thg.aq4gwy\empty"

    Please note that it is trying to compare to the file named "empty", which actually exists on the file system, but is empty.

    Thanks in advance.

  3. Yuya Nishihara

    Thanks for nice repro script.

    I guess filename matcher blocks to follow copy-source file.

    % hg diff -r1:0 originaldir/test.txt
    diff --git a/originaldir/test.txt b/originaldir/test.txt
    deleted file mode 100644
    --- a/originaldir/test.txt
    +++ /dev/null
    @@ -1,2 +0,0 @@
    -First line
    -Second Line
    
    % hg diff -r1:0 originaldir/test.txt originaldir/originalsubdir/test.txt
    diff --git a/originaldir/test.txt b/originaldir/originalsubdir/test.txt
    rename from originaldir/test.txt
    rename to originaldir/originalsubdir/test.txt
    --- a/originaldir/test.txt
    +++ b/originaldir/originalsubdir/test.txt
    @@ -1,2 +1,1 @@
     First line
    -Second Line
    
  4. Log in to comment