Mercurial > hg > silvermirror
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:abb358e2434c | 1:9b139702a8f9 |
---|---|
1 """ | |
2 unison backend for silvermirror | |
3 """ | |
4 | |
5 import pexpect | |
6 | |
7 from interface import Reflector | |
8 | |
9 class unison(Reflector): | |
10 | |
11 def sync(self, host, resource, ignore=(), password=None, test=False): | |
12 command = ['unison', '-auto', '-batch', resource, 'ssh://%s/%s' % (host, resource)] | |
13 for i in ignore: | |
14 command.extend(('-ignore', "'Name %s'" % i)) | |
15 | |
16 command = ' '.join(command) | |
17 print command # XXX debug -- should go to logging | |
18 if not test: | |
19 child = pexpect.spawn(command, timeout=36000, maxread=1) | |
20 child.expect('password: ') | |
21 child.sendline(password[host]) | |
22 print child.read() # XXX -> logging | |
23 |