Mercurial > hg
comparison hgext/fsmonitor/__init__.py @ 35312:73abb81ccb28
fsmonitor: remove watchman transaction and working copy change notifications
Remove working copy change and transaction notifications. We were relying
upon callbacks on transaction function. This caused issues with lock ordering.
A different approach will be adopted in a subsequent commit.
Differential Revision: https://phab.mercurial-scm.org/D1611
author | Eamonn Kent <ekent@fb.com> |
---|---|
date | Wed, 06 Dec 2017 18:37:49 -0800 |
parents | 0b5716ec8500 |
children | c67fb3bfe3a1 |
comparison
equal
deleted
inserted
replaced
35311:12ce62c72c24 | 35312:73abb81ccb28 |
---|---|
115 import weakref | 115 import weakref |
116 | 116 |
117 from mercurial.i18n import _ | 117 from mercurial.i18n import _ |
118 from mercurial.node import ( | 118 from mercurial.node import ( |
119 hex, | 119 hex, |
120 nullid, | |
121 ) | 120 ) |
122 | 121 |
123 from mercurial import ( | 122 from mercurial import ( |
124 context, | 123 context, |
125 encoding, | 124 encoding, |
159 configitem('fsmonitor', 'timeout', | 158 configitem('fsmonitor', 'timeout', |
160 default='2', | 159 default='2', |
161 ) | 160 ) |
162 configitem('fsmonitor', 'blacklistusers', | 161 configitem('fsmonitor', 'blacklistusers', |
163 default=list, | 162 default=list, |
164 ) | |
165 configitem('experimental', 'fsmonitor.transaction_notify', | |
166 default=False, | |
167 ) | |
168 configitem('experimental', 'fsmonitor.wc_change_notify', | |
169 default=False, | |
170 ) | 163 ) |
171 | 164 |
172 # This extension is incompatible with the following blacklisted extensions | 165 # This extension is incompatible with the following blacklisted extensions |
173 # and will disable itself when encountering one of these: | 166 # and will disable itself when encountering one of these: |
174 _blacklist = ['largefiles', 'eol'] | 167 _blacklist = ['largefiles', 'eol'] |
607 | 600 |
608 def invalidate(self, *args, **kwargs): | 601 def invalidate(self, *args, **kwargs): |
609 self._fsmonitorstate.invalidate() | 602 self._fsmonitorstate.invalidate() |
610 return super(fsmonitordirstate, self).invalidate(*args, **kwargs) | 603 return super(fsmonitordirstate, self).invalidate(*args, **kwargs) |
611 | 604 |
612 if dirstate._ui.configbool( | |
613 "experimental", "fsmonitor.wc_change_notify"): | |
614 def setparents(self, p1, p2=nullid): | |
615 with state_update(self._repo, name="hg.wc_change", | |
616 oldnode=self._pl[0], newnode=p1, | |
617 partial=False): | |
618 return super(fsmonitordirstate, self).setparents(p1, p2) | |
619 | |
620 dirstate.__class__ = fsmonitordirstate | 605 dirstate.__class__ = fsmonitordirstate |
621 dirstate._fsmonitorinit(repo) | 606 dirstate._fsmonitorinit(repo) |
622 | 607 |
623 def wrapdirstate(orig, self): | 608 def wrapdirstate(orig, self): |
624 ds = orig(self) | 609 ds = orig(self) |
797 class fsmonitorrepo(repo.__class__): | 782 class fsmonitorrepo(repo.__class__): |
798 def status(self, *args, **kwargs): | 783 def status(self, *args, **kwargs): |
799 orig = super(fsmonitorrepo, self).status | 784 orig = super(fsmonitorrepo, self).status |
800 return overridestatus(orig, self, *args, **kwargs) | 785 return overridestatus(orig, self, *args, **kwargs) |
801 | 786 |
802 if ui.configbool("experimental", "fsmonitor.transaction_notify"): | |
803 def transaction(self, *args, **kwargs): | |
804 tr = super(fsmonitorrepo, self).transaction( | |
805 *args, **kwargs) | |
806 if tr.count != 1: | |
807 return tr | |
808 stateupdate = state_update(self, name="hg.transaction") | |
809 stateupdate.enter() | |
810 | |
811 class fsmonitortrans(tr.__class__): | |
812 def _abort(self): | |
813 try: | |
814 result = super(fsmonitortrans, self)._abort() | |
815 finally: | |
816 stateupdate.exit(abort=True) | |
817 return result | |
818 | |
819 def close(self): | |
820 try: | |
821 result = super(fsmonitortrans, self).close() | |
822 finally: | |
823 if self.count == 0: | |
824 stateupdate.exit() | |
825 return result | |
826 | |
827 tr.__class__ = fsmonitortrans | |
828 return tr | |
829 | |
830 repo.__class__ = fsmonitorrepo | 787 repo.__class__ = fsmonitorrepo |