changeset 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 37042e8b3b34
files hgext/inotify/__init__.py hgext/inotify/client.py hgext/inotify/server.py
diffstat 3 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inotify/__init__.py	Mon Jun 29 01:09:33 2009 +0900
+++ b/hgext/inotify/__init__.py	Mon Jun 29 01:27:34 2009 +0900
@@ -25,7 +25,8 @@
     class service(object):
         def init(self):
             try:
-                self.master = server.master(ui, repo, timeout)
+                self.master = server.master(ui, repo.dirstate,
+                                            repo.root, timeout)
             except server.AlreadyStartedException, inst:
                 raise util.Abort(str(inst))
 
--- a/hgext/inotify/client.py	Mon Jun 29 01:09:33 2009 +0900
+++ b/hgext/inotify/client.py	Mon Jun 29 01:27:34 2009 +0900
@@ -29,12 +29,12 @@
             if err[0] == errno.ECONNREFUSED:
                 self.ui.warn(_('(found dead inotify server socket; '
                                'removing it)\n'))
-                os.unlink(self.repo.join('inotify.sock'))
+                os.unlink(os.path.join(self.root, '.hg', 'inotify.sock'))
             if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart:
                 self.ui.debug(_('(starting inotify server)\n'))
                 try:
                     try:
-                        server.start(self.ui, self.repo)
+                        server.start(self.ui, self.dirstate, self.root)
                     except server.AlreadyStartedException, inst:
                         # another process may have started its own
                         # inotify server while this one was starting.
@@ -64,11 +64,12 @@
 class client(object):
     def __init__(self, ui, repo):
         self.ui = ui
-        self.repo = repo
+        self.dirstate = repo.dirstate
+        self.root = repo.root
         self.sock = socket.socket(socket.AF_UNIX)
 
     def _connect(self):
-        sockpath = self.repo.join('inotify.sock')
+        sockpath = os.path.join(self.root, '.hg', 'inotify.sock')
         try:
             self.sock.connect(sockpath)
         except socket.error, err:
--- a/hgext/inotify/server.py	Mon Jun 29 01:09:33 2009 +0900
+++ b/hgext/inotify/server.py	Mon Jun 29 01:27:34 2009 +0900
@@ -807,10 +807,10 @@
                 raise
 
 class master(object):
-    def __init__(self, ui, repo, timeout=None):
+    def __init__(self, ui, dirstate, root, timeout=None):
         self.ui = ui
-        self.repowatcher = repowatcher(ui, repo.dirstate, repo.root)
-        self.server = server(ui, repo.root, self.repowatcher, timeout)
+        self.repowatcher = repowatcher(ui, dirstate, root)
+        self.server = server(ui, root, self.repowatcher, timeout)
 
     def shutdown(self):
         for obj in pollable.instances.itervalues():
@@ -823,7 +823,7 @@
             sys.exit(0)
         pollable.run()
 
-def start(ui, repo):
+def start(ui, dirstate, root):
     def closefds(ignore):
         # (from python bug #1177468)
         # close all inherited file descriptors
@@ -844,7 +844,7 @@
             except OSError:
                 pass
 
-    m = master(ui, repo)
+    m = master(ui, dirstate, root)
     sys.stdout.flush()
     sys.stderr.flush()