diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1192,6 +1192,9 @@ def blockancestors(fctx, fromline, tolin `fromline`-`toline` range. """ diffopts = patch.diffopts(fctx._repo.ui) + introrev = fctx.introrev() + if fctx.rev() != introrev: + fctx = fctx.filectx(fctx.filenode(), changeid=introrev) visit = {(fctx.linkrev(), fctx.filenode()): (fctx, (fromline, toline))} while visit: c, linerange2 = visit.pop(max(visit)) diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -488,6 +488,8 @@ Test followlines() revset; we usually ch followlines(pat, range, descend=True) to make sure both give the same result when they should. + $ echo a >> foo + $ hg ci -m 'foo: add a' $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)' 16: baz:0 19: baz:3 @@ -528,17 +530,17 @@ when they should. 16: baz:0 19: baz:3 20: baz:4 - 23: baz:3->3+ + 24: baz:3->3+ $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)' 19: baz:3 20: baz:4 - 23: baz:3->3+ + 24: baz:3->3+ $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)' - 21: added two lines with 0 + 22: added two lines with 0 file patterns are okay $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)' - 21: added two lines with 0 + 22: added two lines with 0 renames are followed $ hg mv baz qux @@ -549,15 +551,15 @@ renames are followed 16: baz:0 19: baz:3 20: baz:4 - 23: baz:3->3+ - 24: qux:4->4+ + 24: baz:3->3+ + 25: qux:4->4+ but are missed when following children $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)' - 23: baz:3->3+ + 24: baz:3->3+ merge - $ hg up 23 --quiet + $ hg up 24 --quiet $ echo 7 >> baz $ hg ci -m 'one more line, out of line range' created new head @@ -568,9 +570,9 @@ merge 16: baz:0 19: baz:3 20: baz:4 - 23: baz:3->3+ - 26: baz:3+->3- - $ hg merge 24 + 24: baz:3->3+ + 27: baz:3+->3- + $ hg merge 25 merging baz and qux to qux 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -579,12 +581,12 @@ merge 16: baz:0 19: baz:3 20: baz:4 - 23: baz:3->3+ - 24: qux:4->4+ - 26: baz:3+->3- - 27: merge - $ hg up 24 --quiet - $ hg merge 26 + 24: baz:3->3+ + 25: qux:4->4+ + 27: baz:3+->3- + 28: merge + $ hg up 25 --quiet + $ hg merge 27 merging qux and baz to qux 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -594,28 +596,28 @@ merge 16: baz:0 19: baz:3 20: baz:4 - 23: baz:3->3+ - 24: qux:4->4+ - 26: baz:3+->3- - 28: merge from other side - $ hg up 23 --quiet + 24: baz:3->3+ + 25: qux:4->4+ + 27: baz:3+->3- + 29: merge from other side + $ hg up 24 --quiet we are missing the branch with rename when following children - $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=25, descend=True)' - 26: baz:3+->3- + $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)' + 27: baz:3+->3- we follow all branches in descending direction - $ hg up 22 --quiet + $ hg up 23 --quiet $ sed 's/3/+3/' baz > baz.new $ mv baz.new baz $ hg ci -m 'baz:3->+3' created new head $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph - @ 29: baz:3->+3 + @ 30: baz:3->+3 : - : o 26: baz:3+->3- + : o 27: baz:3+->3- : : - : o 23: baz:3->3+ + : o 24: baz:3->3+ :/ o 20: baz:4 |\ @@ -628,7 +630,7 @@ we follow all branches in descending dir ~ check error cases - $ hg up 23 --quiet + $ hg up 24 --quiet $ hg log -r 'followlines()' hg: parse error: followlines takes at least 1 positional arguments [255] diff --git a/tests/test-hgweb-filelog.t b/tests/test-hgweb-filelog.t --- a/tests/test-hgweb-filelog.t +++ b/tests/test-hgweb-filelog.t @@ -1220,6 +1220,8 @@ filelog with 'linerange' and 'patch' > f+ > EOF $ hg ci -m 'touching beginning and end of c' c + $ echo c > cc + $ hg ci -Am 'tip does not touch c' cc $ hg log -r 'followlines(c, 3:4, startrev=tip) and follow(c)' -p changeset: 0:6563da9dcf87 user: test @@ -1289,7 +1291,6 @@ filelog with 'linerange' and 'patch' changeset: 11:fb9bc322513a branch: a-branch - tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: touching beginning and end of c @@ -1369,7 +1370,7 @@ filelog with 'linerange' and 'patch'

- log c @ 11:fb9bc322513a + log c @ 12:6e4182052f7b a-branch tip (following lines 3:4 back to filelog)

@@ -1400,7 +1401,7 @@ filelog with 'linerange' and 'patch' test touching beginning and end of c - a-branch tip + a-branch
@@ -1546,7 +1547,6 @@ filelog with 'linerange' and 'patch'
   
   changeset:   11:fb9bc322513a
   branch:      a-branch
-  tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     touching beginning and end of c
@@ -1675,7 +1675,7 @@ filelog with 'linerange' and 'patch'
     test
     
      touching beginning and end of c
-     a-branch tip 
+     a-branch