Show More
@@ -161,6 +161,9 b" configitem('fsmonitor', 'timeout'," | |||
|
161 | 161 | configitem('fsmonitor', 'blacklistusers', |
|
162 | 162 | default=list, |
|
163 | 163 | ) |
|
164 | configitem('experimental', 'fsmonitor.transaction_notify', | |
|
165 | default=False, | |
|
166 | ) | |
|
164 | 167 | |
|
165 | 168 | # This extension is incompatible with the following blacklisted extensions |
|
166 | 169 | # and will disable itself when encountering one of these: |
@@ -656,14 +659,18 b' class state_update(object):' | |||
|
656 | 659 | self.enter() |
|
657 | 660 | |
|
658 | 661 | def enter(self): |
|
659 | # We explicitly need to take a lock here, before we proceed to update | |
|
660 | # watchman about the update operation, so that we don't race with | |
|
661 |
# |
|
|
662 | # immediately anyway, so this is effectively extending the lock | |
|
663 | # around a couple of short sanity checks. | |
|
662 | # Make sure we have a wlock prior to sending notifications to watchman. | |
|
663 | # We don't want to race with other actors. In the update case, | |
|
664 | # merge.update is going to take the wlock almost immediately. We are | |
|
665 | # effectively extending the lock around several short sanity checks. | |
|
664 | 666 | if self.oldnode is None: |
|
665 | 667 | self.oldnode = self.repo['.'].node() |
|
666 | self._lock = self.repo.wlock() | |
|
668 | ||
|
669 | if self.repo.currentwlock() is None: | |
|
670 | if util.safehasattr(self.repo, 'wlocknostateupdate'): | |
|
671 | self._lock = self.repo.wlocknostateupdate() | |
|
672 | else: | |
|
673 | self._lock = self.repo.wlock() | |
|
667 | 674 | self.need_leave = self._state( |
|
668 | 675 | 'state-enter', |
|
669 | 676 | hex(self.oldnode)) |
@@ -784,4 +791,34 b' def reposetup(ui, repo):' | |||
|
784 | 791 | orig = super(fsmonitorrepo, self).status |
|
785 | 792 | return overridestatus(orig, self, *args, **kwargs) |
|
786 | 793 | |
|
794 | def wlocknostateupdate(self, *args, **kwargs): | |
|
795 | return super(fsmonitorrepo, self).wlock(*args, **kwargs) | |
|
796 | ||
|
797 | def wlock(self, *args, **kwargs): | |
|
798 | l = super(fsmonitorrepo, self).wlock(*args, **kwargs) | |
|
799 | if not ui.configbool( | |
|
800 | "experimental", "fsmonitor.transaction_notify"): | |
|
801 | return l | |
|
802 | if l.held != 1: | |
|
803 | return l | |
|
804 | origrelease = l.releasefn | |
|
805 | ||
|
806 | def staterelease(): | |
|
807 | if origrelease: | |
|
808 | origrelease() | |
|
809 | if l.stateupdate: | |
|
810 | l.stateupdate.exit() | |
|
811 | l.stateupdate = None | |
|
812 | ||
|
813 | try: | |
|
814 | l.stateupdate = None | |
|
815 | l.stateupdate = state_update(self, name="hg.transaction") | |
|
816 | l.stateupdate.enter() | |
|
817 | l.releasefn = staterelease | |
|
818 | except Exception as e: | |
|
819 | # Swallow any errors; fire and forget | |
|
820 | self.ui.log( | |
|
821 | 'watchman', 'Exception in state update %s\n', e) | |
|
822 | return l | |
|
823 | ||
|
787 | 824 | repo.__class__ = fsmonitorrepo |
General Comments 0
You need to be logged in to leave comments.
Login now