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