Mercurial > hg-stable
changeset 51355:866ab9f447d4
delta-find: simplify the delta checking function for snapshot
Since the function is all about snapshot, we can safely use an early return and
make the result simpler.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 07 Jan 2024 03:23:24 +0100 |
parents | f3f35b37f4b2 |
children | 2a333d791ecf |
files | mercurial/revlogutils/deltas.py |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py Sun Jan 07 00:56:15 2024 +0100 +++ b/mercurial/revlogutils/deltas.py Sun Jan 07 03:23:24 2024 +0100 @@ -739,24 +739,22 @@ This is used by is_good_delta_info. """ + # if not a snapshot, this method has no filtering to do + if deltainfo.snapshotdepth is None: + return True # bad delta from intermediate snapshot size limit # # If an intermediate snapshot size is higher than the limit. The # limit exist to prevent endless chain of intermediate delta to be # created. if ( - deltainfo.snapshotdepth is not None - and (self.revinfo.textlen >> deltainfo.snapshotdepth) - < deltainfo.deltalen - ): + self.revinfo.textlen >> deltainfo.snapshotdepth + ) < deltainfo.deltalen: return False # bad delta if new intermediate snapshot is larger than the previous # snapshot - if ( - deltainfo.snapshotdepth - and self.revlog.length(deltainfo.base) < deltainfo.deltalen - ): + if self.revlog.length(deltainfo.base) < deltainfo.deltalen: return False return True