Mercurial > hg
comparison mercurial/revlog.py @ 38102:9bf0bd4d7a2e
revlog: suggest other parent when a parent was refused for a delta (issue5481)
Without aggressivemergedeltas, ensure that when we decline the closest parent
(by revision number), the other parent is examined too.
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Mon, 14 May 2018 13:05:14 +0200 |
parents | a4942675de6b |
children | f79ba1d1b4b1 |
comparison
equal
deleted
inserted
replaced
38101:6acf41bb8d40 | 38102:9bf0bd4d7a2e |
---|---|
324 | 324 |
325 if revlog._generaldelta: | 325 if revlog._generaldelta: |
326 # exclude already lazy tested base if any | 326 # exclude already lazy tested base if any |
327 parents = [p for p in (p1r, p2r) | 327 parents = [p for p in (p1r, p2r) |
328 if p != nullrev and p not in tested] | 328 if p != nullrev and p not in tested] |
329 if parents and not revlog._aggressivemergedeltas: | 329 |
330 # Pick whichever parent is closer to us (to minimize the | 330 if not revlog._aggressivemergedeltas and len(parents) == 2: |
331 # chance of having to build a fulltext). | 331 parents.sort() |
332 parents = [max(parents)] | 332 # To minimize the chance of having to build a fulltext, |
333 tested.update(parents) | 333 # pick first whichever parent is closest to us (max rev) |
334 yield parents | 334 yield (parents[1],) |
335 # then the other one (min rev) if the first did not fit | |
336 yield (parents[0],) | |
337 tested.update(parents) | |
338 elif len(parents) > 0: | |
339 # Test all parents (1 or 2), and keep the best candidate | |
340 yield parents | |
341 tested.update(parents) | |
335 | 342 |
336 if prev not in tested: | 343 if prev not in tested: |
337 # other approach failed try against prev to hopefully save us a | 344 # other approach failed try against prev to hopefully save us a |
338 # fulltext. | 345 # fulltext. |
339 yield (prev,) | 346 yield (prev,) |