So, I've added the CDT* stuff when the resolved revisions is not deleted.
But I haven't added any tests for the support attachments.

And I want to point out of couple of things that I noticed.

First, the CDTDatastore -updateDocumenWithId converts the TDStatus to an
NSError using the TDStatusToNSError. The error code changes in this process
to be equal to a CouchDB HTTP error, which has less information than a
TDStatus error. In addition to setting *error, should we be logging this
somehow (NSLog or use the TD* Log macro)?

Second, while tracking down the error codes, I noticed line 393 of
TD_Database+Insertion.m. It seems that this method could return nil and not
set the outStatus value. I think it should be set to kTDStatusDBError in
this case. What do you think?





On Thu, May 8, 2014 at 4:28 AM, Mike Rhodes <notifications@github.com>wrote:

> In Classes/common/CDTDatastore+Conflicts.m:
>
> > +
> > +        //
> > +        //create a new TD_Revision to insert into the database
> > +        //
> > +        toPutRevision = [[TD_Revision alloc] initWithDocID:docId
> > +                                                     revID:nil
> > +                                                   deleted:[resolvedRev deleted]];
> > +        if(![resolvedRev deleted])
> > +            toPutRevision.body = resolvedRev.td_rev.body;
> > +
> > +        //and the new winner...
> > +        [strongSelf.database putRevision:toPutRevision
> > +                          prevRevisionID:currentWinningTDRev.revID
> > +                           allowConflict:NO
> > +                                  status:&status
> > +                                database:db];
>
> Yes, the main problem here is that when using the TDDatabase put method,
> you need to copy over the attachments yourself because you'll not be
> supplying an _attachments dictionary that the TDDatabase method requires.
> See CDTDatastore.m#L423-L443<https://github.com/cloudant/CDTDatastore/blob/master/Classes/common/CDTDatastore.m#L423-L443>
> .
>
> If at all possible, I'd use the -updateDocumentWithId:prevRev:body:inTransaction:rollback:
> error: in CDTDatastore rather than TD_Datastore's version.
>
> Possibly, at the point we need to understand other instances of
> TD_Datastores -putRevision:... that you are using. I think that, in
> general, updates that are happening in response to calls to our API layer
> are going to have to go via other calls in our API layer as we're starting
> to introduce custom functionality.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/cloudant/CDTDatastore/pull/22/files#r12424128>
> .
>