Permalink
Browse files

(#635) - low level method document availability support

parseDoc and merge have to support new availability option
  • Loading branch information...
1 parent 4187ae3 commit ef45f7ec264e96e91d907253b0a366ee9132adf3 @neojski committed Apr 4, 2013
Showing with 9 additions and 3 deletions.
  1. +6 −0 src/pouch.merge.js
  2. +3 −3 src/pouch.utils.js
View
@@ -48,6 +48,12 @@ function mergeTree(in_tree1, in_tree2) {
var tree1 = item.tree1;
var tree2 = item.tree2;
+ if (tree1[1].status === 'available' || tree2[1].status === 'available') {
+ tree1[1].status = 'available';
+ } else {
+ tree1[1].status = 'missing';
+ }
+
for (var i = 0; i < tree2[2].length; i++) {
if (!tree1[2][0]) {
conflicts = 'new_leaf';
View
@@ -79,7 +79,7 @@ var parseDoc = function(doc, newEdits) {
var nRevNum;
var newRevId;
var revInfo;
- var opts = {};
+ var opts = {status: 'available'};
if (doc._deleted) {
opts.deleted = true;
}
@@ -96,7 +96,7 @@ var parseDoc = function(doc, newEdits) {
}
doc._rev_tree = [{
pos: parseInt(revInfo[1], 10),
- ids: [revInfo[2], {}, [[newRevId, opts, []]]]
+ ids: [revInfo[2], {status: 'missing'}, [[newRevId, opts, []]]]
}];
nRevNum = parseInt(revInfo[1], 10) + 1;
} else {
@@ -114,7 +114,7 @@ var parseDoc = function(doc, newEdits) {
if (acc === null) {
return [x, opts, []];
} else {
- return [x, {}, [acc]];
+ return [x, {status: 'missing'}, [acc]];
}
}, null)
}];

0 comments on commit ef45f7e

Please sign in to comment.