##// END OF EJS Templates
debugformat: speedup the "plain-cl-delta" check...
marmoute -
r52038:ddf2b33e default
parent child Browse files
Show More
@@ -5,6 +5,7 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import random
8
9
9 from ..i18n import _
10 from ..i18n import _
10 from .. import (
11 from .. import (
@@ -409,9 +410,17 b' class removecldeltachain(formatvariant):'
409 def fromrepo(repo):
410 def fromrepo(repo):
410 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
411 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
411 # changelogs with deltas.
412 # changelogs with deltas.
412 cl = repo.changelog
413 cl = repo.unfiltered().changelog
414 if len(cl) <= 1000:
415 some_rev = list(cl)
416 else:
417 # do a random sampling to speeds things up Scanning the whole
418 # repository can get really slow on bigger repo.
419 some_rev = sorted(
420 {random.randint(0, len(cl) - 1) for x in range(1000)}
421 )
413 chainbase = cl.chainbase
422 chainbase = cl.chainbase
414 return all(rev == chainbase(rev) for rev in cl)
423 return all(rev == chainbase(rev) for rev in some_rev)
415
424
416 @staticmethod
425 @staticmethod
417 def fromconfig(repo):
426 def fromconfig(repo):
General Comments 0
You need to be logged in to leave comments. Login now