Created
March 22, 2011 21:58
-
-
Save dustin/882174 to your computer and use it in GitHub Desktop.
Bulk conflict resolver.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import couchdb | |
MINIMATA='http://minimata:5984/' | |
LOCAL='http://localhost:5984/' | |
db = couchdb.Server(MINIMATA)['photo'] | |
docs = [] | |
for d in db.view('hack/conflicts'): | |
print d.id | |
for r in d.value: | |
print " %s" % r | |
docs.append({'_id': d.id, '_rev': r, '_deleted': True}) | |
# docs.append(doc) | |
print docs | |
if docs: | |
print "Deleting %d conflicts (if you press enter)" % len(docs) | |
sys.stdin.readline() | |
print db.update(docs) | |
else: | |
print "No docs to delete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment