D893: fsmonitor: use configitem

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Oct 4 10:55:15 EDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG718f7acd6d5e: fsmonitor: use configitem (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D893?vs=2314&id=2417

REVISION DETAIL
  https://phab.mercurial-scm.org/D893

AFFECTED FILES
  hgext/fsmonitor/__init__.py
  hgext/fsmonitor/state.py

CHANGE DETAILS

diff --git a/hgext/fsmonitor/state.py b/hgext/fsmonitor/state.py
--- a/hgext/fsmonitor/state.py
+++ b/hgext/fsmonitor/state.py
@@ -29,11 +29,10 @@
         self._lastclock = None
         self._identity = util.filestat(None)
 
-        self.mode = self._ui.config('fsmonitor', 'mode', default='on')
+        self.mode = self._ui.config('fsmonitor', 'mode')
         self.walk_on_invalidate = self._ui.configbool(
-            'fsmonitor', 'walk_on_invalidate', False)
-        self.timeout = float(self._ui.config(
-            'fsmonitor', 'timeout', default='2'))
+            'fsmonitor', 'walk_on_invalidate')
+        self.timeout = float(self._ui.config('fsmonitor', 'timeout'))
 
     def get(self):
         try:
diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -107,6 +107,7 @@
     merge,
     pathutil,
     pycompat,
+    registrar,
     scmutil,
     util,
 )
@@ -124,6 +125,22 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('fsmonitor', 'mode',
+    default='on',
+)
+configitem('fsmonitor', 'walk_on_invalidate',
+    default=False,
+)
+configitem('fsmonitor', 'timeout',
+    default='2',
+)
+configitem('fsmonitor', 'blacklistusers',
+    default=list,
+)
+
 # This extension is incompatible with the following blacklisted extensions
 # and will disable itself when encountering one of these:
 _blacklist = ['largefiles', 'eol']



To: indygreg, #hg-reviewers, mbthomas, krbullock
Cc: mercurial-devel


More information about the Mercurial-devel mailing list