couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klaus Trainer <klaus.trai...@web.de>
Subject [jira] Commented: (COUCHDB-902) Attachments that have recovered from conflict do not accept attachments.
Date Mon, 10 Jan 2011 00:18:45 GMT
The patch in my previous comment was crap.

I've edited the comment; now the patch looks like this:

diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl
index 20379ca..2bff4ab 100644
--- a/src/couchdb/couch_db.erl
+++ b/src/couchdb/couch_db.erl
@@ -727,8 +727,17 @@ update_docs(Db, Docs, Options, interactive_edit) ->
         ResultsDict = dict:from_list(IdRevs ++ CommitResults ++
PreCommitFailures),
         {ok, lists:map(
             fun(#doc{id=Id,revs={Pos, RevIds}}) ->
-                {ok, Result} = dict:find({Id, {Pos, RevIds}},
ResultsDict),
-                Result
+                Rev = case RevIds of
+                [] -> [];
+                _ -> hd(RevIds)
+                end,
+                case lists:member({Id, {Pos, [Rev]}, conflict},
CommitResults) of
+                false ->
+                    {ok, Result} = dict:find({Id, {Pos, RevIds}},
ResultsDict),
+                    Result;
+                true ->
+                    {Id, {Pos, [Rev]}, conflict}
+                end
             end, Docs)}
     end.


Mime
View raw message