D1611: fsmonitor: fsmonitor should send wlock notifications to watchman

ekent (Eamonn Kent) phabricator at mercurial-scm.org
Thu Dec 7 02:54:54 UTC 2017


ekent created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The fsmonitor extension should send state-enter and state-leave
  notifications to watchman when the wlock is acquired/release, respectively.
  This will allow watchman and watchman subscribers to customize behavior based
  on whether source control operations are occurring.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/fsmonitor/__init__.py

CHANGE DETAILS

diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -117,7 +117,6 @@
 from mercurial.i18n import _
 from mercurial.node import (
     hex,
-    nullid,
 )
 
 from mercurial import (
@@ -162,12 +161,6 @@
 configitem('fsmonitor', 'blacklistusers',
     default=list,
 )
-configitem('experimental', 'fsmonitor.transaction_notify',
-    default=False,
-)
-configitem('experimental', 'fsmonitor.wc_change_notify',
-    default=False,
-)
 
 # This extension is incompatible with the following blacklisted extensions
 # and will disable itself when encountering one of these:
@@ -609,14 +602,6 @@
             self._fsmonitorstate.invalidate()
             return super(fsmonitordirstate, self).invalidate(*args, **kwargs)
 
-        if dirstate._ui.configbool(
-            "experimental", "fsmonitor.wc_change_notify"):
-            def setparents(self, p1, p2=nullid):
-                with state_update(self._repo, name="hg.wc_change",
-                                  oldnode=self._pl[0], newnode=p1,
-                                  partial=False):
-                    return super(fsmonitordirstate, self).setparents(p1, p2)
-
     dirstate.__class__ = fsmonitordirstate
     dirstate._fsmonitorinit(repo)
 
@@ -799,32 +784,4 @@
                 orig = super(fsmonitorrepo, self).status
                 return overridestatus(orig, self, *args, **kwargs)
 
-            if ui.configbool("experimental", "fsmonitor.transaction_notify"):
-                def transaction(self, *args, **kwargs):
-                    tr = super(fsmonitorrepo, self).transaction(
-                               *args, **kwargs)
-                    if tr.count != 1:
-                        return tr
-                    stateupdate = state_update(self, name="hg.transaction")
-                    stateupdate.enter()
-
-                    class fsmonitortrans(tr.__class__):
-                        def _abort(self):
-                            try:
-                                result = super(fsmonitortrans, self)._abort()
-                            finally:
-                                stateupdate.exit(abort=True)
-                            return result
-
-                        def close(self):
-                            try:
-                                result = super(fsmonitortrans, self).close()
-                            finally:
-                                if self.count == 0:
-                                    stateupdate.exit()
-                            return result
-
-                    tr.__class__ = fsmonitortrans
-                    return tr
-
         repo.__class__ = fsmonitorrepo



To: ekent, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list