Skip to content

Commit dcffc5a

Browse files
committed
Simplify replication script, use modern API.
1 parent 044835b commit dcffc5a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

couchdb/tools/replicate.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,18 @@ def main():
5757
else:
5858
dbnames = options.dbnames
5959

60-
targetdbs = sorted(i for i in target_server)
6160
for dbname in sorted(dbnames, reverse=True):
6261

6362
start = time.time()
6463
print dbname,
6564
sys.stdout.flush()
66-
if dbname not in targetdbs:
65+
if dbname not in target_server:
6766
target_server.create(dbname)
6867
print "created",
6968
sys.stdout.flush()
7069

71-
body = {}
72-
if options.continuous:
73-
body['continuous'] = True
74-
75-
body.update({'source': '%s%s' % (src, dbname), 'target': dbname})
76-
target_server.resource.post('_replicate', body)
70+
sdb = '%s%s' % (src, dbname)
71+
target_server.replicate(sdb, dbname, continuous=options.continuous)
7772
print '%.1fs' % (time.time() - start)
7873

7974
if not options.compact:

0 commit comments

Comments
 (0)