Mercurial > hg
comparison mercurial/revlog.py @ 38114:f79ba1d1b4b1
revlog: in _getcandidaterevs, shorten revlog._generaldelta to gdelta
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Fri, 04 May 2018 15:00:55 +0200 |
parents | 9bf0bd4d7a2e |
children | bf59f95583c1 |
comparison
equal
deleted
inserted
replaced
38113:f7a0398996ad | 38114:f79ba1d1b4b1 |
---|---|
303 """ | 303 """ |
304 Provides revisions that present an interest to be diffed against, | 304 Provides revisions that present an interest to be diffed against, |
305 grouped by level of easiness. | 305 grouped by level of easiness. |
306 """ | 306 """ |
307 revlog = self.revlog | 307 revlog = self.revlog |
308 gdelta = revlog._generaldelta | |
308 curr = len(revlog) | 309 curr = len(revlog) |
309 prev = curr - 1 | 310 prev = curr - 1 |
310 p1r, p2r = revlog.rev(p1), revlog.rev(p2) | 311 p1r, p2r = revlog.rev(p1), revlog.rev(p2) |
311 | 312 |
312 # should we try to build a delta? | 313 # should we try to build a delta? |
314 tested = set() | 315 tested = set() |
315 # This condition is true most of the time when processing | 316 # This condition is true most of the time when processing |
316 # changegroup data into a generaldelta repo. The only time it | 317 # changegroup data into a generaldelta repo. The only time it |
317 # isn't true is if this is the first revision in a delta chain | 318 # isn't true is if this is the first revision in a delta chain |
318 # or if ``format.generaldelta=true`` disabled ``lazydeltabase``. | 319 # or if ``format.generaldelta=true`` disabled ``lazydeltabase``. |
319 if cachedelta and revlog._generaldelta and revlog._lazydeltabase: | 320 if cachedelta and gdelta and revlog._lazydeltabase: |
320 # Assume what we received from the server is a good choice | 321 # Assume what we received from the server is a good choice |
321 # build delta will reuse the cache | 322 # build delta will reuse the cache |
322 yield (cachedelta[0],) | 323 yield (cachedelta[0],) |
323 tested.add(cachedelta[0]) | 324 tested.add(cachedelta[0]) |
324 | 325 |
325 if revlog._generaldelta: | 326 if gdelta: |
326 # exclude already lazy tested base if any | 327 # exclude already lazy tested base if any |
327 parents = [p for p in (p1r, p2r) | 328 parents = [p for p in (p1r, p2r) |
328 if p != nullrev and p not in tested] | 329 if p != nullrev and p not in tested] |
329 | 330 |
330 if not revlog._aggressivemergedeltas and len(parents) == 2: | 331 if not revlog._aggressivemergedeltas and len(parents) == 2: |