##// END OF EJS Templates
context: start walking from "introrev" in blockancestors()...
Denis Laxalde -
r32063:befefdd3 stable
parent child Browse files
Show More
@@ -1192,6 +1192,9 b' def blockancestors(fctx, fromline, tolin'
1192 `fromline`-`toline` range.
1192 `fromline`-`toline` range.
1193 """
1193 """
1194 diffopts = patch.diffopts(fctx._repo.ui)
1194 diffopts = patch.diffopts(fctx._repo.ui)
1195 introrev = fctx.introrev()
1196 if fctx.rev() != introrev:
1197 fctx = fctx.filectx(fctx.filenode(), changeid=introrev)
1195 visit = {(fctx.linkrev(), fctx.filenode()): (fctx, (fromline, toline))}
1198 visit = {(fctx.linkrev(), fctx.filenode()): (fctx, (fromline, toline))}
1196 while visit:
1199 while visit:
1197 c, linerange2 = visit.pop(max(visit))
1200 c, linerange2 = visit.pop(max(visit))
@@ -488,6 +488,8 b' Test followlines() revset; we usually ch'
488 followlines(pat, range, descend=True) to make sure both give the same result
488 followlines(pat, range, descend=True) to make sure both give the same result
489 when they should.
489 when they should.
490
490
491 $ echo a >> foo
492 $ hg ci -m 'foo: add a'
491 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
493 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
492 16: baz:0
494 16: baz:0
493 19: baz:3
495 19: baz:3
@@ -528,17 +530,17 b' when they should.'
528 16: baz:0
530 16: baz:0
529 19: baz:3
531 19: baz:3
530 20: baz:4
532 20: baz:4
531 23: baz:3->3+
533 24: baz:3->3+
532 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
534 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
533 19: baz:3
535 19: baz:3
534 20: baz:4
536 20: baz:4
535 23: baz:3->3+
537 24: baz:3->3+
536 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
538 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
537 21: added two lines with 0
539 22: added two lines with 0
538
540
539 file patterns are okay
541 file patterns are okay
540 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
542 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
541 21: added two lines with 0
543 22: added two lines with 0
542
544
543 renames are followed
545 renames are followed
544 $ hg mv baz qux
546 $ hg mv baz qux
@@ -549,15 +551,15 b' renames are followed'
549 16: baz:0
551 16: baz:0
550 19: baz:3
552 19: baz:3
551 20: baz:4
553 20: baz:4
552 23: baz:3->3+
554 24: baz:3->3+
553 24: qux:4->4+
555 25: qux:4->4+
554
556
555 but are missed when following children
557 but are missed when following children
556 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
558 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
557 23: baz:3->3+
559 24: baz:3->3+
558
560
559 merge
561 merge
560 $ hg up 23 --quiet
562 $ hg up 24 --quiet
561 $ echo 7 >> baz
563 $ echo 7 >> baz
562 $ hg ci -m 'one more line, out of line range'
564 $ hg ci -m 'one more line, out of line range'
563 created new head
565 created new head
@@ -568,9 +570,9 b' merge'
568 16: baz:0
570 16: baz:0
569 19: baz:3
571 19: baz:3
570 20: baz:4
572 20: baz:4
571 23: baz:3->3+
573 24: baz:3->3+
572 26: baz:3+->3-
574 27: baz:3+->3-
573 $ hg merge 24
575 $ hg merge 25
574 merging baz and qux to qux
576 merging baz and qux to qux
575 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
577 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
576 (branch merge, don't forget to commit)
578 (branch merge, don't forget to commit)
@@ -579,12 +581,12 b' merge'
579 16: baz:0
581 16: baz:0
580 19: baz:3
582 19: baz:3
581 20: baz:4
583 20: baz:4
582 23: baz:3->3+
584 24: baz:3->3+
583 24: qux:4->4+
585 25: qux:4->4+
584 26: baz:3+->3-
586 27: baz:3+->3-
585 27: merge
587 28: merge
586 $ hg up 24 --quiet
588 $ hg up 25 --quiet
587 $ hg merge 26
589 $ hg merge 27
588 merging qux and baz to qux
590 merging qux and baz to qux
589 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
591 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
590 (branch merge, don't forget to commit)
592 (branch merge, don't forget to commit)
@@ -594,28 +596,28 b' merge'
594 16: baz:0
596 16: baz:0
595 19: baz:3
597 19: baz:3
596 20: baz:4
598 20: baz:4
597 23: baz:3->3+
599 24: baz:3->3+
598 24: qux:4->4+
600 25: qux:4->4+
599 26: baz:3+->3-
601 27: baz:3+->3-
600 28: merge from other side
602 29: merge from other side
601 $ hg up 23 --quiet
603 $ hg up 24 --quiet
602
604
603 we are missing the branch with rename when following children
605 we are missing the branch with rename when following children
604 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=25, descend=True)'
606 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
605 26: baz:3+->3-
607 27: baz:3+->3-
606
608
607 we follow all branches in descending direction
609 we follow all branches in descending direction
608 $ hg up 22 --quiet
610 $ hg up 23 --quiet
609 $ sed 's/3/+3/' baz > baz.new
611 $ sed 's/3/+3/' baz > baz.new
610 $ mv baz.new baz
612 $ mv baz.new baz
611 $ hg ci -m 'baz:3->+3'
613 $ hg ci -m 'baz:3->+3'
612 created new head
614 created new head
613 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
615 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
614 @ 29: baz:3->+3
616 @ 30: baz:3->+3
615 :
617 :
616 : o 26: baz:3+->3-
618 : o 27: baz:3+->3-
617 : :
619 : :
618 : o 23: baz:3->3+
620 : o 24: baz:3->3+
619 :/
621 :/
620 o 20: baz:4
622 o 20: baz:4
621 |\
623 |\
@@ -628,7 +630,7 b' we follow all branches in descending dir'
628 ~
630 ~
629
631
630 check error cases
632 check error cases
631 $ hg up 23 --quiet
633 $ hg up 24 --quiet
632 $ hg log -r 'followlines()'
634 $ hg log -r 'followlines()'
633 hg: parse error: followlines takes at least 1 positional arguments
635 hg: parse error: followlines takes at least 1 positional arguments
634 [255]
636 [255]
@@ -1220,6 +1220,8 b" filelog with 'linerange' and 'patch'"
1220 > f+
1220 > f+
1221 > EOF
1221 > EOF
1222 $ hg ci -m 'touching beginning and end of c' c
1222 $ hg ci -m 'touching beginning and end of c' c
1223 $ echo c > cc
1224 $ hg ci -Am 'tip does not touch c' cc
1223 $ hg log -r 'followlines(c, 3:4, startrev=tip) and follow(c)' -p
1225 $ hg log -r 'followlines(c, 3:4, startrev=tip) and follow(c)' -p
1224 changeset: 0:6563da9dcf87
1226 changeset: 0:6563da9dcf87
1225 user: test
1227 user: test
@@ -1289,7 +1291,6 b" filelog with 'linerange' and 'patch'"
1289
1291
1290 changeset: 11:fb9bc322513a
1292 changeset: 11:fb9bc322513a
1291 branch: a-branch
1293 branch: a-branch
1292 tag: tip
1293 user: test
1294 user: test
1294 date: Thu Jan 01 00:00:00 1970 +0000
1295 date: Thu Jan 01 00:00:00 1970 +0000
1295 summary: touching beginning and end of c
1296 summary: touching beginning and end of c
@@ -1369,7 +1370,7 b" filelog with 'linerange' and 'patch'"
1369 <div class="main">
1370 <div class="main">
1370 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1371 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1371 <h3>
1372 <h3>
1372 log c @ 11:<a href="/rev/fb9bc322513a">fb9bc322513a</a>
1373 log c @ 12:<a href="/rev/6e4182052f7b">6e4182052f7b</a>
1373 <span class="branchname">a-branch</span> <span class="tag">tip</span>
1374 <span class="branchname">a-branch</span> <span class="tag">tip</span>
1374 (following lines 3:4 <a href="/log/tip/c">back to filelog</a>)
1375 (following lines 3:4 <a href="/log/tip/c">back to filelog</a>)
1375 </h3>
1376 </h3>
@@ -1400,7 +1401,7 b" filelog with 'linerange' and 'patch'"
1400 <td class="author">test</td>
1401 <td class="author">test</td>
1401 <td class="description">
1402 <td class="description">
1402 <a href="/rev/fb9bc322513a">touching beginning and end of c</a>
1403 <a href="/rev/fb9bc322513a">touching beginning and end of c</a>
1403 <span class="branchhead">a-branch</span> <span class="tag">tip</span>
1404 <span class="branchname">a-branch</span>
1404 </td>
1405 </td>
1405 </tr>
1406 </tr>
1406 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
1407 <tr><td colspan="3"><div class="bottomline inc-lineno"><pre class="sourcelines wrap">
@@ -1546,7 +1547,6 b" filelog with 'linerange' and 'patch'"
1546
1547
1547 changeset: 11:fb9bc322513a
1548 changeset: 11:fb9bc322513a
1548 branch: a-branch
1549 branch: a-branch
1549 tag: tip
1550 user: test
1550 user: test
1551 date: Thu Jan 01 00:00:00 1970 +0000
1551 date: Thu Jan 01 00:00:00 1970 +0000
1552 summary: touching beginning and end of c
1552 summary: touching beginning and end of c
@@ -1675,7 +1675,7 b" filelog with 'linerange' and 'patch'"
1675 <td class="author">test</td>
1675 <td class="author">test</td>
1676 <td class="description">
1676 <td class="description">
1677 <a href="/rev/fb9bc322513a">touching beginning and end of c</a>
1677 <a href="/rev/fb9bc322513a">touching beginning and end of c</a>
1678 <span class="branchhead">a-branch</span> <span class="tag">tip</span>
1678 <span class="branchname">a-branch</span>
1679 </td>
1679 </td>
1680 </tr>
1680 </tr>
1681
1681
General Comments 0
You need to be logged in to leave comments. Login now