For at least one changeset in my repository, when I 'hg log --stat' that changeset, I get significantly less differences then when I 'hg diff' that changeset. This is a merge changeset, but I would expect 'hg log' to report _more_ differences than 'hg diff'. As a result, in the history of the missing files, this changeset is not shown. The below output nicely demonstrates the bug : the '{diffstat}' keyword shows the diffstat that I would expect (ie. about 33 files), but the 'hg log --stat' output only mentions two files. hg log --rev SOME_REV --stat --template '{diffstat}\n\n' 33: +382/-115 docs/releaseNotes.xml | 29 +++++++++++++++++++++++++++++ src/com/Main.java | 11 ++++------- 2 files changed, 33 insertions(+), 7 deletions(-)
btw, 'hg verify' does not report any errors
By which metric is this considered critical? Can you please provide a script that demonstrates your issue - or even better find an example in for example mercurials own repo or alternatively some other public repo.
It's not critical: http://mercurial.selenic.com/wiki/ManagingBugs Is there anything interesting about this changeset? Is it a merge? Are there copies or renames?
I considered it critical because Mercurial appears to have lost data : if I hg log one of the files which don't show up in hg --stat, the changeset is now shown, ie. there appears to be history missing for the file. About the changeset : yes, it is a merge changeset, as described in the first entry : 'This is a merge changeset, but I would expect 'hg log' to report _more_ differences than 'hg diff''
Can you please provide a script that demonstrates your issue - or even better find an example in for example mercurials own repo or alternatively some other public repo.
We can find such csets in a repo with: $ hg log -r 'merge()' --stat --template '{rev}\n {diffstat}\n\n' | grep '^\s*[0-9]' > diffstats The most recent such cset is: changeset: 12172:74f54b7775f2 parent: 12171:cc39d07d2212 parent: 12170:581066a319e5 user: Thomas Arendsen Hein <thomas@intevation.de> date: Mon Sep 06 07:14:18 2010 +0200 summary: merge with stable tests/test-verify.t | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) That's the output with tip. Which disagrees with the correct output generated by: $ hg diff --rev 12171:12172 | diffstat b/tests/revlog-formatv0.py | 60 +++++++++++++++++++++++++++++++++++++++++++++ mercurial/verify.py | 2 - tests/test-verify.t | 14 ++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) This worked up until 1.6 (precisely!), because this cset broke it: $ hg log -r f786f changeset: 11488:f786fc4b8764 branch: stable tag: 1.6 user: Mads Kiilerich <mads@kiilerich.com> date: Tue Jun 29 12:12:34 2010 +0200 summary: log: follow filenames through renames (issue647) Upgrading back to urgent.
mpm : note that I also experience the issue on our server, which runs Mercurial 1.3.1.
willemv: I don't believe you: $ hg131 log -r 12172 --stat --template '{rev}\n {diffstat}\n\n' hg log: option --stat not recognized But also: $ hg131 log -pr 12172 | diffstat b/tests/revlog-formatv0.py | 60 +++++++++++++++++++++++++++++++++++++++++++++ mercurial/verify.py | 2 - tests/test-verify.t | 14 ++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) $ hg131 diff --rev 12171:12172 | diffstat b/tests/revlog-formatv0.py | 60 +++++++++++++++++++++++++++++++++++++++++++++ mercurial/verify.py | 2 - tests/test-verify.t | 14 ++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-)
mpm : on the server I notice the issue through the web interface : the summary of the changeset on the top only mentions the two files, the diff part shows all 33 files
Yep, that's known and intentional. The other 31 files are unchanged from the second parent. Remember, diff is merge-unaware.
Here's a unified test (with -1.5's correct output-) to show the bug: Create a test repo: $ hg init $ echo a > a $ hg ci -Am0 adding a $ echo b > b $ hg ci -Am1 adding b $ hg co 0 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo b > a $ hg ci -m2 created new head Merge: $ hg merge 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) Make sure there's a file listed in the merge to trigger the bug: $ echo c > a $ hg ci -m3 Two files shown here in diff: $ hg diff --rev 2:3 diff -r b09be438c43a -r 8e07aafe1edc a --- a/a Thu Jan 01 00:00:00 1970 +0000 +++ b/a Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,1 @@ -b +c diff -r b09be438c43a -r 8e07aafe1edc b --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/b Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +b Diff here should be the same: $ hg log -vpr 3 changeset: 3:8e07aafe1edc tag: tip parent: 2:b09be438c43a parent: 1:925d80f479bb user: test date: Thu Jan 01 00:00:00 1970 +0000 files: a description: 3 diff -r b09be438c43a -r 8e07aafe1edc a --- a/a Thu Jan 01 00:00:00 1970 +0000 +++ b/a Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,1 @@ -b +c diff -r b09be438c43a -r 8e07aafe1edc b --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/b Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +b
So 'hg log' does not show a file if the merge result is identical to the second parent ? The reasoning being that the change actually happened somewhere between the common ancestor and the second parent, and was simply merged in during the merge, so isn't really relevant to the merge ?
Okay, I see the relevant line now in 'hg help log' : 'Also, only files different from BOTH parents will appear in files' I was always under the -wrong- assumption that any file 'involved' in the merge was shown, regardless of differences between any of the parents.
Actually, looking a little further, the 'Also, only files different from BOTH parents will appear in files' doesn't seem to be correct. If I merge in a changeset from another branch, and then revert the change, the reverted file _still_ shows up on the files list of hg log, even though the file obviously is not changed wrt the first parent. Test script to reproduce : #!/bin/bash hg init test_repo cd test_repo echo "first line" >> file_to_merge hg add file_to_merge hg commit -m 'initial commit' hg branch stable echo "second line" >> file_to_merge hg commit -m 'change on stable' hg up -C default echo "some other file" >> second_file hg add second_file hg commit -m 'introducing another changeset' hg merge stable hg revert --rev default file_to_merge hg commit -m 'merged changes from branch stable' hg -v log --rev tip
Sorry, pressed submit too soon. The output of running that script is : changeset: 3:ed6d457ba72e tag: tip parent: 2:62ad387be740 parent: 1:8dfc13e5cd95 user: Willem Verstraeten <willem.verstraeten@luciad.com> date: Mon Sep 20 09:12:10 2010 +0200 files: file_to_merge description: merged changes from branch stable Notice that the 'file_to_merge' file is present in the files line of the log command
On 09/20/2010 09:13 AM, Willem Verstraeten wrote: > Actually, looking a little further, the 'Also, only files > different from BOTH parents will appear in files' doesn't seem to be > correct. The description is correct, but it doesn't explain all details. Mercurial tracks history, so a file is more than just it contents. "Different file" is thus a bit tricky. It doesn't just mean "same content" but more whether it _is_ the same file. In your example you revert the file to _look_ like it looked in the other parent, but that doesn't _make_ it the file from the other parent. But that is a different story. Lets focus on the regression here on this issue. Matt pointed out what the problem was, and we will restore the functionality as it was in eca7f719201b, just before f786fc4b8764.
Fixed by http://hg.intevation.org/mercurial/crew/rev/28ddf67198b2 Mads Kiilerich <mads@kiilerich.com> log: include unmodified-in-merge files in log diff/stat (issue2383)
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:12 EDT --- This bug was previously known as _bug_ 2383 at http://mercurial.selenic.com/bts/issue2383