##// END OF EJS Templates
perf: get subsettable from appropriate module for Mercurial earlier than 2.9...
FUJIWARA Katsunori -
r30144:14031d18 default
parent child Browse files
Show More
@@ -214,6 +214,24 b' def safeattrsetter(obj, name, ignoremiss'
214
214
215 return attrutil()
215 return attrutil()
216
216
217 # utilities to examine each internal API changes
218
219 def getbranchmapsubsettable():
220 # for "historical portability":
221 # subsettable is defined in:
222 # - branchmap since 2.9 (or 175c6fd8cacc)
223 # - repoview since 2.5 (or 59a9f18d4587)
224 for mod in (branchmap, repoview):
225 subsettable = getattr(mod, 'subsettable', None)
226 if subsettable:
227 return subsettable
228
229 # bisecting in bcee63733aad::59a9f18d4587 can reach here (both
230 # branchmap and repoview modules exist, but subsettable attribute
231 # doesn't)
232 raise error.Abort(("perfbranchmap not available with this Mercurial"),
233 hint="use 2.5 or later")
234
217 # perf commands
235 # perf commands
218
236
219 @command('perfwalk', formatteropts)
237 @command('perfwalk', formatteropts)
@@ -848,10 +866,11 b' def perfbranchmap(ui, repo, full=False, '
848 return d
866 return d
849 # add filter in smaller subset to bigger subset
867 # add filter in smaller subset to bigger subset
850 possiblefilters = set(repoview.filtertable)
868 possiblefilters = set(repoview.filtertable)
869 subsettable = getbranchmapsubsettable()
851 allfilters = []
870 allfilters = []
852 while possiblefilters:
871 while possiblefilters:
853 for name in possiblefilters:
872 for name in possiblefilters:
854 subset = branchmap.subsettable.get(name)
873 subset = subsettable.get(name)
855 if subset not in possiblefilters:
874 if subset not in possiblefilters:
856 break
875 break
857 else:
876 else:
@@ -10,6 +10,8 b' import sys'
10 # write static check patterns here
10 # write static check patterns here
11 perfpypats = [
11 perfpypats = [
12 [
12 [
13 (r'(branchmap|repoview)\.subsettable',
14 "use getbranchmapsubsettable() for early Mercurial"),
13 ],
15 ],
14 # warnings
16 # warnings
15 [
17 [
General Comments 0
You need to be logged in to leave comments. Login now