Show More
@@ -0,0 +1,30 | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | "$TESTDIR/hghave" inotify || exit 80 | |||
|
4 | ||||
|
5 | hg init | |||
|
6 | ||||
|
7 | touch a b c d e | |||
|
8 | mkdir dir | |||
|
9 | mkdir dir/bar | |||
|
10 | touch dir/x dir/y dir/bar/foo | |||
|
11 | ||||
|
12 | hg ci -Am m | |||
|
13 | ||||
|
14 | echo "[extensions]" >> $HGRCPATH | |||
|
15 | echo "inotify=" >> $HGRCPATH | |||
|
16 | ||||
|
17 | echo % inserve | |||
|
18 | hg inserve -d --pid-file=hg.pid | |||
|
19 | cat hg.pid >> "$DAEMON_PIDS" | |||
|
20 | ||||
|
21 | # let the daemon finish its stuff | |||
|
22 | sleep 1 | |||
|
23 | # issue907 | |||
|
24 | hg status | |||
|
25 | echo % clean | |||
|
26 | hg status -c | |||
|
27 | echo % all | |||
|
28 | hg status -A | |||
|
29 | ||||
|
30 | kill `cat hg.pid` |
@@ -0,0 +1,29 | |||||
|
1 | adding a | |||
|
2 | adding b | |||
|
3 | adding c | |||
|
4 | adding d | |||
|
5 | adding dir/bar/foo | |||
|
6 | adding dir/x | |||
|
7 | adding dir/y | |||
|
8 | adding e | |||
|
9 | % inserve | |||
|
10 | ? hg.pid | |||
|
11 | % clean | |||
|
12 | C a | |||
|
13 | C b | |||
|
14 | C c | |||
|
15 | C d | |||
|
16 | C dir/bar/foo | |||
|
17 | C dir/x | |||
|
18 | C dir/y | |||
|
19 | C e | |||
|
20 | % all | |||
|
21 | ? hg.pid | |||
|
22 | C a | |||
|
23 | C b | |||
|
24 | C c | |||
|
25 | C d | |||
|
26 | C dir/bar/foo | |||
|
27 | C dir/x | |||
|
28 | C dir/y | |||
|
29 | C e |
@@ -1,62 +1,62 | |||||
1 | # client.py - inotify status client |
|
1 | # client.py - inotify status client | |
2 | # |
|
2 | # | |
3 | # Copyright 2006, 2007, 2008 Bryan O'Sullivan <bos@serpentine.com> |
|
3 | # Copyright 2006, 2007, 2008 Bryan O'Sullivan <bos@serpentine.com> | |
4 | # Copyright 2007, 2008 Brendan Cully <brendan@kublai.com> |
|
4 | # Copyright 2007, 2008 Brendan Cully <brendan@kublai.com> | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms |
|
6 | # This software may be used and distributed according to the terms | |
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | from mercurial.i18n import gettext as _ |
|
9 | from mercurial.i18n import gettext as _ | |
10 | from mercurial import ui |
|
10 | from mercurial import ui | |
11 | import common |
|
11 | import common | |
12 | import os, select, socket, stat, struct, sys |
|
12 | import os, select, socket, stat, struct, sys | |
13 |
|
13 | |||
14 | def query(ui, repo, names, match, ignored, clean, unknown=True): |
|
14 | def query(ui, repo, names, match, ignored, clean, unknown=True): | |
15 | sock = socket.socket(socket.AF_UNIX) |
|
15 | sock = socket.socket(socket.AF_UNIX) | |
16 | sockpath = repo.join('inotify.sock') |
|
16 | sockpath = repo.join('inotify.sock') | |
17 | try: |
|
17 | try: | |
18 | sock.connect(sockpath) |
|
18 | sock.connect(sockpath) | |
19 | except socket.error, err: |
|
19 | except socket.error, err: | |
20 | if err[0] == "AF_UNIX path too long": |
|
20 | if err[0] == "AF_UNIX path too long": | |
21 | sockpath = os.readlink(sockpath) |
|
21 | sockpath = os.readlink(sockpath) | |
22 | sock.connect(sockpath) |
|
22 | sock.connect(sockpath) | |
23 | else: |
|
23 | else: | |
24 | raise |
|
24 | raise | |
25 |
|
25 | |||
26 | def genquery(): |
|
26 | def genquery(): | |
27 | for n in names or []: |
|
27 | for n in names or []: | |
28 | yield n |
|
28 | yield n | |
29 | states = 'almrx!' |
|
29 | states = 'almrx!' | |
30 | if ignored: |
|
30 | if ignored: | |
31 | raise ValueError('this is insanity') |
|
31 | raise ValueError('this is insanity') | |
32 |
if clean: states += ' |
|
32 | if clean: states += 'c' | |
33 | if unknown: states += '?' |
|
33 | if unknown: states += '?' | |
34 | yield states |
|
34 | yield states | |
35 |
|
35 | |||
36 | req = '\0'.join(genquery()) |
|
36 | req = '\0'.join(genquery()) | |
37 |
|
37 | |||
38 | sock.sendall(chr(common.version)) |
|
38 | sock.sendall(chr(common.version)) | |
39 | sock.sendall(req) |
|
39 | sock.sendall(req) | |
40 | sock.shutdown(socket.SHUT_WR) |
|
40 | sock.shutdown(socket.SHUT_WR) | |
41 |
|
41 | |||
42 | cs = common.recvcs(sock) |
|
42 | cs = common.recvcs(sock) | |
43 | version = ord(cs.read(1)) |
|
43 | version = ord(cs.read(1)) | |
44 |
|
44 | |||
45 | if version != common.version: |
|
45 | if version != common.version: | |
46 | ui.warn(_('(inotify: received response from incompatible server ' |
|
46 | ui.warn(_('(inotify: received response from incompatible server ' | |
47 | 'version %d)\n') % version) |
|
47 | 'version %d)\n') % version) | |
48 | return None |
|
48 | return None | |
49 |
|
49 | |||
50 | try: |
|
50 | try: | |
51 | resphdr = struct.unpack(common.resphdrfmt, cs.read(common.resphdrsize)) |
|
51 | resphdr = struct.unpack(common.resphdrfmt, cs.read(common.resphdrsize)) | |
52 | except struct.error: |
|
52 | except struct.error: | |
53 | return None |
|
53 | return None | |
54 |
|
54 | |||
55 | def readnames(nbytes): |
|
55 | def readnames(nbytes): | |
56 | if nbytes: |
|
56 | if nbytes: | |
57 | names = cs.read(nbytes) |
|
57 | names = cs.read(nbytes) | |
58 | if names: |
|
58 | if names: | |
59 | return filter(match, names.split('\0')) |
|
59 | return filter(match, names.split('\0')) | |
60 | return [] |
|
60 | return [] | |
61 |
|
61 | |||
62 | return map(readnames, resphdr) |
|
62 | return map(readnames, resphdr) |
General Comments 0
You need to be logged in to leave comments.
Login now