[PATCH 4 of 5] inotify: client: no repo use
Nicolas Dumazet
nicdumz at gmail.com
Fri Aug 14 02:11:53 CDT 2009
# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1246206454 -32400
# Node ID 7c81c5c94fefad6050480c05e1019beba5abe240
# Parent 410f2a1fb107e21bb1e80343d8b3d8d6f156829a
inotify: client: no repo use
diff --git a/hgext/inotify/__init__.py b/hgext/inotify/__init__.py
--- a/hgext/inotify/__init__.py
+++ b/hgext/inotify/__init__.py
@@ -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))
diff --git a/hgext/inotify/client.py b/hgext/inotify/client.py
--- a/hgext/inotify/client.py
+++ b/hgext/inotify/client.py
@@ -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.sep.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.sep.join([self.root, '.hg', 'inotify.sock'])
try:
self.sock.connect(sockpath)
except socket.error, err:
diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
--- a/hgext/inotify/server.py
+++ b/hgext/inotify/server.py
@@ -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()
More information about the Mercurial-devel
mailing list