Mercurial > hg > silvermirror
view silvermirror/unison.py @ 1:9b139702a8f9
use a real backend architecture with an inteface and vastly simplify unify.py
author | k0s <k0scist@gmail.com> |
---|---|
date | Sat, 26 Sep 2009 23:36:42 -0400 |
parents | |
children | 743c920bc041 |
line wrap: on
line source
""" unison backend for silvermirror """ import pexpect from interface import Reflector class unison(Reflector): def sync(self, host, resource, ignore=(), password=None, test=False): command = ['unison', '-auto', '-batch', resource, 'ssh://%s/%s' % (host, resource)] for i in ignore: command.extend(('-ignore', "'Name %s'" % i)) command = ' '.join(command) print command # XXX debug -- should go to logging if not test: child = pexpect.spawn(command, timeout=36000, maxread=1) child.expect('password: ') child.sendline(password[host]) print child.read() # XXX -> logging