Skip to content

Instantly share code, notes, and snippets.

@a13xb
Created October 25, 2012 13:40
Show Gist options
  • Save a13xb/3952603 to your computer and use it in GitHub Desktop.
Save a13xb/3952603 to your computer and use it in GitHub Desktop.
Conflict example
#! /bin/sh
set -e
couch() {
cmd="curl localhost:5984/"
echo '===' ${cmd}$*
${cmd}$*
echo
}
# Cleanup
couch d1 -XDELETE
couch d2 -XDELETE
# Setup
couch d1 -XPUT
couch d2 -XPUT
couch d1/foo -XPUT -d{}
couch d2/foo -XPUT -d{}
# Introduce conflict
couch d1/foo -XPUT -d '{"_rev":"1-967a00dff5e02add41819138abb3284d"}'
couch d2/foo -XPUT -d '{"_rev":"1-967a00dff5e02add41819138abb3284d","a":111}'
couch _replicate -Hcontent-type:application/json -d'{"source":"d2","target":"d1"}'
couch d1/foo
couch 'd1/foo?conflicts=true&deleted_conflicts=true'
couch 'd1/foo?open_revs=all'
couch 'd1/foo?rev=2-7051cbe5c8faecd085a3fa619e6e6337' -XDELETE
couch 'd1/foo?conflicts=true&deleted_conflicts=true'
couch 'd1/foo?open_revs=all'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment