From user-return-7201-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Thu Oct 29 17:57:10 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 56845 invoked from network); 29 Oct 2009 17:57:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Oct 2009 17:57:10 -0000 Received: (qmail 31250 invoked by uid 500); 29 Oct 2009 17:57:09 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 31173 invoked by uid 500); 29 Oct 2009 17:57:09 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 31163 invoked by uid 99); 29 Oct 2009 17:57:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2009 17:57:09 +0000 X-ASF-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.68.5.16] (HELO relay02.pair.com) (209.68.5.16) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 29 Oct 2009 17:57:05 +0000 Received: (qmail 84808 invoked from network); 29 Oct 2009 17:56:43 -0000 Received: from 75.143.234.216 (HELO ?192.168.1.6?) (75.143.234.216) by relay02.pair.com with SMTP; 29 Oct 2009 17:56:43 -0000 X-pair-Authenticated: 75.143.234.216 Message-Id: <868151A0-6380-44CA-B7B7-7DB94DEA3515@apache.org> From: Damien Katz To: user@couchdb.apache.org In-Reply-To: <20091029163909.GB14057@uk.tiscali.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: revs_info misses conflicting revs? Date: Thu, 29 Oct 2009 13:56:43 -0400 References: <20091029163909.GB14057@uk.tiscali.com> X-Mailer: Apple Mail (2.936) It only shows the revision history of the current document. Open each conflict document by revision id using the revs_info=true options to see it's full history. -Damien On Oct 29, 2009, at 12:39 PM, Brian Candler wrote: > I am a bit confused about the intended semantics of ?revs_info=true, > since > it does not show conflicting revs. Example: > > ---------------- script --------------- > HOST=http://127.0.0.1:5984 > DB="$HOST/conflict_test" > EP="$DB/_bulk_docs" > curl -s "$HOST" > curl -sX DELETE "$DB" > curl -sX PUT "$DB" > > resp=$(curl -sX POST -d @- $EP < {"all_or_nothing":true,"docs":[{ > "_id":"mydoc", > "type":"test" > }]} > JSON > rev0=`expr "$resp" : '.*"rev":"\([^"]*\)"'` > echo $rev0 > > resp=$(curl -sX POST -d @- $EP < {"all_or_nothing":true,"docs":[{ > "_id":"mydoc", > "_rev":"$rev0", > "type":"test", > "data":"foo" > }]} > JSON > rev1=`expr "$resp" : '.*"rev":"\([^"]*\)"'` > echo $rev1 > > resp=$(curl -sX POST -d @- $EP < {"all_or_nothing":true,"docs":[{ > "_id":"mydoc", > "_rev":"$rev0", > "type":"wibble", > "data":"bar" > }]} > JSON > rev2=`expr "$resp" : '.*"rev":"\([^"]*\)"'` > echo $rev2 > > # Now we have two conflicting versions. > echo > echo "Getting the auto-selected version:" > curl -s "$DB/mydoc" > echo > echo "Getting the auto-selected version with 'conflicts':" > curl -s "$DB/mydoc?conflicts=true" > echo > echo "Getting the auto-selected version with 'revs':" > curl -s "$DB/mydoc?revs=true" > echo > echo "Getting the auto-selected version with 'revs_info':" > curl -s "$DB/mydoc?revs_info=true" > > ---------------- output ----------------- > {"couchdb":"Welcome","version":"0.11.0bc7e681a3-git"} > {"ok":true} > {"ok":true} > 1-3b717529ff0f515c2c5d8aa52a2c03ab > 2-7170cc59f0d73ecf7bf60f3818fda4be > 2-161b6901565fe9ffdc937da206b09e53 > > Getting the auto-selected version: > {"_id > ":"mydoc > ","_rev > ":"2-7170cc59f0d73ecf7bf60f3818fda4be","type":"test","data":"foo"} > > Getting the auto-selected version with 'conflicts': > {"_id > ":"mydoc > ","_rev > ":"2 > -7170cc59f0d73ecf7bf60f3818fda4be > ","type":"test","data":"foo","_conflicts": > ["2-161b6901565fe9ffdc937da206b09e53"]} > > Getting the auto-selected version with 'revs': > {"_id > ":"mydoc > ","_rev > ":"2 > -7170cc59f0d73ecf7bf60f3818fda4be > ","type":"test","data":"foo","_revisions":{"start":2,"ids": > ["7170cc59f0d73ecf7bf60f3818fda4be > ","3b717529ff0f515c2c5d8aa52a2c03ab"]}} > > Getting the auto-selected version with 'revs_info': > {"_id > ":"mydoc > ","_rev > ":"2 > -7170cc59f0d73ecf7bf60f3818fda4be > ","type":"test","data":"foo","_revs_info": > [{"rev":"2-7170cc59f0d73ecf7bf60f3818fda4be","status":"available"}, > {"rev":"1-3b717529ff0f515c2c5d8aa52a2c03ab","status":"available"}]} > > So: > * the current version has _rev 2-717 > > * "conflicts" tells us about _conflicts 2-161 > > * "revs" tells us about _revisions 717 and 3b7. It says "start":2 but > actually the 3b7 is 1-3b7, so this doesn't seem to be useful in > practice. > > * "revs_info" tells us about 2-717 and 1-3b7 (but not 2-161) > > You *can* apply both conflicts=true and revs_info=true. Is that what > you're > supposed to do? Is revs_info only supposed to give the revs back > along one > particular history branch? > > Thanks, > > Brian.