Mercurial > hg
comparison hgext/inotify/server.py @ 9351:206f7f4c5c2a
inotify: client: no repo use
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 29 Jun 2009 01:27:34 +0900 |
parents | b789ea382fc0 |
children | 7c01599dd340 |
comparison
equal
deleted
inserted
replaced
9350:b789ea382fc0 | 9351:206f7f4c5c2a |
---|---|
805 except OSError, err: | 805 except OSError, err: |
806 if err.errno != errno.ENOENT: | 806 if err.errno != errno.ENOENT: |
807 raise | 807 raise |
808 | 808 |
809 class master(object): | 809 class master(object): |
810 def __init__(self, ui, repo, timeout=None): | 810 def __init__(self, ui, dirstate, root, timeout=None): |
811 self.ui = ui | 811 self.ui = ui |
812 self.repowatcher = repowatcher(ui, repo.dirstate, repo.root) | 812 self.repowatcher = repowatcher(ui, dirstate, root) |
813 self.server = server(ui, repo.root, self.repowatcher, timeout) | 813 self.server = server(ui, root, self.repowatcher, timeout) |
814 | 814 |
815 def shutdown(self): | 815 def shutdown(self): |
816 for obj in pollable.instances.itervalues(): | 816 for obj in pollable.instances.itervalues(): |
817 obj.shutdown() | 817 obj.shutdown() |
818 | 818 |
821 self.ui.note(_('finished setup\n')) | 821 self.ui.note(_('finished setup\n')) |
822 if os.getenv('TIME_STARTUP'): | 822 if os.getenv('TIME_STARTUP'): |
823 sys.exit(0) | 823 sys.exit(0) |
824 pollable.run() | 824 pollable.run() |
825 | 825 |
826 def start(ui, repo): | 826 def start(ui, dirstate, root): |
827 def closefds(ignore): | 827 def closefds(ignore): |
828 # (from python bug #1177468) | 828 # (from python bug #1177468) |
829 # close all inherited file descriptors | 829 # close all inherited file descriptors |
830 # Python 2.4.1 and later use /dev/urandom to seed the random module's RNG | 830 # Python 2.4.1 and later use /dev/urandom to seed the random module's RNG |
831 # a file descriptor is kept internally as os._urandomfd (created on demand | 831 # a file descriptor is kept internally as os._urandomfd (created on demand |
842 try: | 842 try: |
843 os.close(fd) | 843 os.close(fd) |
844 except OSError: | 844 except OSError: |
845 pass | 845 pass |
846 | 846 |
847 m = master(ui, repo) | 847 m = master(ui, dirstate, root) |
848 sys.stdout.flush() | 848 sys.stdout.flush() |
849 sys.stderr.flush() | 849 sys.stderr.flush() |
850 | 850 |
851 pid = os.fork() | 851 pid = os.fork() |
852 if pid: | 852 if pid: |