You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by cm...@apache.org on 2008/08/02 01:17:02 UTC

svn commit: r681897 - in /incubator/couchdb/branches/0.8.x: ./ share/www/script/browse.js share/www/script/couch_tests.js src/couchdb/couch_btree.erl src/couchdb/couch_httpd.erl

Author: cmlenz
Date: Fri Aug  1 16:17:02 2008
New Revision: 681897

URL: http://svn.apache.org/viewvc?rev=681897&view=rev
Log:
Merged revisions 680796-681852 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/couchdb/trunk

........
  r680796 | damien | 2008-07-29 20:23:42 +0200 (Di, 29 Jul 2008) | 1 line
  
  Fix for problem with count query arg in grouped reduce views. Previous fix would keep enumerating over subsequent view results despite not returning them.
........
  r681843 | cmlenz | 2008-08-01 23:30:23 +0200 (Fr, 01 Aug 2008) | 1 line
  
  Fix auto-expanding of view editor textareas for temp views.
........
  r681852 | cmlenz | 2008-08-01 23:49:18 +0200 (Fr, 01 Aug 2008) | 1 line
  
  Fix collapsing of nested objects in Futon document view in Safari.
........

Modified:
    incubator/couchdb/branches/0.8.x/   (props changed)
    incubator/couchdb/branches/0.8.x/share/www/script/browse.js
    incubator/couchdb/branches/0.8.x/share/www/script/couch_tests.js
    incubator/couchdb/branches/0.8.x/src/couchdb/couch_btree.erl
    incubator/couchdb/branches/0.8.x/src/couchdb/couch_httpd.erl

Propchange: incubator/couchdb/branches/0.8.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug  1 16:17:02 2008
@@ -1 +1 @@
-/incubator/couchdb/trunk:1-668227,668231-668248,668269-670737,670739-671610,673634-673777,673779-674333,674335-675698,675700-677086,677088-679850
+/incubator/couchdb/trunk:1-668227,668231-668248,668269-670737,670739-671610,673634-673777,673779-674333,674335-675698,675700-677086,677088-679850,680796-681852

Modified: incubator/couchdb/branches/0.8.x/share/www/script/browse.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/0.8.x/share/www/script/browse.js?rev=681897&r1=681896&r2=681897&view=diff
==============================================================================
--- incubator/couchdb/branches/0.8.x/share/www/script/browse.js [utf-8] (original)
+++ incubator/couchdb/branches/0.8.x/share/www/script/browse.js [utf-8] Fri Aug  1 16:17:02 2008
@@ -451,7 +451,7 @@
       db.allDocs(options);
     } else {
       if (viewName == "_temp_view") {
-        $("#viewcode").show().addClass("expanded");
+        $("#viewcode").show().removeClass("collapsed");
         var mapFun = $("#viewcode_map").val();
         $.cookies.set(db.name + ".map", mapFun);
         var reduceFun = $("#viewcode_reduce").val() || null;
@@ -626,7 +626,8 @@
   }
 
   function _addRowForField(doc, fieldName) {
-    var row = $("<tr><th></th><td></td></tr>").find("th").append($("<b></b>").text(fieldName)).end();
+    var row = $("<tr><th></th><td></td></tr>").find("th").append($("<b></b>")
+      .text(fieldName)).end().appendTo("#fields tbody.content");
     if (fieldName == "_attachments") {
       row
         .find("td").append(_renderAttachmentList(doc[fieldName]));
@@ -638,15 +639,13 @@
         }).end()
         .find("td").append(value).dblclick(function() {
           _editValue(doc, this, $(this).prev("th").text());
-        }).end()
-        
+        }).end();
       if (fieldName != "_id" && fieldName != "_rev") {
         row.find("th, td").attr("title", "Double click to edit");
         _initKey(doc, row, fieldName);
         _initValue(value);
       }
     }
-    row.appendTo("#fields tbody.content");
     $("#fields tbody tr").removeClass("odd").filter(":odd").addClass("odd");
     return row;
   }
