fsmonitor: increase the threshold before we recommend it, when using rust
authorValentin Gatien-Baron <vgatien-baron@janestreet.com>
Mon, 14 Sep 2020 11:32:24 -0400
changeset 45462 c1d6e930ac8a
parent 45461 14be07d5603c
child 45463 145cfe84d3e4
fsmonitor: increase the threshold before we recommend it, when using rust 50k files works just fine with the rust status, and it's annoying to get told "consider using fsmonitor" when we have another solution to the status speed. 400k files was not chosen in any rigorous way. I know 200k files is fine. Twice as many files should still be fine. Differential Revision: https://phab.mercurial-scm.org/D9021
hgext/fsmonitor/__init__.py
mercurial/configitems.py
mercurial/merge.py
tests/test-clone.t
--- a/hgext/fsmonitor/__init__.py	Fri Jun 19 06:15:06 2020 +0200
+++ b/hgext/fsmonitor/__init__.py	Mon Sep 14 11:32:24 2020 -0400
@@ -73,6 +73,8 @@
 
     [fsmonitor]
     warn_update_file_count = (integer)
+    # or when mercurial is built with rust support
+    warn_update_file_count_rust = (integer)
 
 If ``warn_when_unused`` is set and fsmonitor isn't enabled, a warning will
 be printed during working directory updates if this many files will be
--- a/mercurial/configitems.py	Fri Jun 19 06:15:06 2020 +0200
+++ b/mercurial/configitems.py	Mon Sep 14 11:32:24 2020 -0400
@@ -793,6 +793,9 @@
     b'fsmonitor', b'warn_update_file_count', default=50000,
 )
 coreconfigitem(
+    b'fsmonitor', b'warn_update_file_count_rust', default=400000,
+)
+coreconfigitem(
     b'help', br'hidden-command\..*', default=False, generic=True,
 )
 coreconfigitem(
--- a/mercurial/merge.py	Fri Jun 19 06:15:06 2020 +0200
+++ b/mercurial/merge.py	Mon Sep 14 11:32:24 2020 -0400
@@ -1698,6 +1698,15 @@
     fsmonitorthreshold = repo.ui.configint(
         b'fsmonitor', b'warn_update_file_count'
     )
+    # avoid cycle dirstate -> sparse -> merge -> dirstate
+    from . import dirstate
+
+    if dirstate.rustmod is not None:
+        # When using rust status, fsmonitor becomes necessary at higher sizes
+        fsmonitorthreshold = repo.ui.configint(
+            b'fsmonitor', b'warn_update_file_count_rust',
+        )
+
     try:
         # avoid cycle: extensions -> cmdutil -> merge
         from . import extensions
--- a/tests/test-clone.t	Fri Jun 19 06:15:06 2020 +0200
+++ b/tests/test-clone.t	Mon Sep 14 11:32:24 2020 -0400
@@ -1241,6 +1241,7 @@
   $ cat >> $HGRCPATH << EOF
   > [fsmonitor]
   > warn_update_file_count = 2
+  > warn_update_file_count_rust = 2
   > EOF
 
 We should see a warning about no fsmonitor on supported platforms