Show More
@@ -18,6 +18,9 b' fsmonitor requires no configuration -- i' | |||||
18 | repository as necessary. You'll need to install Watchman from |
|
18 | repository as necessary. You'll need to install Watchman from | |
19 | https://facebook.github.io/watchman/ and make sure it is in your PATH. |
|
19 | https://facebook.github.io/watchman/ and make sure it is in your PATH. | |
20 |
|
20 | |||
|
21 | fsmonitor is incompatible with the largefiles and eol extensions, and | |||
|
22 | will disable itself if any of those are active. | |||
|
23 | ||||
21 | The following configuration options exist: |
|
24 | The following configuration options exist: | |
22 |
|
25 | |||
23 | :: |
|
26 | :: | |
@@ -58,9 +61,22 b' false. You may wish to set this to true ' | |||||
58 | that can outpace the IPC overhead of getting the result data for the full repo |
|
61 | that can outpace the IPC overhead of getting the result data for the full repo | |
59 | from Watchman. Defaults to false. |
|
62 | from Watchman. Defaults to false. | |
60 |
|
63 | |||
61 | fsmonitor is incompatible with the largefiles and eol extensions, and |
|
64 | :: | |
62 | will disable itself if any of those are active. |
|
65 | ||
|
66 | [fsmonitor] | |||
|
67 | warn_when_unused = (boolean) | |||
|
68 | ||||
|
69 | Whether to print a warning during certain operations when fsmonitor would be | |||
|
70 | beneficial to performance but isn't enabled. | |||
63 |
|
71 | |||
|
72 | :: | |||
|
73 | ||||
|
74 | [fsmonitor] | |||
|
75 | warn_update_file_count = (integer) | |||
|
76 | ||||
|
77 | If ``warn_when_unused`` is set and fsmonitor isn't enabled, a warning will | |||
|
78 | be printed during working directory updates if this many files will be | |||
|
79 | created. | |||
64 | ''' |
|
80 | ''' | |
65 |
|
81 | |||
66 | # Platforms Supported |
|
82 | # Platforms Supported |
@@ -488,6 +488,12 b" coreconfigitem('format', 'usegeneraldelt" | |||||
488 | coreconfigitem('format', 'usestore', |
|
488 | coreconfigitem('format', 'usestore', | |
489 | default=True, |
|
489 | default=True, | |
490 | ) |
|
490 | ) | |
|
491 | coreconfigitem('fsmonitor', 'warn_when_unused', | |||
|
492 | default=True, | |||
|
493 | ) | |||
|
494 | coreconfigitem('fsmonitor', 'warn_update_file_count', | |||
|
495 | default=50000, | |||
|
496 | ) | |||
491 | coreconfigitem('hooks', '.*', |
|
497 | coreconfigitem('hooks', '.*', | |
492 | default=dynamicdefault, |
|
498 | default=dynamicdefault, | |
493 | generic=True, |
|
499 | generic=True, |
@@ -25,6 +25,7 b' from .node import (' | |||||
25 | from . import ( |
|
25 | from . import ( | |
26 | copies, |
|
26 | copies, | |
27 | error, |
|
27 | error, | |
|
28 | extensions, | |||
28 | filemerge, |
|
29 | filemerge, | |
29 | match as matchmod, |
|
30 | match as matchmod, | |
30 | obsutil, |
|
31 | obsutil, | |
@@ -1943,6 +1944,38 b' def update(repo, node, branchmerge, forc' | |||||
1943 | # note that we're in the middle of an update |
|
1944 | # note that we're in the middle of an update | |
1944 | repo.vfs.write('updatestate', p2.hex()) |
|
1945 | repo.vfs.write('updatestate', p2.hex()) | |
1945 |
|
1946 | |||
|
1947 | # Advertise fsmonitor when its presence could be useful. | |||
|
1948 | # | |||
|
1949 | # We only advertise when performing an update from an empty working | |||
|
1950 | # directory. This typically only occurs during initial clone. | |||
|
1951 | # | |||
|
1952 | # We give users a mechanism to disable the warning in case it is | |||
|
1953 | # annoying. | |||
|
1954 | # | |||
|
1955 | # We only allow on Linux and MacOS because that's where fsmonitor is | |||
|
1956 | # considered stable. | |||
|
1957 | fsmonitorwarning = repo.ui.configbool('fsmonitor', 'warn_when_unused') | |||
|
1958 | fsmonitorthreshold = repo.ui.configint('fsmonitor', | |||
|
1959 | 'warn_update_file_count') | |||
|
1960 | try: | |||
|
1961 | extensions.find('fsmonitor') | |||
|
1962 | fsmonitorenabled = repo.ui.config('fsmonitor', 'mode') != 'off' | |||
|
1963 | # We intentionally don't look at whether fsmonitor has disabled | |||
|
1964 | # itself because a) fsmonitor may have already printed a warning | |||
|
1965 | # b) we only care about the config state here. | |||
|
1966 | except KeyError: | |||
|
1967 | fsmonitorenabled = False | |||
|
1968 | ||||
|
1969 | if (fsmonitorwarning | |||
|
1970 | and not fsmonitorenabled | |||
|
1971 | and p1.node() == nullid | |||
|
1972 | and len(actions['g']) >= fsmonitorthreshold | |||
|
1973 | and pycompat.sysplatform.startswith(('linux', 'darwin'))): | |||
|
1974 | repo.ui.warn( | |||
|
1975 | _('(warning: large working directory being used without ' | |||
|
1976 | 'fsmonitor enabled; enable fsmonitor to improve performance; ' | |||
|
1977 | 'see "hg help -e fsmonitor")\n')) | |||
|
1978 | ||||
1946 | stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels) |
|
1979 | stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels) | |
1947 | wc.flushall() |
|
1980 | wc.flushall() | |
1948 |
|
1981 |
@@ -559,6 +559,11 b' def has_osxpackaging():' | |||||
559 | except ImportError: |
|
559 | except ImportError: | |
560 | return False |
|
560 | return False | |
561 |
|
561 | |||
|
562 | @check('linuxormacos', 'Linux or MacOS') | |||
|
563 | def has_linuxormacos(): | |||
|
564 | # This isn't a perfect test for MacOS. But it is sufficient for our needs. | |||
|
565 | return sys.platform.startswith(('linux', 'darwin')) | |||
|
566 | ||||
562 | @check("docker", "docker support") |
|
567 | @check("docker", "docker support") | |
563 | def has_docker(): |
|
568 | def has_docker(): | |
564 | pat = br'A self-sufficient runtime for' |
|
569 | pat = br'A self-sufficient runtime for' |
@@ -1177,3 +1177,80 b' SEC: check for unsafe ssh url' | |||||
1177 | We should not have created a file named owned - if it exists, the |
|
1177 | We should not have created a file named owned - if it exists, the | |
1178 | attack succeeded. |
|
1178 | attack succeeded. | |
1179 | $ if test -f owned; then echo 'you got owned'; fi |
|
1179 | $ if test -f owned; then echo 'you got owned'; fi | |
|
1180 | ||||
|
1181 | Cloning without fsmonitor enabled does not print a warning for small repos | |||
|
1182 | ||||
|
1183 | $ hg clone a fsmonitor-default | |||
|
1184 | updating to bookmark @ on branch stable | |||
|
1185 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1186 | ||||
|
1187 | Lower the warning threshold to simulate a large repo | |||
|
1188 | ||||
|
1189 | $ cat >> $HGRCPATH << EOF | |||
|
1190 | > [fsmonitor] | |||
|
1191 | > warn_update_file_count = 2 | |||
|
1192 | > EOF | |||
|
1193 | ||||
|
1194 | We should see a warning about no fsmonitor on supported platforms | |||
|
1195 | ||||
|
1196 | #if linuxormacos no-fsmonitor | |||
|
1197 | $ hg clone a nofsmonitor | |||
|
1198 | updating to bookmark @ on branch stable | |||
|
1199 | (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") | |||
|
1200 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1201 | #else | |||
|
1202 | $ hg clone a nofsmonitor | |||
|
1203 | updating to bookmark @ on branch stable | |||
|
1204 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1205 | #endif | |||
|
1206 | ||||
|
1207 | We should not see warning about fsmonitor when it is enabled | |||
|
1208 | ||||
|
1209 | #if fsmonitor | |||
|
1210 | $ hg clone a fsmonitor-enabled | |||
|
1211 | updating to bookmark @ on branch stable | |||
|
1212 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1213 | #endif | |||
|
1214 | ||||
|
1215 | We can disable the fsmonitor warning | |||
|
1216 | ||||
|
1217 | $ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning | |||
|
1218 | updating to bookmark @ on branch stable | |||
|
1219 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1220 | ||||
|
1221 | Loaded fsmonitor but disabled in config should still print warning | |||
|
1222 | ||||
|
1223 | #if linuxormacos fsmonitor | |||
|
1224 | $ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off | |||
|
1225 | updating to bookmark @ on branch stable | |||
|
1226 | (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !) | |||
|
1227 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1228 | #endif | |||
|
1229 | ||||
|
1230 | Warning not printed if working directory isn't empty | |||
|
1231 | ||||
|
1232 | $ hg -q clone a fsmonitor-update | |||
|
1233 | (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?) | |||
|
1234 | $ cd fsmonitor-update | |||
|
1235 | $ hg up acb14030fe0a | |||
|
1236 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
1237 | (leaving bookmark @) | |||
|
1238 | $ hg up cf0fe1914066 | |||
|
1239 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1240 | ||||
|
1241 | `hg update` from null revision also prints | |||
|
1242 | ||||
|
1243 | $ hg up null | |||
|
1244 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
1245 | ||||
|
1246 | #if linuxormacos no-fsmonitor | |||
|
1247 | $ hg up cf0fe1914066 | |||
|
1248 | (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") | |||
|
1249 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1250 | #else | |||
|
1251 | $ hg up cf0fe1914066 | |||
|
1252 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
1253 | #endif | |||
|
1254 | ||||
|
1255 | $ cd .. | |||
|
1256 |
General Comments 0
You need to be logged in to leave comments.
Login now