##// END OF EJS Templates
dirstate-v2: add an option to prevent unintentional slow dirstate-v2...
marmoute -
r49049:5c567aca default
parent child Browse files
Show More
@@ -1885,6 +1885,13 b' coreconfigitem('
1885 default=b'skip',
1885 default=b'skip',
1886 experimental=True,
1886 experimental=True,
1887 )
1887 )
1888 # experimental as long as format.exp-dirstate-v2 is.
1889 coreconfigitem(
1890 b'storage',
1891 b'dirstate-v2.slow-path',
1892 default=b"abort",
1893 experimental=True,
1894 )
1888 coreconfigitem(
1895 coreconfigitem(
1889 b'storage',
1896 b'storage',
1890 b'new-repo-backend',
1897 b'new-repo-backend',
@@ -39,6 +39,8 b' from .interfaces import ('
39 parsers = policy.importmod('parsers')
39 parsers = policy.importmod('parsers')
40 rustmod = policy.importrust('dirstate')
40 rustmod = policy.importrust('dirstate')
41
41
42 HAS_FAST_DIRSTATE_V2 = rustmod is not None
43
42 propertycache = util.propertycache
44 propertycache = util.propertycache
43 filecache = scmutil.filecache
45 filecache = scmutil.filecache
44 _rangemask = dirstatemap.rangemask
46 _rangemask = dirstatemap.rangemask
@@ -1174,6 +1174,32 b' def resolverevlogstorevfsoptions(ui, req'
1174 if slow_path == b'abort':
1174 if slow_path == b'abort':
1175 raise error.Abort(msg, hint=hint)
1175 raise error.Abort(msg, hint=hint)
1176 options[b'persistent-nodemap'] = True
1176 options[b'persistent-nodemap'] = True
1177 if requirementsmod.DIRSTATE_V2_REQUIREMENT in requirements:
1178 slow_path = ui.config(b'storage', b'dirstate-v2.slow-path')
1179 if slow_path not in (b'allow', b'warn', b'abort'):
1180 default = ui.config_default(b'storage', b'dirstate-v2.slow-path')
1181 msg = _(b'unknown value for config "dirstate-v2.slow-path": "%s"\n')
1182 ui.warn(msg % slow_path)
1183 if not ui.quiet:
1184 ui.warn(_(b'falling back to default value: %s\n') % default)
1185 slow_path = default
1186
1187 msg = _(
1188 b"accessing `dirstate-v2` repository without associated "
1189 b"fast implementation."
1190 )
1191 hint = _(
1192 b"check `hg help config.format.exp-dirstate-v2` " b"for details"
1193 )
1194 if not dirstate.HAS_FAST_DIRSTATE_V2:
1195 if slow_path == b'warn':
1196 msg = b"warning: " + msg + b'\n'
1197 ui.warn(msg)
1198 if not ui.quiet:
1199 hint = b'(' + hint + b')\n'
1200 ui.warn(hint)
1201 if slow_path == b'abort':
1202 raise error.Abort(msg, hint=hint)
1177 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
1203 if ui.configbool(b'storage', b'revlog.persistent-nodemap.mmap'):
1178 options[b'persistent-nodemap.mmap'] = True
1204 options[b'persistent-nodemap.mmap'] = True
1179 if ui.configbool(b'devel', b'persistent-nodemap'):
1205 if ui.configbool(b'devel', b'persistent-nodemap'):
@@ -1,8 +1,12 b''
1 #testcases dirstate-v1 dirstate-v2
1 #testcases dirstate-v1 dirstate-v2
2
2
3 #if dirstate-v2
3 #if dirstate-v2
4 $ echo '[format]' >> $HGRCPATH
4 $ cat >> $HGRCPATH << EOF
5 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
5 > [format]
6 > exp-dirstate-v2=1
7 > [storage]
8 > dirstate-v2.slow-path=allow
9 > EOF
6 #endif
10 #endif
7
11
8 $ hg init repo
12 $ hg init repo
@@ -1,8 +1,12 b''
1 #testcases dirstate-v1 dirstate-v2
1 #testcases dirstate-v1 dirstate-v2
2
2
3 #if dirstate-v2
3 #if dirstate-v2
4 $ echo '[format]' >> $HGRCPATH
4 $ cat >> $HGRCPATH << EOF
5 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
5 > [format]
6 > exp-dirstate-v2=1
7 > [storage]
8 > dirstate-v2.slow-path=allow
9 > EOF
6 #endif
10 #endif
7
11
8 Checking the size/permissions/file-type of files stored in the
12 Checking the size/permissions/file-type of files stored in the
@@ -1,8 +1,12 b''
1 #testcases dirstate-v1 dirstate-v2
1 #testcases dirstate-v1 dirstate-v2
2
2
3 #if dirstate-v2
3 #if dirstate-v2
4 $ echo '[format]' >> $HGRCPATH
4 $ cat >> $HGRCPATH << EOF
5 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
5 > [format]
6 > exp-dirstate-v2=1
7 > [storage]
8 > dirstate-v2.slow-path=allow
9 > EOF
6 #endif
10 #endif
7
11
8 ------ Test dirstate._dirs refcounting
12 ------ Test dirstate._dirs refcounting
@@ -1,8 +1,12 b''
1 #testcases dirstate-v1 dirstate-v2
1 #testcases dirstate-v1 dirstate-v2
2
2
3 #if dirstate-v2
3 #if dirstate-v2
4 $ echo '[format]' >> $HGRCPATH
4 $ cat >> $HGRCPATH << EOF
5 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
5 > [format]
6 > exp-dirstate-v2=1
7 > [storage]
8 > dirstate-v2.slow-path=allow
9 > EOF
6 #endif
10 #endif
7
11
8 $ hg init ignorerepo
12 $ hg init ignorerepo
@@ -3,8 +3,12 b''
3 #testcases dirstate-v1 dirstate-v2
3 #testcases dirstate-v1 dirstate-v2
4
4
5 #if dirstate-v2
5 #if dirstate-v2
6 $ echo '[format]' >> $HGRCPATH
6 $ cat >> $HGRCPATH << EOF
7 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
7 > [format]
8 > exp-dirstate-v2=1
9 > [storage]
10 > dirstate-v2.slow-path=allow
11 > EOF
8 #endif
12 #endif
9
13
10 $ hg init t
14 $ hg init t
@@ -1,8 +1,12 b''
1 #testcases dirstate-v1 dirstate-v2
1 #testcases dirstate-v1 dirstate-v2
2
2
3 #if dirstate-v2
3 #if dirstate-v2
4 $ echo '[format]' >> $HGRCPATH
4 $ cat >> $HGRCPATH << EOF
5 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
5 > [format]
6 > exp-dirstate-v2=1
7 > [storage]
8 > dirstate-v2.slow-path=allow
9 > EOF
6 #endif
10 #endif
7
11
8 init
12 init
@@ -1,8 +1,12 b''
1 #testcases dirstate-v1 dirstate-v2
1 #testcases dirstate-v1 dirstate-v2
2
2
3 #if dirstate-v2
3 #if dirstate-v2
4 $ echo '[format]' >> $HGRCPATH
4 $ cat >> $HGRCPATH << EOF
5 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
5 > [format]
6 > exp-dirstate-v2=1
7 > [storage]
8 > dirstate-v2.slow-path=allow
9 > EOF
6 #endif
10 #endif
7
11
8 $ hg init repo1
12 $ hg init repo1
@@ -3,8 +3,12 b''
3 #testcases dirstate-v1 dirstate-v2
3 #testcases dirstate-v1 dirstate-v2
4
4
5 #if dirstate-v2
5 #if dirstate-v2
6 $ echo '[format]' >> $HGRCPATH
6 $ cat >> $HGRCPATH << EOF
7 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
7 > [format]
8 > exp-dirstate-v2=1
9 > [storage]
10 > dirstate-v2.slow-path=allow
11 > EOF
8 #endif
12 #endif
9
13
10 == tests added in 0.7 ==
14 == tests added in 0.7 ==
General Comments 0
You need to be logged in to leave comments. Login now