You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2009/03/28 22:02:41 UTC

svn commit: r759588 - in /couchdb/trunk: share/www/script/test/show_documents.js src/couchdb/couch_httpd_show.erl

Author: jan
Date: Sat Mar 28 21:02:41 2009
New Revision: 759588

URL: http://svn.apache.org/viewvc?rev=759588&view=rev
Log:
always load _conflicts in _show functions

Modified:
    couchdb/trunk/share/www/script/test/show_documents.js
    couchdb/trunk/src/couchdb/couch_httpd_show.erl

Modified: couchdb/trunk/share/www/script/test/show_documents.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/show_documents.js?rev=759588&r1=759587&r2=759588&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/show_documents.js (original)
+++ couchdb/trunk/share/www/script/test/show_documents.js Sat Mar 28 21:02:41 2009
@@ -44,6 +44,11 @@
           };
         }
       }),
+      "json" : stringFun(function(doc, req) {
+        return {
+          json : doc
+        }
+      }),
       "req-info" : stringFun(function(doc, req) {
         return {
           json : req
@@ -300,4 +305,17 @@
   });
   T(xhr.getResponseHeader("Content-Type") == "text/html");
   T(xhr.responseText == "Ha ha, you said \"plankton\".");
+
+  // test inclusion of conflict state
+  var doc1 = {_id:"foo", a:1};
+  var doc2 = {_id:"foo", a:2};
+  db.save(doc1);
+
+  //create the conflict with a all_or_nothing bulk docs request
+  var docs = [doc2];
+  db.bulkSave(docs, {all_or_nothing:true});
+
+  xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/json/foo");
+  TEquals(1, JSON.parse(xhr.responseText)._conflicts.length);
+
 };

Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=759588&r1=759587&r2=759588&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Sat Mar 28 21:02:41 2009
@@ -30,7 +30,7 @@
     #doc{body={Props}} = couch_httpd_db:couch_doc_open(Db, DesignId, nil, []),
     Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>),
     ShowSrc = get_nested_json_value({Props}, [<<"shows">>, ShowName]),
-    Doc = try couch_httpd_db:couch_doc_open(Db, DocId, nil, []) of
+    Doc = try couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) of
         FoundDoc -> FoundDoc
     catch
         _ -> nil