##// END OF EJS Templates
perf: support looking up multiple revisions...
Boris Feld -
r41484:7eb7637e default
parent child Browse files
Show More
@@ -1014,7 +1014,7 b' def perfignore(ui, repo, **opts):'
1014 fm.end()
1014 fm.end()
1015
1015
1016 @command(b'perfindex', [
1016 @command(b'perfindex', [
1017 (b'', b'rev', b'', b'revision to be looked up (default tip)'),
1017 (b'', b'rev', [], b'revision to be looked up (default tip)'),
1018 (b'', b'no-lookup', None, b'do not revision lookup post creation'),
1018 (b'', b'no-lookup', None, b'do not revision lookup post creation'),
1019 ] + formatteropts)
1019 ] + formatteropts)
1020 def perfindex(ui, repo, **opts):
1020 def perfindex(ui, repo, **opts):
@@ -1023,7 +1023,18 b' def perfindex(ui, repo, **opts):'
1023 The default is to look `tip` up. Depending on the index implementation,
1023 The default is to look `tip` up. Depending on the index implementation,
1024 the revision looked up can matters. For example, an implementation
1024 the revision looked up can matters. For example, an implementation
1025 scanning the index will have a faster lookup time for `--rev tip` than for
1025 scanning the index will have a faster lookup time for `--rev tip` than for
1026 `--rev 0`.
1026 `--rev 0`. The number of looked up revisions and their order can also
1027 matters.
1028
1029 Example of useful set to test:
1030 * tip
1031 * 0
1032 * -10:
1033 * :10
1034 * -10: + :10
1035 * :10: + -10:
1036 * -10000:
1037 * -10000: + 0
1027
1038
1028 It is not currently possible to check for lookup of a missing node."""
1039 It is not currently possible to check for lookup of a missing node."""
1029 import mercurial.revlog
1040 import mercurial.revlog
@@ -1031,12 +1042,15 b' def perfindex(ui, repo, **opts):'
1031 timer, fm = gettimer(ui, opts)
1042 timer, fm = gettimer(ui, opts)
1032 mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
1043 mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg
1033 if opts[b'no_lookup']:
1044 if opts[b'no_lookup']:
1034 n = None
1045 if opts['rev']:
1035 elif opts[b'rev'] is None:
1046 raise error.Abort('--no-lookup and --rev are mutually exclusive')
1036 n = repo[b"tip"].node()
1047 nodes = []
1048 elif not opts[b'rev']:
1049 nodes = [repo[b"tip"].node()]
1037 else:
1050 else:
1038 rev = scmutil.revsingle(repo, opts[b'rev'])
1051 revs = scmutil.revrange(repo, opts[b'rev'])
1039 n = repo[rev].node()
1052 cl = repo.changelog
1053 nodes = [cl.node(r) for r in revs]
1040
1054
1041 unfi = repo.unfiltered()
1055 unfi = repo.unfiltered()
1042 # find the filecache func directly
1056 # find the filecache func directly
@@ -1047,7 +1061,7 b' def perfindex(ui, repo, **opts):'
1047 clearchangelog(unfi)
1061 clearchangelog(unfi)
1048 def d():
1062 def d():
1049 cl = makecl(unfi)
1063 cl = makecl(unfi)
1050 if n is not None:
1064 for n in nodes:
1051 cl.rev(n)
1065 cl.rev(n)
1052 timer(d, setup=setup)
1066 timer(d, setup=setup)
1053 fm.end()
1067 fm.end()
General Comments 0
You need to be logged in to leave comments. Login now