Show More
@@ -30,6 +30,7 b' from mercurial import (' | |||||
30 | commands, |
|
30 | commands, | |
31 | copies, |
|
31 | copies, | |
32 | error, |
|
32 | error, | |
|
33 | extensions, | |||
33 | mdiff, |
|
34 | mdiff, | |
34 | merge, |
|
35 | merge, | |
35 | obsolete, |
|
36 | obsolete, | |
@@ -48,7 +49,17 b' def safehasattr(thing, attr):' | |||||
48 | setattr(util, 'safehasattr', safehasattr) |
|
49 | setattr(util, 'safehasattr', safehasattr) | |
49 |
|
50 | |||
50 | formatteropts = commands.formatteropts |
|
51 | formatteropts = commands.formatteropts | |
51 | revlogopts = commands.debugrevlogopts |
|
52 | ||
|
53 | # for "historical portability": | |||
|
54 | # use locally defined option list, if debugrevlogopts isn't available, | |||
|
55 | # because commands.debugrevlogopts has been available since 3.7 (or | |||
|
56 | # 5606f7d0d063), even though cmdutil.openrevlog() has been available | |||
|
57 | # since 1.9 (or a79fea6b3e77). | |||
|
58 | revlogopts = getattr(commands, "debugrevlogopts", [ | |||
|
59 | ('c', 'changelog', False, ('open changelog')), | |||
|
60 | ('m', 'manifest', False, ('open manifest')), | |||
|
61 | ('', 'dir', False, ('open directory manifest')), | |||
|
62 | ]) | |||
52 |
|
63 | |||
53 | cmdtable = {} |
|
64 | cmdtable = {} | |
54 | command = cmdutil.command(cmdtable) |
|
65 | command = cmdutil.command(cmdtable) | |
@@ -821,3 +832,18 b' def perflrucache(ui, size=4, gets=10000,' | |||||
821 | timer, fm = gettimer(ui, opts) |
|
832 | timer, fm = gettimer(ui, opts) | |
822 | timer(fn, title=title) |
|
833 | timer(fn, title=title) | |
823 | fm.end() |
|
834 | fm.end() | |
|
835 | ||||
|
836 | def uisetup(ui): | |||
|
837 | if (util.safehasattr(cmdutil, 'openrevlog') and | |||
|
838 | not util.safehasattr(commands, 'debugrevlogopts')): | |||
|
839 | # for "historical portability": | |||
|
840 | # In this case, Mercurial should be 1.9 (or a79fea6b3e77) - | |||
|
841 | # 3.7 (or 5606f7d0d063). Therefore, '--dir' option for | |||
|
842 | # openrevlog() should cause failure, because it has been | |||
|
843 | # available since 3.5 (or 49c583ca48c4). | |||
|
844 | def openrevlog(orig, repo, cmd, file_, opts): | |||
|
845 | if opts.get('dir') and not util.safehasattr(repo, 'dirlog'): | |||
|
846 | raise error.Abort("This version doesn't support --dir option", | |||
|
847 | hint="use 3.5 or later") | |||
|
848 | return orig(repo, cmd, file_, opts) | |||
|
849 | extensions.wrapfunction(cmdutil, 'openrevlog', openrevlog) |
General Comments 0
You need to be logged in to leave comments.
Login now