152 |
152 |
153 configtable = {} |
153 configtable = {} |
154 configitem = registrar.configitem(configtable) |
154 configitem = registrar.configitem(configtable) |
155 |
155 |
156 configitem( |
156 configitem( |
157 b'fsmonitor', b'mode', default=b'on', |
157 b'fsmonitor', |
|
158 b'mode', |
|
159 default=b'on', |
158 ) |
160 ) |
159 configitem( |
161 configitem( |
160 b'fsmonitor', b'walk_on_invalidate', default=False, |
162 b'fsmonitor', |
|
163 b'walk_on_invalidate', |
|
164 default=False, |
161 ) |
165 ) |
162 configitem( |
166 configitem( |
163 b'fsmonitor', b'timeout', default=b'2', |
167 b'fsmonitor', |
|
168 b'timeout', |
|
169 default=b'2', |
164 ) |
170 ) |
165 configitem( |
171 configitem( |
166 b'fsmonitor', b'blacklistusers', default=list, |
172 b'fsmonitor', |
|
173 b'blacklistusers', |
|
174 default=list, |
167 ) |
175 ) |
168 configitem( |
176 configitem( |
169 b'fsmonitor', b'watchman_exe', default=b'watchman', |
177 b'fsmonitor', |
|
178 b'watchman_exe', |
|
179 default=b'watchman', |
170 ) |
180 ) |
171 configitem( |
181 configitem( |
172 b'fsmonitor', b'verbose', default=True, experimental=True, |
182 b'fsmonitor', |
|
183 b'verbose', |
|
184 default=True, |
|
185 experimental=True, |
173 ) |
186 ) |
174 configitem( |
187 configitem( |
175 b'experimental', b'fsmonitor.transaction_notify', default=False, |
188 b'experimental', |
|
189 b'fsmonitor.transaction_notify', |
|
190 default=False, |
176 ) |
191 ) |
177 |
192 |
178 # This extension is incompatible with the following blacklisted extensions |
193 # This extension is incompatible with the following blacklisted extensions |
179 # and will disable itself when encountering one of these: |
194 # and will disable itself when encountering one of these: |
180 _blacklist = [b'largefiles', b'eol'] |
195 _blacklist = [b'largefiles', b'eol'] |
269 |
284 |
270 return encoded |
285 return encoded |
271 |
286 |
272 |
287 |
273 def overridewalk(orig, self, match, subrepos, unknown, ignored, full=True): |
288 def overridewalk(orig, self, match, subrepos, unknown, ignored, full=True): |
274 '''Replacement for dirstate.walk, hooking into Watchman. |
289 """Replacement for dirstate.walk, hooking into Watchman. |
275 |
290 |
276 Whenever full is False, ignored is False, and the Watchman client is |
291 Whenever full is False, ignored is False, and the Watchman client is |
277 available, use Watchman combined with saved state to possibly return only a |
292 available, use Watchman combined with saved state to possibly return only a |
278 subset of files.''' |
293 subset of files.""" |
279 |
294 |
280 def bail(reason): |
295 def bail(reason): |
281 self._ui.debug(b'fsmonitor: fallback to core status, %s\n' % reason) |
296 self._ui.debug(b'fsmonitor: fallback to core status, %s\n' % reason) |
282 return orig(match, subrepos, unknown, ignored, full=True) |
297 return orig(match, subrepos, unknown, ignored, full=True) |
283 |
298 |
729 |
744 |
730 extensions.wrapfunction(merge, b'_update', wrapupdate) |
745 extensions.wrapfunction(merge, b'_update', wrapupdate) |
731 |
746 |
732 |
747 |
733 def wrapsymlink(orig, source, link_name): |
748 def wrapsymlink(orig, source, link_name): |
734 ''' if we create a dangling symlink, also touch the parent dir |
749 """if we create a dangling symlink, also touch the parent dir |
735 to encourage fsevents notifications to work more correctly ''' |
750 to encourage fsevents notifications to work more correctly""" |
736 try: |
751 try: |
737 return orig(source, link_name) |
752 return orig(source, link_name) |
738 finally: |
753 finally: |
739 try: |
754 try: |
740 os.utime(os.path.dirname(link_name), None) |
755 os.utime(os.path.dirname(link_name), None) |
741 except OSError: |
756 except OSError: |
742 pass |
757 pass |
743 |
758 |
744 |
759 |
745 class state_update(object): |
760 class state_update(object): |
746 ''' This context manager is responsible for dispatching the state-enter |
761 """This context manager is responsible for dispatching the state-enter |
747 and state-leave signals to the watchman service. The enter and leave |
762 and state-leave signals to the watchman service. The enter and leave |
748 methods can be invoked manually (for scenarios where context manager |
763 methods can be invoked manually (for scenarios where context manager |
749 semantics are not possible). If parameters oldnode and newnode are None, |
764 semantics are not possible). If parameters oldnode and newnode are None, |
750 they will be populated based on current working copy in enter and |
765 they will be populated based on current working copy in enter and |
751 leave, respectively. Similarly, if the distance is none, it will be |
766 leave, respectively. Similarly, if the distance is none, it will be |
752 calculated based on the oldnode and newnode in the leave method.''' |
767 calculated based on the oldnode and newnode in the leave method.""" |
753 |
768 |
754 def __init__( |
769 def __init__( |
755 self, |
770 self, |
756 repo, |
771 repo, |
757 name, |
772 name, |