Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlogutils/deltas.py @ 39520:5aef5afa8654
snapshot: refine candidate snapshot base upward
Once we found a suitable snapshot base it is useful to check if it has a
"children" snapshot that would provide a better diff. This is useful when base
not directly related to stored revision are picked. In those case, we "jumped"
to this new chain at an arbitrary point, checking if a higher point is more
appropriate will help to provide better results and increase snapshot reuse.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 07 Sep 2018 11:17:36 -0400 |
parents | e4d4361d0bcd |
children | 05a165dc4f55 |
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py Fri Sep 07 11:17:35 2018 -0400 +++ b/mercurial/revlogutils/deltas.py Fri Sep 07 11:17:36 2018 -0400 @@ -658,6 +658,19 @@ if base == nullrev: break good = yield (base,) + # refine snapshot up + # + # XXX the _findsnapshots call can be expensive and is "duplicated" with + # the one done in `_rawgroups`. Once we start working on performance, + # we should make the two logics share this computation. + snapshots = collections.defaultdict(list) + _findsnapshots(revlog, snapshots, good + 1) + previous = None + while good != previous: + previous = good + children = tuple(sorted(c for c in snapshots[good])) + good = yield children + # we have found nothing yield None