Mercurial > hg > silvermirror
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/silvermirror/unison.py Sat Sep 26 23:36:42 2009 -0400 @@ -0,0 +1,23 @@ +""" +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 +