1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
diff -ru old/python/bin/watchman-make new/python/bin/watchman-make
--- old/python/bin/watchman-make 2020-09-06 11:36:12.202435809 +0200
+++ new/python/bin/watchman-make 2020-09-06 11:36:14.105482419 +0200
@@ -55,7 +55,14 @@
data = client.getSubscription(self.name)
if data is None:
return
- self.triggered = True
+ for item in data:
+ # We only want to trigger if files matched;
+ # updates without a files list are metadata
+ # such as state-enter/leave notices so we skip them
+ if 'files' in item:
+ self.triggered = True
+ if 'canceled' in item:
+ raise RuntimeError('Watch was cancelled')
def execute(self):
if not self.triggered:
@@ -165,6 +172,11 @@
parser.add_argument('-r', '--run', type=str, help="""
The script that should be run when changes are detected
""")
+parser.add_argument('--connect-timeout', type=float, default=600, help="""
+Initial watchman client connection timeout. It should be sufficiently large to
+prevent timeouts when watchman is busy (eg. performing a crawl). The default
+value is 600 seconds.
+""")
args = parser.parse_args()
if args.target is None and args.run is None:
@@ -187,7 +199,7 @@
sys.exit(1)
targets = {}
-client = pywatchman.client(timeout=600)
+client = pywatchman.client(timeout=args.connect_timeout)
try:
client.capabilityCheck(
required=['cmd-watch-project', 'wildmatch'])
diff -ru old/python/bin/watchman-wait new/python/bin/watchman-wait
--- old/python/bin/watchman-wait 2020-09-06 11:36:12.202435809 +0200
+++ new/python/bin/watchman-wait 2020-09-06 11:36:14.106482444 +0200
@@ -76,6 +76,11 @@
Exit if no events trigger within the specified timeout. If timeout is
zero (the default) then keep running indefinitely.
""")
+parser.add_argument('--connect-timeout', type=float, default=100, help="""
+Initial watchman client connection timeout. It should be sufficiently large to
+prevent timeouts when watchman is busy (eg. performing a crawl). The default
+value is 100 seconds.
+""")
args = parser.parse_args()
@@ -141,7 +146,7 @@
def formatField(self, fname, val):
if fname == 'name':
# Respect the --relative path printing option
- return os.path.relpath(val, args.relative)
+ return os.path.relpath(os.path.join(self.name, val), args.relative)
# otherwise just make sure it's a string so that we can join it
return str(val)
@@ -173,12 +178,13 @@
for path in args.path:
sub = Subscription(path)
+# and start up the client + subscriptions
+client = pywatchman.client(timeout=args.connect_timeout)
+
deadline = None
if args.timeout > 0:
deadline = time.time() + args.timeout
-# and start up the client + subscriptions
-client = pywatchman.client()
try:
client.capabilityCheck(
required=['term-dirname', 'cmd-watch-project', 'wildmatch'])
|