Show More
@@ -58,7 +58,7 b' def reposetup(ui, repo):' | |||||
58 | list_clean, list_unknown) |
|
58 | list_clean, list_unknown) | |
59 | if result is not None: |
|
59 | if result is not None: | |
60 | return result |
|
60 | return result | |
61 | except socket.error, err: |
|
61 | except (OSError, socket.error), err: | |
62 | if err[0] == errno.ECONNREFUSED: |
|
62 | if err[0] == errno.ECONNREFUSED: | |
63 | ui.warn(_('(found dead inotify server socket; ' |
|
63 | ui.warn(_('(found dead inotify server socket; ' | |
64 | 'removing it)\n')) |
|
64 | 'removing it)\n')) |
@@ -9,7 +9,7 b'' | |||||
9 | from mercurial.i18n import gettext as _ |
|
9 | from mercurial.i18n import gettext as _ | |
10 | from mercurial import osutil, ui, util |
|
10 | from mercurial import osutil, ui, util | |
11 | import common |
|
11 | import common | |
12 | import errno, os, select, socket, stat, struct, sys, time |
|
12 | import errno, os, select, socket, stat, struct, sys, tempfile, time | |
13 |
|
13 | |||
14 | try: |
|
14 | try: | |
15 | import linux as inotify |
|
15 | import linux as inotify | |
@@ -556,12 +556,30 b' class Server(object):' | |||||
556 | self.timeout = timeout |
|
556 | self.timeout = timeout | |
557 | self.sock = socket.socket(socket.AF_UNIX) |
|
557 | self.sock = socket.socket(socket.AF_UNIX) | |
558 | self.sockpath = self.repo.join('inotify.sock') |
|
558 | self.sockpath = self.repo.join('inotify.sock') | |
|
559 | self.realsockpath = None | |||
559 | try: |
|
560 | try: | |
560 | self.sock.bind(self.sockpath) |
|
561 | self.sock.bind(self.sockpath) | |
561 | except socket.error, err: |
|
562 | except socket.error, err: | |
562 | if err[0] == errno.EADDRINUSE: |
|
563 | if err[0] == errno.EADDRINUSE: | |
563 |
raise AlreadyStartedException(_('could not start server: %s') |
|
564 | raise AlreadyStartedException(_('could not start server: %s') | |
564 | % err[1]) |
|
565 | % err[1]) | |
|
566 | if err[0] == "AF_UNIX path too long": | |||
|
567 | tempdir = tempfile.mkdtemp(prefix="hg-inotify-") | |||
|
568 | self.realsockpath = os.path.join(tempdir, "inotify.sock") | |||
|
569 | try: | |||
|
570 | self.sock.bind(self.realsockpath) | |||
|
571 | os.symlink(self.realsockpath, self.sockpath) | |||
|
572 | except (OSError, socket.error), inst: | |||
|
573 | try: | |||
|
574 | os.unlink(self.realsockpath) | |||
|
575 | except: | |||
|
576 | pass | |||
|
577 | os.rmdir(tempdir) | |||
|
578 | if inst.errno == errno.EEXIST: | |||
|
579 | raise AlreadyStartedException(_('could not start server: %s') | |||
|
580 | % inst.strerror) | |||
|
581 | raise | |||
|
582 | else: | |||
565 | raise |
|
583 | raise | |
566 | self.sock.listen(5) |
|
584 | self.sock.listen(5) | |
567 | self.fileno = self.sock.fileno |
|
585 | self.fileno = self.sock.fileno | |
@@ -635,6 +653,9 b' class Server(object):' | |||||
635 | self.sock.close() |
|
653 | self.sock.close() | |
636 | try: |
|
654 | try: | |
637 | os.unlink(self.sockpath) |
|
655 | os.unlink(self.sockpath) | |
|
656 | if self.realsockpath: | |||
|
657 | os.unlink(self.realsockpath) | |||
|
658 | os.rmdir(os.path.dirname(self.realsockpath)) | |||
638 | except OSError, err: |
|
659 | except OSError, err: | |
639 | if err.errno != errno.ENOENT: |
|
660 | if err.errno != errno.ENOENT: | |
640 | raise |
|
661 | raise |
@@ -9,7 +9,16 b' p="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |||||
9 | hg init $p |
|
9 | hg init $p | |
10 | cd $p |
|
10 | cd $p | |
11 |
|
11 | |||
|
12 | echo % fail | |||
|
13 | ln -sf doesnotexist .hg/inotify.sock | |||
|
14 | hg st | |||
|
15 | hg inserve | |||
|
16 | rm .hg/inotify.sock | |||
|
17 | ||||
12 | echo % inserve |
|
18 | echo % inserve | |
13 | hg inserve |
|
19 | hg inserve -d --pid-file=hg.pid | |
|
20 | cat hg.pid >> "$DAEMON_PIDS" | |||
14 | echo % status |
|
21 | echo % status | |
15 | hg status |
|
22 | hg status | |
|
23 | ||||
|
24 | kill `cat hg.pid` |
@@ -1,5 +1,9 b'' | |||||
|
1 | % fail | |||
|
2 | failed to contact inotify server: AF_UNIX path too long | |||
|
3 | deactivating inotify | |||
|
4 | abort: could not start server: File exists | |||
1 | % inserve |
|
5 | % inserve | |
2 | abort: AF_UNIX path too long |
|
|||
3 | % status |
|
6 | % status | |
4 | failed to contact inotify server: AF_UNIX path too long |
|
7 | failed to contact inotify server: AF_UNIX path too long | |
5 | deactivating inotify |
|
8 | deactivating inotify | |
|
9 | ? hg.pid |
General Comments 0
You need to be logged in to leave comments.
Login now