[svn r38023] Report HostRSyncing only in case where rsyncing is really performed.

--HG--
branch : trunk
This commit is contained in:
fijal 2007-02-06 20:01:07 +01:00
parent 540736b493
commit 138b0ec79a
1 changed files with 5 additions and 4 deletions

View File

@ -91,12 +91,14 @@ class HostRSync(py.execnet.RSync):
else:
return True
def add_target_host(self, host, destrelpath=None, finishedcallback=None):
def add_target_host(self, host, reporter=lambda x: None,
destrelpath=None, finishedcallback=None):
key = host.hostname, host.relpath
if key in self._synced:
if finishedcallback:
finishedcallback()
return False
reporter(repevent.HostRSyncing(host))
self._synced[key] = True
# the follow attributes are set from host.initgateway()
gw = host.gw
@ -135,10 +137,9 @@ class HostManager(object):
rsync = HostRSync(ignores=ignores)
destrelpath = root.relto(self.config.topdir)
for host in self.hosts:
reporter(repevent.HostRSyncing(host))
def donecallback():
reporter(repevent.HostRSyncRootReady(host, root))
rsync.add_target_host(host, destrelpath,
rsync.add_target_host(host, reporter, destrelpath,
finishedcallback=donecallback)
rsync.send(root)