You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2008/04/11 21:56:17 UTC

svn commit: r647288 - in /incubator/couchdb/branches/mochiweb/src/couchdb: cjson.erl couch_db.erl couch_httpd.erl couch_server_sup.erl

Author: damien
Date: Fri Apr 11 12:56:16 2008
New Revision: 647288

URL: http://svn.apache.org/viewvc?rev=647288&view=rev
Log:
Fix for parse bug when using non-ascii characters in json. fix for _revs_info meta info.

Modified:
    incubator/couchdb/branches/mochiweb/src/couchdb/cjson.erl
    incubator/couchdb/branches/mochiweb/src/couchdb/couch_db.erl
    incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl
    incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl

Modified: incubator/couchdb/branches/mochiweb/src/couchdb/cjson.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/cjson.erl?rev=647288&r1=647287&r2=647288&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/cjson.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/cjson.erl Fri Apr 11 12:56:16 2008
@@ -410,7 +410,7 @@
 tokenize([L | Rest], S) when is_list(L) ->
     tokenize(L ++ Rest, S);
 tokenize([B | Rest], S) when is_binary(B) ->
-    tokenize(xmerl_ucs:from_utf8(B) ++ Rest, S);
+    tokenize(xmerl_ucs:from_utf8(B) ++ Rest, S#decoder{input_encoding=unicode});
 tokenize("\r\n" ++ Rest, S) ->
     tokenize(Rest, ?INC_LINE(S));
 tokenize("\n" ++ Rest, S) ->

Modified: incubator/couchdb/branches/mochiweb/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/couch_db.erl?rev=647288&r1=647287&r2=647288&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/couch_db.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/couch_db.erl Fri Apr 11 12:56:16 2008
@@ -246,6 +246,7 @@
     end.
 
 update_docs(MainPid, Docs, Options) ->
+    % go ahead and generate the new revision ids for the documents.
     Docs2 = lists:map(
         fun(#doc{id=Id,revs=Revs}=Doc) ->
             case Id of
@@ -261,7 +262,7 @@
     Ids = [Id || [#doc{id=Id}|_] <- DocBuckets],
     Db = get_db(MainPid),
     
-    % first things first, lookup the doc by id and get the most recent
+    % lookup the doc by id and get the most recent
     
     ExistingDocs = get_full_doc_infos(Db, Ids),
     
@@ -276,7 +277,6 @@
             [prepare_doc_for_new_edit(Db, Doc, OldFullDocInfo, LeafRevsDict) || Doc <- Bucket]
         end,
         DocBuckets, ExistingDocs),
-    
     % flush unwritten binaries to disk.
     DocBuckets3 = [[doc_flush_binaries(Doc, Db#db.fd) || Doc <- Bucket] || Bucket <- DocBuckets2],
 
@@ -626,7 +626,14 @@
     true ->
         {[RevPath],[]} = 
             couch_key_tree:get_full_key_paths(RevTree, [DocInfo#doc_info.rev]),
-        [{revs_info, [{Rev, Deleted} || {Rev, {Deleted, _Sp0}} <- RevPath]}]
+        [{revs_info, lists:map(
+            fun({Rev, {true, _Sp}}) -> 
+                {Rev, deleted};
+            ({Rev, {false, _Sp}}) ->
+                {Rev, available};
+            ({Rev, ?REV_MISSING}) ->
+                {Rev, missing}
+            end, RevPath)}]
     end ++
     case lists:member(conflicts, Options) of
     false -> [];

Modified: incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl?rev=647288&r1=647287&r2=647288&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl Fri Apr 11 12:56:16 2008
@@ -406,7 +406,6 @@
     _ ->
         throw({bad_request, "Document rev and etag have different values"})
     end,
-
     {ok, NewRev} = couch_db:delete_doc(Db, DocId, [RevToDelete]),
     send_json(Req, 202, {obj, [
         {ok, true},

Modified: incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl?rev=647288&r1=647287&r2=647288&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/couch_server_sup.erl Fri Apr 11 12:56:16 2008
@@ -150,8 +150,8 @@
 
     ConfigInfo = io_lib:format("Config Info ~s:~n\tCurrentWorkingDir=~s~n" ++
         "\tDbRootDir=~s~n" ++
-        "\tBindAddress=~s~n" ++
-        "\tPort=~s~n" ++
+        "\tBindAddress=~p~n" ++
+        "\tPort=~p~n" ++
         "\tDocumentRoot=~s~n" ++
         "\tLogFile=~s~n" ++
         "\tUtilDriverDir=~s~n" ++