Mercurial annotate / wame gives invalid source version

Recently, I had a problem tracking the set of changes responsible for a specific line in the source file. hg blame gave me a revision that never merged into the industry that interests me.

I found that if a similar unrelated change occurs, Mercurial will still show it as the original revision. Is this a mistake or should it behave like this? If the latter, could you explain why.

Here is a minimal example:

 hg init test cd test # Create a new file that has 3 lines echo "111\n222\n333" > test.txt hg commit -Am "Original file" # Append "444" to the file echo "444" >> test.txt hg commit -m "Abandoned change" # Go back to the first revision and append the same "444" to the file hg up 0 echo "444" >> test.txt hg commit -m "Actual change" 

Here's what the repo looks like:

 $ hg glog @ changeset: 2:1b16b07e058e | tag: tip | parent: 0:e58635de081c | user: Nobody < nobody@nowhere.org > | date: Tue Nov 20 17:17:41 2012 +0100 | summary: Actual change | | o changeset: 1:b02ee64b2e2d |/ user: Nobody < nobody@nowhere.org > | date: Tue Nov 20 17:17:41 2012 +0100 | summary: Abandoned change | o changeset: 0:e58635de081c user: Nobody < nobody@nowhere.org > date: Tue Nov 20 17:17:41 2012 +0100 summary: Original file 

Now when I run hg blame , I expect to see the last line coming from change set 2, not changeet 1.

 $ hg blame test.txt 0: 111 0: 222 0: 333 1: 444 
+4
source share
1 answer

This is not the intended behavior; you end up in Bug 1839 .

+4
source

Source: https://habr.com/ru/post/1447276/


All Articles