##// END OF EJS Templates
perf: add `parent-2` as possible source for perfrevlogwrite...
Boris Feld -
r40588:b5b3dd4e default
parent child Browse files
Show More
@@ -1581,6 +1581,8 b' def perfrevlogwrite(ui, repo, file_=None'
1581 Possible source values are:
1581 Possible source values are:
1582 * `full`: add from a full text (default).
1582 * `full`: add from a full text (default).
1583 * `parent-1`: add from a delta to the first parent
1583 * `parent-1`: add from a delta to the first parent
1584 * `parent-2`: add from a delta to the second parent if it exists
1585 (use a delta from the first parent otherwise)
1584 """
1586 """
1585 opts = _byteskwargs(opts)
1587 opts = _byteskwargs(opts)
1586
1588
@@ -1592,7 +1594,7 b' def perfrevlogwrite(ui, repo, file_=None'
1592 stoprev = rllen + stoprev
1594 stoprev = rllen + stoprev
1593
1595
1594 source = opts['source']
1596 source = opts['source']
1595 validsource = (b'full', b'parent-1')
1597 validsource = (b'full', b'parent-1', b'parent-2')
1596 if source not in validsource:
1598 if source not in validsource:
1597 raise error.Abort('invalid source type: %s' % source)
1599 raise error.Abort('invalid source type: %s' % source)
1598
1600
@@ -1685,6 +1687,8 b' def _timeonewrite(ui, orig, source, star'
1685 return timings
1687 return timings
1686
1688
1687 def _getrevisionseed(orig, rev, tr, source):
1689 def _getrevisionseed(orig, rev, tr, source):
1690 from mercurial.node import nullid
1691
1688 linkrev = orig.linkrev(rev)
1692 linkrev = orig.linkrev(rev)
1689 node = orig.node(rev)
1693 node = orig.node(rev)
1690 p1, p2 = orig.parents(node)
1694 p1, p2 = orig.parents(node)
@@ -1697,6 +1701,12 b' def _getrevisionseed(orig, rev, tr, sour'
1697 elif source == b'parent-1':
1701 elif source == b'parent-1':
1698 baserev = orig.rev(p1)
1702 baserev = orig.rev(p1)
1699 cachedelta = (baserev, orig.revdiff(p1, rev))
1703 cachedelta = (baserev, orig.revdiff(p1, rev))
1704 elif source == b'parent-2':
1705 parent = p2
1706 if p2 == nullid:
1707 parent = p1
1708 baserev = orig.rev(parent)
1709 cachedelta = (baserev, orig.revdiff(parent, rev))
1700
1710
1701 return ((text, tr, linkrev, p1, p2),
1711 return ((text, tr, linkrev, p1, p2),
1702 {'node': node, 'flags': flags, 'cachedelta': cachedelta})
1712 {'node': node, 'flags': flags, 'cachedelta': cachedelta})
General Comments 0
You need to be logged in to leave comments. Login now