##// END OF EJS Templates
persistent-nodemap: add a "warn" option to the slow-path config...
marmoute -
r47028:fc2d5c0a default
parent child Browse files
Show More
@@ -1797,7 +1797,7 b' coreconfigitem('
1797 coreconfigitem(
1797 coreconfigitem(
1798 b'storage',
1798 b'storage',
1799 b'revlog.persistent-nodemap.slow-path',
1799 b'revlog.persistent-nodemap.slow-path',
1800 default=b"allow",
1800 default=b"warn",
1801 experimental=True,
1801 experimental=True,
1802 )
1802 )
1803
1803
@@ -1959,8 +1959,9 b' category impact performance and reposito'
1959 the feature:
1959 the feature:
1960
1960
1961 ``allow``: Silently use the slower implementation to access the repository.
1961 ``allow``: Silently use the slower implementation to access the repository.
1962
1962 ``warn``: Warn, but use the slower implementation to access the repository.
1963 Default to "allow"
1963
1964 Default to ``warn``
1964
1965
1965 For details on the "persistent-nodemap" feature, see:
1966 For details on the "persistent-nodemap" feature, see:
1966 :hg:`help config format.use-persistent-nodemap`.
1967 :hg:`help config format.use-persistent-nodemap`.
@@ -59,6 +59,7 b' from . import ('
59 rcutil,
59 rcutil,
60 repoview,
60 repoview,
61 requirements as requirementsmod,
61 requirements as requirementsmod,
62 revlog,
62 revset,
63 revset,
63 revsetlang,
64 revsetlang,
64 scmutil,
65 scmutil,
@@ -1047,7 +1048,7 b' def resolverevlogstorevfsoptions(ui, req'
1047 slow_path = ui.config(
1048 slow_path = ui.config(
1048 b'storage', b'revlog.persistent-nodemap.slow-path'
1049 b'storage', b'revlog.persistent-nodemap.slow-path'
1049 )
1050 )
1050 if slow_path not in (b'allow'):
1051 if slow_path not in (b'allow', b'warn'):
1051 default = ui.config_default(
1052 default = ui.config_default(
1052 b'storage', b'revlog.persistent-nodemap.slow-path'
1053 b'storage', b'revlog.persistent-nodemap.slow-path'
1053 )
1054 )
@@ -1059,6 +1060,21 b' def resolverevlogstorevfsoptions(ui, req'
1059 if not ui.quiet:
1060 if not ui.quiet:
1060 ui.warn(_(b'falling back to default value: %s\n') % default)
1061 ui.warn(_(b'falling back to default value: %s\n') % default)
1061 slow_path = default
1062 slow_path = default
1063
1064 msg = _(
1065 b"accessing `persistent-nodemap` repository without associated "
1066 b"fast implementation."
1067 )
1068 hint = _(
1069 b"check `hg help config.format.use-persistent-nodemap` "
1070 b"for details"
1071 )
1072 if slow_path == b'warn' and not revlog.HAS_FAST_PERSISTENT_NODEMAP:
1073 msg = b"warning: " + msg + b'\n'
1074 ui.warn(msg)
1075 if not ui.quiet:
1076 hint = b'(' + hint + b')\n'
1077 ui.warn(hint)
1062 options[b'persistent-nodemap'] = True
1078 options[b'persistent-nodemap'] = True
1063 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
1079 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
1064 options[b'persistent-nodemap.mmap'] = True
1080 options[b'persistent-nodemap.mmap'] = True
@@ -161,6 +161,16 b' def _verify_revision(rl, skipflags, stat'
161 rl.revision(node)
161 rl.revision(node)
162
162
163
163
164 # True if a fast implementation for persistent-nodemap is available
165 #
166 # We also consider we have a "fast" implementation in "pure" python because
167 # people using pure don't really have performance consideration (and a
168 # wheelbarrow of other slowness source)
169 HAS_FAST_PERSISTENT_NODEMAP = rustrevlog is not None or util.safehasattr(
170 parsers, 'BaseIndexObject'
171 )
172
173
164 @attr.s(slots=True, frozen=True)
174 @attr.s(slots=True, frozen=True)
165 class _revisioninfo(object):
175 class _revisioninfo(object):
166 """Information about a revision that allows building its fulltext
176 """Information about a revision that allows building its fulltext
@@ -8,8 +8,30 b' Test the persistent on-disk nodemap'
8 > [devel]
8 > [devel]
9 > persistent-nodemap=yes
9 > persistent-nodemap=yes
10 > EOF
10 > EOF
11 $ hg init test-repo
11
12 $ hg init test-repo --config storage.revlog.persistent-nodemap.slow-path=allow
12 $ cd test-repo
13 $ cd test-repo
14
15 Check handling of the default slow-path value
16
17 #if no-pure no-rust
18
19 $ hg id
20 warning: accessing `persistent-nodemap` repository without associated fast implementation.
21 (check `hg help config.format.use-persistent-nodemap` for details)
22 000000000000 tip
23
24 Unlock further check (we are here to test the feature)
25
26 $ cat << EOF >> $HGRCPATH
27 > [storage]
28 > # to avoid spamming the test
29 > revlog.persistent-nodemap.slow-path=allow
30 > EOF
31
32 #endif
33
34
13 $ hg debugformat
35 $ hg debugformat
14 format-variant repo
36 format-variant repo
15 fncache: yes
37 fncache: yes
@@ -23,9 +45,8 b' Test the persistent on-disk nodemap'
23 plain-cl-delta: yes
45 plain-cl-delta: yes
24 compression: zlib
46 compression: zlib
25 compression-level: default
47 compression-level: default
26 $ hg debugbuilddag .+5000 --new-file --config "storage.revlog.nodemap.mode=warn"
48 $ hg debugbuilddag .+5000 --new-file
27 persistent nodemap in strict mode without efficient method (no-rust no-pure !)
49
28 persistent nodemap in strict mode without efficient method (no-rust no-pure !)
29 $ hg debugnodemap --metadata
50 $ hg debugnodemap --metadata
30 uid: ???????????????? (glob)
51 uid: ???????????????? (glob)
31 tip-rev: 5000
52 tip-rev: 5000
@@ -116,11 +137,22 b' Check slow-path config value handling'
116
137
117 $ hg id --config "storage.revlog.persistent-nodemap.slow-path=invalid-value"
138 $ hg id --config "storage.revlog.persistent-nodemap.slow-path=invalid-value"
118 unknown value for config "storage.revlog.persistent-nodemap.slow-path": "invalid-value"
139 unknown value for config "storage.revlog.persistent-nodemap.slow-path": "invalid-value"
119 falling back to default value: allow
140 falling back to default value: warn
141 warning: accessing `persistent-nodemap` repository without associated fast implementation. (no-pure no-rust !)
142 (check `hg help config.format.use-persistent-nodemap` for details) (no-pure no-rust !)
120 6b02b8c7b966+ tip
143 6b02b8c7b966+ tip
121
144
122 #if no-pure no-rust
145 #if no-pure no-rust
123
146
147 $ hg log -r . --config "storage.revlog.persistent-nodemap.slow-path=warn"
148 warning: accessing `persistent-nodemap` repository without associated fast implementation.
149 (check `hg help config.format.use-persistent-nodemap` for details)
150 changeset: 5000:6b02b8c7b966
151 tag: tip
152 user: debugbuilddag
153 date: Thu Jan 01 01:23:20 1970 +0000
154 summary: r5000
155
124 $ hg ci -m 'foo' --config "storage.revlog.nodemap.mode=strict"
156 $ hg ci -m 'foo' --config "storage.revlog.nodemap.mode=strict"
125 transaction abort!
157 transaction abort!
126 rollback completed
158 rollback completed
@@ -5,6 +5,8 b' setup'
5 > share =
5 > share =
6 > [format]
6 > [format]
7 > exp-share-safe = True
7 > exp-share-safe = True
8 > [storage]
9 > revlog.persistent-nodemap.slow-path=allow
8 > EOF
10 > EOF
9
11
10 prepare source repo
12 prepare source repo
General Comments 0
You need to be logged in to leave comments. Login now