Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 77509 invoked from network); 22 Sep 2010 15:15:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Sep 2010 15:15:41 -0000 Received: (qmail 39684 invoked by uid 500); 22 Sep 2010 15:15:41 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 39617 invoked by uid 500); 22 Sep 2010 15:15:38 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 39553 invoked by uid 99); 22 Sep 2010 15:15:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 15:15:37 +0000 X-ASF-Spam-Status: No, hits=-1996.4 required=10.0 tests=ALL_TRUSTED,FS_REPLICA X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 15:15:36 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B93AA2388A38; Wed, 22 Sep 2010 15:15:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1000032 - in /couchdb/branches/new_replicator: share/www/script/test/new_replication.js src/couchdb/couch_replicate.erl Date: Wed, 22 Sep 2010 15:15:16 -0000 To: commits@couchdb.apache.org From: fdmanana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100922151516.B93AA2388A38@eris.apache.org> Author: fdmanana Date: Wed Sep 22 15:15:16 2010 New Revision: 1000032 URL: http://svn.apache.org/viewvc?rev=1000032&view=rev Log: New replicator: allow percent encoded doc IDs just like the "old" replicator. Modified: couchdb/branches/new_replicator/share/www/script/test/new_replication.js couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl Modified: couchdb/branches/new_replicator/share/www/script/test/new_replication.js URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/share/www/script/test/new_replication.js?rev=1000032&r1=1000031&r2=1000032&view=diff ============================================================================== --- couchdb/branches/new_replicator/share/www/script/test/new_replication.js (original) +++ couchdb/branches/new_replicator/share/www/script/test/new_replication.js Wed Sep 22 15:15:16 2010 @@ -541,6 +541,7 @@ couchTests.new_replication = function(de { initial: ["1", "2"], after: ["7"], conflict_id: "1" }, { initial: ["1", "foo_666", "10"], after: ["7"], conflict_id: "10" }, { initial: ["_design/foo", "8"], after: ["foo_5"], conflict_id: "8" }, + { initial: ["_design%2Ffoo", "8"], after: ["foo_5"], conflict_id: "8" }, { initial: [], after: ["foo_1000", "_design/foo", "1"], conflict_id: "1" } ]; var doc_ids, after_doc_ids; @@ -582,7 +583,7 @@ couchTests.new_replication = function(de T(repResult.doc_write_failures === 0); for (k = 0; k < doc_ids.length; k++) { - id = doc_ids[k]; + id = decodeURIComponent(doc_ids[k]); doc = sourceDb.open(id); copy = targetDb.open(id); @@ -598,10 +599,11 @@ couchTests.new_replication = function(de // be absolutely sure that other docs were not replicated for (k = 0; k < docs.length; k++) { - id = docs[k]._id; - doc = targetDb.open(id); + var base_id = docs[k]._id; + id = encodeURIComponent(base_id); + doc = targetDb.open(base_id); - if (doc_ids.indexOf(id) >= 0) { + if ((doc_ids.indexOf(id) >= 0) || (doc_ids.indexOf(base_id) >= 0)) { T(doc !== null); } else { T(doc === null); @@ -658,10 +660,13 @@ couchTests.new_replication = function(de // be absolutely sure that other docs were not replicated for (k = 0; k < docs.length; k++) { - id = docs[k]._id; - doc = targetDb.open(id); - - if ((doc_ids.indexOf(id) >= 0) || (after_doc_ids.indexOf(id) >= 0)) { + var base_id = docs[k]._id; + id = encodeURIComponent(base_id); + doc = targetDb.open(base_id); + + if ((doc_ids.indexOf(id) >= 0) || (after_doc_ids.indexOf(id) >= 0) || + (doc_ids.indexOf(base_id) >= 0) || + (after_doc_ids.indexOf(base_id) >= 0)) { T(doc !== null); } else { T(doc === null); Modified: couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl?rev=1000032&r1=1000031&r2=1000032&view=diff ============================================================================== --- couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl (original) +++ couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl Wed Sep 22 15:15:16 2010 @@ -545,7 +545,10 @@ spawn_missing_revs_finder(StatsProcess, missing_revs_finder_loop(_, _, DocIds, MissingRevsQueue) when is_list(DocIds) -> lists:foreach( fun(DocId) -> - ok = couch_work_queue:queue(MissingRevsQueue, {doc_id, DocId}) + % Ensure same behaviour as old replicator: accept a list of percent + % encoded doc IDs. + Id = ?l2b(couch_httpd:unquote(DocId)), + ok = couch_work_queue:queue(MissingRevsQueue, {doc_id, Id}) end, DocIds), couch_work_queue:close(MissingRevsQueue);