Show More
@@ -27,8 +27,8 def start_server(function): | |||||
27 | autostart = self.ui.configbool('inotify', 'autostart', True) |
|
27 | autostart = self.ui.configbool('inotify', 'autostart', True) | |
28 |
|
28 | |||
29 | if err[0] == errno.ECONNREFUSED: |
|
29 | if err[0] == errno.ECONNREFUSED: | |
30 |
self.ui.warn(_(' |
|
30 | self.ui.warn(_('inotify-client: found dead inotify server ' | |
31 |
'removing it |
|
31 | 'socket; removing it\n')) | |
32 | os.unlink(os.path.join(self.root, '.hg', 'inotify.sock')) |
|
32 | os.unlink(os.path.join(self.root, '.hg', 'inotify.sock')) | |
33 | if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart: |
|
33 | if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart: | |
34 | self.ui.debug('(starting inotify server)\n') |
|
34 | self.ui.debug('(starting inotify server)\n') | |
@@ -41,20 +41,20 def start_server(function): | |||||
41 | # inotify server while this one was starting. |
|
41 | # inotify server while this one was starting. | |
42 | self.ui.debug(str(inst)) |
|
42 | self.ui.debug(str(inst)) | |
43 | except Exception, inst: |
|
43 | except Exception, inst: | |
44 |
self.ui.warn(_('could not start inotify |
|
44 | self.ui.warn(_('inotify-client: could not start inotify ' | |
45 | '%s\n') % inst) |
|
45 | 'server: %s\n') % inst) | |
46 | else: |
|
46 | else: | |
47 | try: |
|
47 | try: | |
48 | return function(self, *args) |
|
48 | return function(self, *args) | |
49 | except socket.error, err: |
|
49 | except socket.error, err: | |
50 |
self.ui.warn(_('could not talk to new |
|
50 | self.ui.warn(_('inotify-client: could not talk to new ' | |
51 | 'server: %s\n') % err[-1]) |
|
51 | 'inotify server: %s\n') % err[-1]) | |
52 | elif err[0] in (errno.ECONNREFUSED, errno.ENOENT): |
|
52 | elif err[0] in (errno.ECONNREFUSED, errno.ENOENT): | |
53 | # silently ignore normal errors if autostart is False |
|
53 | # silently ignore normal errors if autostart is False | |
54 | self.ui.debug('(inotify server not running)\n') |
|
54 | self.ui.debug('(inotify server not running)\n') | |
55 | else: |
|
55 | else: | |
56 |
self.ui.warn(_('failed to contact inotify |
|
56 | self.ui.warn(_('inotify-client: failed to contact inotify ' | |
57 | % err[-1]) |
|
57 | 'server: %s\n') % err[-1]) | |
58 |
|
58 | |||
59 | self.ui.traceback() |
|
59 | self.ui.traceback() | |
60 | raise QueryFailed('inotify query failed') |
|
60 | raise QueryFailed('inotify query failed') | |
@@ -97,7 +97,8 class client(object): | |||||
97 | version = ord(cs.read(1)) |
|
97 | version = ord(cs.read(1)) | |
98 | except TypeError: |
|
98 | except TypeError: | |
99 | # empty answer, assume the server crashed |
|
99 | # empty answer, assume the server crashed | |
100 |
self.ui.warn(_('received empty answer from inotify |
|
100 | self.ui.warn(_('inotify-client: received empty answer from inotify ' | |
|
101 | 'server')) | |||
101 | raise QueryFailed('server crashed') |
|
102 | raise QueryFailed('server crashed') | |
102 |
|
103 | |||
103 | if version != common.version: |
|
104 | if version != common.version: |
@@ -691,9 +691,13 class server(pollable): | |||||
691 | self.sock.bind(self.sockpath) |
|
691 | self.sock.bind(self.sockpath) | |
692 | except socket.error, err: |
|
692 | except socket.error, err: | |
693 | if err[0] == errno.EADDRINUSE: |
|
693 | if err[0] == errno.EADDRINUSE: | |
694 |
raise AlreadyStartedException(_('c |
|
694 | raise AlreadyStartedException( _('cannot start: socket is ' | |
695 |
|
|
695 | 'already bound')) | |
696 | if err[0] == "AF_UNIX path too long": |
|
696 | if err[0] == "AF_UNIX path too long": | |
|
697 | if os.path.islink(self.sockpath) and \ | |||
|
698 | not os.path.exists(self.sockpath): | |||
|
699 | raise util.Abort('inotify-server: cannot start: ' | |||
|
700 | '.hg/inotify.sock is a broken symlink') | |||
697 | tempdir = tempfile.mkdtemp(prefix="hg-inotify-") |
|
701 | tempdir = tempfile.mkdtemp(prefix="hg-inotify-") | |
698 | self.realsockpath = os.path.join(tempdir, "inotify.sock") |
|
702 | self.realsockpath = os.path.join(tempdir, "inotify.sock") | |
699 | try: |
|
703 | try: | |
@@ -706,8 +710,9 class server(pollable): | |||||
706 | pass |
|
710 | pass | |
707 | os.rmdir(tempdir) |
|
711 | os.rmdir(tempdir) | |
708 | if inst.errno == errno.EEXIST: |
|
712 | if inst.errno == errno.EEXIST: | |
709 |
raise AlreadyStartedException(_('c |
|
713 | raise AlreadyStartedException(_('cannot start: tried ' | |
710 | % inst.strerror) |
|
714 | 'linking .hg/inotify.sock to a temporary socket but' | |
|
715 | ' .hg/inotify.sock already exists')) | |||
711 | raise |
|
716 | raise | |
712 | else: |
|
717 | else: | |
713 | raise |
|
718 | raise | |
@@ -841,7 +846,7 def start(ui, dirstate, root, opts): | |||||
841 | try: |
|
846 | try: | |
842 | self.master = master(ui, dirstate, root, timeout) |
|
847 | self.master = master(ui, dirstate, root, timeout) | |
843 | except AlreadyStartedException, inst: |
|
848 | except AlreadyStartedException, inst: | |
844 |
raise util.Abort( |
|
849 | raise util.Abort("inotify-server: %s" % inst) | |
845 |
|
850 | |||
846 | def run(self): |
|
851 | def run(self): | |
847 | try: |
|
852 | try: |
@@ -33,6 +33,10 cat hg.pid >> "$DAEMON_PIDS" | |||||
33 |
|
33 | |||
34 | # let the daemon finish its stuff |
|
34 | # let the daemon finish its stuff | |
35 | sleep 1 |
|
35 | sleep 1 | |
|
36 | ||||
|
37 | echo % cannot start, already bound | |||
|
38 | hg inserve | |||
|
39 | ||||
36 | # issue907 |
|
40 | # issue907 | |
37 | hg status |
|
41 | hg status | |
38 | echo % clean |
|
42 | echo % clean |
@@ -1,7 +1,7 | |||||
1 | % fail |
|
1 | % fail | |
2 | abort: could not start server: File exists |
|
2 | abort: inotify-server: cannot start: .hg/inotify.sock is a broken symlink | |
3 | could not talk to new inotify server: No such file or directory |
|
3 | inotify-client: could not talk to new inotify server: No such file or directory | |
4 | abort: could not start server: File exists |
|
4 | abort: inotify-server: cannot start: .hg/inotify.sock is a broken symlink | |
5 | % inserve |
|
5 | % inserve | |
6 | % status |
|
6 | % status | |
7 | ? hg.pid |
|
7 | ? hg.pid |
@@ -10,6 +10,8 updating to branch default | |||||
10 | 8 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
10 | 8 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
11 | M a |
|
11 | M a | |
12 | % inserve |
|
12 | % inserve | |
|
13 | % cannot start, already bound | |||
|
14 | abort: inotify-server: cannot start: socket is already bound | |||
13 | ? hg.pid |
|
15 | ? hg.pid | |
14 | % clean |
|
16 | % clean | |
15 | C a |
|
17 | C a |
General Comments 0
You need to be logged in to leave comments.
Login now