@@ -766,8 +765,8 @@
   }
 
   function _initValue(value) {
-    value.find("dd").filter(":has(dl)").hide().prev("dt").addClass("collapsed");
-    value.find("dd").not(":has(dl)").addClass("inline").prev().addClass("inline");
+    value.find("dd:has(dl)").hide().prev("dt").addClass("collapsed");
+    value.find("dd:not(:has(dl))").addClass("inline").prev().addClass("inline");
     value.find("dt.collapsed").click(function() {
       $(this).toggleClass("collapsed").next().toggle();
     });

Modified: incubator/couchdb/branches/0.8.x/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/0.8.x/share/www/script/couch_tests.js?rev=681897&r1=681896&r2=681897&view=diff
==============================================================================
--- incubator/couchdb/branches/0.8.x/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/branches/0.8.x/share/www/script/couch_tests.js [utf-8] Fri Aug  1 16:17:02 2008
@@ -290,6 +290,12 @@
     result = db.query(map, reduce, {startkey: 4, endkey: 6});
     T(result.rows[0].value == 15);
 
+    result = db.query(map, reduce, {group:true, count:3});
+    T(result.rows.length == 3);
+    T(result.rows[0].value == 1);
+    T(result.rows[1].value == 2);
+    T(result.rows[2].value == 3);
+
     for(var i=1; i<numDocs/2; i+=30) {
       result = db.query(map, reduce, {startkey: i, endkey: numDocs - i});
       T(result.rows[0].value == summate(numDocs-i) - summate(i-1));

Modified: incubator/couchdb/branches/0.8.x/src/couchdb/couch_btree.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/0.8.x/src/couchdb/couch_btree.erl?rev=681897&r1=681896&r2=681897&view=diff
==============================================================================
--- incubator/couchdb/branches/0.8.x/src/couchdb/couch_btree.erl (original)
+++ incubator/couchdb/branches/0.8.x/src/couchdb/couch_btree.erl Fri Aug  1 16:17:02 2008
@@ -78,17 +78,20 @@
         rev -> {EndKey, StartKey};
         fwd -> {StartKey, EndKey}
     end,
-    {ok, Acc2, GroupedRedsAcc2, GroupedKVsAcc2, GroupedKey2} =
-        reduce_stream_node(Bt, Dir, Root, StartKey2, EndKey2, nil, [], [],
-        KeyGroupFun, Fun, Acc),
-    if GroupedKey2 == nil ->
-        {ok, Acc2};
-    true ->
-        case (catch Fun(GroupedKey2, {GroupedKVsAcc2, GroupedRedsAcc2}, Acc2)) of
+    try
+        {ok, Acc2, GroupedRedsAcc2, GroupedKVsAcc2, GroupedKey2} =
+            reduce_stream_node(Bt, Dir, Root, StartKey2, EndKey2, nil, [], [],
+            KeyGroupFun, Fun, Acc),
+        if GroupedKey2 == nil ->
+            {ok, Acc2};
+        true ->
+            case Fun(GroupedKey2, {GroupedKVsAcc2, GroupedRedsAcc2}, Acc2) of
             {ok, Acc3} -> {ok, Acc3};
-            {stop, Acc3} -> {ok, Acc3};
-            Else -> throw(Else)
+            {stop, Acc3} -> {ok, Acc3}
+            end
         end
+    catch
+        throw:{stop, AccDone} -> {ok, AccDone}
     end.
 
 full_reduce(#btree{root=nil,reduce=Reduce}) ->

Modified: incubator/couchdb/branches/0.8.x/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/0.8.x/src/couchdb/couch_httpd.erl?rev=681897&r1=681896&r2=681897&view=diff
==============================================================================
--- incubator/couchdb/branches/0.8.x/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/branches/0.8.x/src/couchdb/couch_httpd.erl Fri Aug  1 16:17:02 2008
@@ -465,7 +465,7 @@
         fun(_Key, _Red, {AccSeparator,AccSkip,AccCount}) when AccSkip > 0 ->
             {ok, {AccSeparator,AccSkip-1,AccCount}};
         (_Key, _Red, {AccSeparator,0,AccCount}) when AccCount == 0 ->
-            {ok, {AccSeparator,0,AccCount}};
+            {stop, {AccSeparator,0,AccCount}};
         (_Key, Red, {AccSeparator,0,AccCount}) when GroupLevel == 0 ->
             Json = lists:flatten(cjson:encode({obj, [{key, null}, {value, Red}]})),
             Resp:write_chunk(AccSeparator ++ Json),