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 2014/02/13 01:18:43 UTC

[01/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Updated Branches:
  refs/heads/1994-merge-rcouch 589d9589c -> c8f517dc4 (forced update)


remove Makefile.am from apps/ and fix couchspawnkillable


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/4a84e12e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/4a84e12e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/4a84e12e

Branch: refs/heads/1994-merge-rcouch
Commit: 4a84e12e3914b39d011418c72948461d3d02456a
Parents: 761d5e1
Author: benoitc <be...@apache.org>
Authored: Tue Jan 7 19:15:43 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:57 2014 -0600

----------------------------------------------------------------------
 Makefile.am | 78 --------------------------------------------------------
 1 file changed, 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/4a84e12e/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 2dcd47d..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,78 +0,0 @@
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy of
-## the License at
-##
-##   http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations under
-## the License.
-
-couch_replicatorlibdir = $(localerlanglibdir)/couch_replicator-0.1
-couch_replicatorincludedir = $(couch_replicatorlibdir)/include
-couch_replicatorebindir = $(couch_replicatorlibdir)/ebin
-
-couch_replicatorinclude_DATA = $(include_files)
-couch_replicatorebin_DATA = $(compiled_files)
-
-include_files = \
-	src/couch_replicator_api_wrap.hrl \
-	src/couch_replicator.hrl \
-	src/couch_replicator_js_functions.hrl
-
-source_files = \
-	src/couch_replicator_api_wrap.erl \
-	src/couch_replicator_httpc_pool.erl \
-	src/couch_replicator_httpc.erl \
-	src/couch_replicator_httpd.erl \
-	src/couch_replicator_job_sup.erl \
-	src/couch_replicator_notifier.erl \
-	src/couch_replicator_manager.erl \
-	src/couch_replicator_utils.erl \
-	src/couch_replicator_worker.erl \
-	src/couch_replicator.app.src \
-	src/couch_replicator.erl
-
-test_files = \
-	test/01-load.t \
-	test/02-httpc-pool.t \
-	test/03-replication-compact.t \
-	test/04-replication-large-atts.t \
-	test/05-replication-many-leaves.t \
-	test/06-doc-missing-stubs.t \
-	test/07-use-checkpoints.t
-
-compiled_files = \
-	ebin/couch_replicator_api_wrap.beam \
-	ebin/couch_replicator_httpc_pool.beam \
-	ebin/couch_replicator_httpc.beam \
-	ebin/couch_replicator_httpd.beam \
-	ebin/couch_replicator_job_sup.beam \
-	ebin/couch_replicator_notifier.beam \
-	ebin/couch_replicator_manager.beam \
-	ebin/couch_replicator_utils.beam \
-	ebin/couch_replicator_worker.beam \
-	ebin/couch_replicator.app \
-	ebin/couch_replicator.beam
-
-EXTRA_DIST = $(include_files) $(source_files) $(test_files)
-CLEANFILES = $(compiled_files)
-
-check:
-if TESTS
-	$(abs_top_builddir)/test/etap/run $(abs_top_srcdir)/src/couch_replicator/test
-endif
-
-ebin/%.app: src/%.app.src
-	@mkdir -p ebin/
-	sed -e "s|%version%|@version@|g" \
-	< $< > $@
-
-ebin/%.beam: src/%.erl $(include_files)
-	@mkdir -p ebin/
-	$(ERLC) -Wall -I$(top_srcdir)/src -I$(top_srcdir)/src/couchdb \
-        -o ebin/ $(ERLC_FLAGS) ${TEST} $<;
-
-


[04/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
make the couch_replicator a full Erlang application


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/cad68988
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/cad68988
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/cad68988

Branch: refs/heads/1994-merge-rcouch
Commit: cad689889a72f80f1a59668d4949430b422cd4b5
Parents: 05cdb34
Author: benoitc <be...@apache.org>
Authored: Tue Jan 7 00:15:26 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:57 2014 -0600

----------------------------------------------------------------------
 src/couch_replicator.app.src         | 23 +++++-------
 src/couch_replicator_app.erl         | 29 +++++++++++++++
 src/couch_replicator_manager_sup.erl | 47 ++++++++++++++++++++++++
 src/couch_replicator_sup.erl         | 59 +++++++++++++++++++++++++++++++
 4 files changed, 144 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/cad68988/src/couch_replicator.app.src
----------------------------------------------------------------------
diff --git a/src/couch_replicator.app.src b/src/couch_replicator.app.src
index 750eaad..1e62edf 100644
--- a/src/couch_replicator.app.src
+++ b/src/couch_replicator.app.src
@@ -13,21 +13,16 @@
 {application, couch_replicator, [
     {description, "CouchDB replicator"},
     {vsn, "%version%"},
-    {modules, [  
-        couch_replicator_api_wrap,
-        couch_replicator_httpc,
-        couch_replicator_httpd,
-        couch_replicator_job_sup,
-        couch_replicator_notifier,
-        couch_replicator_manager,
-        couch_replicator_httpc_pool,
-        couch_replicator_utils,
-        couch_replicator_worker,
-        couch_replicator
-    ]},
+    {modules, []},
     {registered, [
-        couch_replicator_job_sup
+        couch_replicator_manager_sup,
+        couch_replicator_job_sup,
+        couch_replicator_sup
     ]},
-    {applications, [kernel, stdlib]}
+    {applications, [kernel, stdlib, crypto, sasl, inets, oauth, ibrowse,
+                   couch]},
+
+    {mod, { couch_replicator_app, []}},
+    {env, []}
 ]}.
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/cad68988/src/couch_replicator_app.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_app.erl b/src/couch_replicator_app.erl
new file mode 100644
index 0000000..4083db6
--- /dev/null
+++ b/src/couch_replicator_app.erl
@@ -0,0 +1,29 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_replicator_app).
+
+-behaviour(application).
+
+%% Application callbacks
+-export([start/2, stop/1]).
+
+%% ===================================================================
+%% Application callbacks
+%% ===================================================================
+
+start(_StartType, _StartArgs) ->
+    couch_util:start_app_deps(couch_replicator),
+    couch_replicator_sup:start_link().
+
+stop(_State) ->
+    ok.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/cad68988/src/couch_replicator_manager_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_manager_sup.erl b/src/couch_replicator_manager_sup.erl
new file mode 100644
index 0000000..f292546
--- /dev/null
+++ b/src/couch_replicator_manager_sup.erl
@@ -0,0 +1,47 @@
+
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_replicator_manager_sup).
+
+-behaviour(supervisor).
+
+%% API
+-export([start_link/0]).
+
+%% Supervisor callbacks
+-export([init/1]).
+
+%% Helper macro for declaring children of supervisor
+-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
+
+%% ===================================================================
+%% API functions
+%% ===================================================================
+
+start_link() ->
+    supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+%% ===================================================================
+%% Supervisor callbacks
+%% ===================================================================
+
+init([]) ->
+    Children = [
+        {couch_replicator_manager,
+            {couch_replicator_manager, start_link, []},
+            permanent,
+            brutal_kill,
+            worker,
+            [couch_replicator_manager]}
+    ],
+    {ok, { {one_for_one, 10, 3600}, Children} }.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/cad68988/src/couch_replicator_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_sup.erl b/src/couch_replicator_sup.erl
new file mode 100644
index 0000000..905e2cf
--- /dev/null
+++ b/src/couch_replicator_sup.erl
@@ -0,0 +1,59 @@
+
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_replicator_sup).
+
+-behaviour(supervisor).
+
+%% API
+-export([start_link/0]).
+
+%% Supervisor callbacks
+-export([init/1]).
+
+%% Helper macro for declaring children of supervisor
+-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
+
+%% ===================================================================
+%% API functions
+%% ===================================================================
+
+start_link() ->
+    supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+%% ===================================================================
+%% Supervisor callbacks
+%% ===================================================================
+
+init([]) ->
+    Children = [
+        {couch_replication_event,
+            {gen_event, start_link, [{local, couch_replication}]},
+            permanent,
+            brutal_kill,
+            worker,
+            dynamic},
+        {couch_replicator_job_sup,
+            {couch_replicator_job_sup, start_link, []},
+            permanent,
+            infinity,
+            supervisor,
+            [couch_replicator_job_sup]},
+        {couch_replicator_manager_sup,
+            {couch_replicator_manager_sup, start_link, []},
+            permanent,
+            infinity,
+            supervisor,
+            [couch_replicator_manager_sup]}
+    ],
+    {ok, { {one_for_one, 10, 3600}, Children} }.


[03/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
working release


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/761d5e18
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/761d5e18
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/761d5e18

Branch: refs/heads/1994-merge-rcouch
Commit: 761d5e1843a72d826e6a94a1353395903bfa4858
Parents: cad6898
Author: benoitc <be...@apache.org>
Authored: Tue Jan 7 16:14:56 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:57 2014 -0600

----------------------------------------------------------------------
 src/couch_replicator.app.src | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/761d5e18/src/couch_replicator.app.src
----------------------------------------------------------------------
diff --git a/src/couch_replicator.app.src b/src/couch_replicator.app.src
index 1e62edf..3e71b3b 100644
--- a/src/couch_replicator.app.src
+++ b/src/couch_replicator.app.src
@@ -12,7 +12,7 @@
 
 {application, couch_replicator, [
     {description, "CouchDB replicator"},
-    {vsn, "%version%"},
+    {vsn, "1.6.1"},
     {modules, []},
     {registered, [
         couch_replicator_manager_sup,


[08/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
start and stop the application correctly


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/79992023
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/79992023
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/79992023

Branch: refs/heads/1994-merge-rcouch
Commit: 799920234ceb4db5cec2d07ecd7a0643d2f12e18
Parents: a92ef9a
Author: benoitc <be...@apache.org>
Authored: Mon Jan 13 22:30:39 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 test/02-httpc-pool.t              |  8 ++------
 test/03-replication-compact.t     | 21 ++++++---------------
 test/04-replication-large-atts.t  | 10 ++--------
 test/05-replication-many-leaves.t | 10 +++-------
 test/06-doc-missing-stubs.t       |  9 ++-------
 test/07-use-checkpoints.t         |  9 ++-------
 6 files changed, 17 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/79992023/test/02-httpc-pool.t
----------------------------------------------------------------------
diff --git a/test/02-httpc-pool.t b/test/02-httpc-pool.t
index 9446c9b..560b6a1 100755
--- a/test/02-httpc-pool.t
+++ b/test/02-httpc-pool.t
@@ -15,8 +15,6 @@
 % the License.
 
 main(_) ->
-    test_util:init_code_path(),
-
     etap:plan(55),
     case (catch test()) of
         ok ->
@@ -29,15 +27,13 @@ main(_) ->
 
 
 test() ->
-    couch_server_sup:start_link(test_util:config_files()),
-    couch_httpd_sup:start_link(),
-    ibrowse:start(),
+    test_util:start_couch(),
 
     test_pool_full(),
     test_worker_dead_pool_non_full(),
     test_worker_dead_pool_full(),
 
-    couch_server_sup:stop(),
+    test_util:stop_couch(),
     ok.
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/79992023/test/03-replication-compact.t
----------------------------------------------------------------------
diff --git a/test/03-replication-compact.t b/test/03-replication-compact.t
index d89a539..699f698 100755
--- a/test/03-replication-compact.t
+++ b/test/03-replication-compact.t
@@ -69,10 +69,8 @@ source_db_name() -> <<"couch_test_rep_db_a">>.
 target_db_name() -> <<"couch_test_rep_db_b">>.
 
 
-main(_) ->
-    test_util:init_code_path(),
-
-    etap:plan(376),
+main(_) ->    
+etap:plan(376),
     case (catch test()) of
         ok ->
             etap:end_tests();
@@ -84,11 +82,7 @@ main(_) ->
 
 
 test() ->
-    couch_server_sup:start_link(test_util:config_files()),
-    couch_httpd_sup:start_link(),
-    couch_replicator_sup:start_link(),
-
-    ibrowse:start(),
+    test_util:start_couch(),
 
     Pairs = [
         {source_db_name(), target_db_name()},
@@ -119,16 +113,13 @@ test() ->
 
             delete_db(SourceDb),
             delete_db(TargetDb),
-            couch_server_sup:stop(),
-            couch_replicator_sup:stop(),
-
+            test_util:stop_couch(),
             ok = timer:sleep(1000),
-            couch_server_sup:start_link(test_util:config_files()),
-            couch_replicator_sup:start_link()
+            test_util:start_couch()  
         end,
         Pairs),
 
-    couch_server_sup:stop(),
+    test_util:stop_couch(),
     ok.
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/79992023/test/04-replication-large-atts.t
----------------------------------------------------------------------
diff --git a/test/04-replication-large-atts.t b/test/04-replication-large-atts.t
index 04e7861..c001f3e 100755
--- a/test/04-replication-large-atts.t
+++ b/test/04-replication-large-atts.t
@@ -51,8 +51,6 @@ target_db_name() -> <<"couch_test_rep_db_b">>.
 
 
 main(_) ->
-    test_util:init_code_path(),
-
     etap:plan(1192),
     case (catch test()) of
         ok ->
@@ -65,12 +63,8 @@ main(_) ->
 
 
 test() ->
-    couch_server_sup:start_link(test_util:config_files()),
-    couch_httpd_sup:start_link(),
-    couch_replicator_sup:start_link(),
+    test_util:start_couch(),
 
-    application:start(ibrowse),
-    application:start(crypto),
     couch_config:set("attachments", "compressible_types", "text/*", false),
 
     Pairs = [
@@ -103,7 +97,7 @@ test() ->
         Pairs),
 
     delete_db(SourceDb),
-    couch_server_sup:stop(),
+    test_util:stop_couch(),
     ok.
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/79992023/test/05-replication-many-leaves.t
----------------------------------------------------------------------
diff --git a/test/05-replication-many-leaves.t b/test/05-replication-many-leaves.t
index fbb9d95..c4c0007 100755
--- a/test/05-replication-many-leaves.t
+++ b/test/05-replication-many-leaves.t
@@ -77,12 +77,8 @@ main(_) ->
 
 
 test() ->
-    couch_server_sup:start_link(test_util:config_files()),
-    couch_httpd_sup:start_link(),
-    couch_replicator_sup:start_link(),
-
-    ibrowse:start(),
-    crypto:start(),
+    test_util:start_couch(),
+ 
     couch_config:set("replicator", "connection_timeout", "90000", false),
 
     Pairs = [
@@ -130,7 +126,7 @@ test() ->
         end,
         Pairs),
 
-    couch_server_sup:stop(),
+    test_util:stop_couch(),
     ok.
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/79992023/test/06-doc-missing-stubs.t
----------------------------------------------------------------------
diff --git a/test/06-doc-missing-stubs.t b/test/06-doc-missing-stubs.t
index 5fbb7f3..5db5830 100755
--- a/test/06-doc-missing-stubs.t
+++ b/test/06-doc-missing-stubs.t
@@ -54,8 +54,6 @@ target_revs_limit() -> 3.
 
 
 main(_) ->
-    test_util:init_code_path(),
-
     etap:plan(128),
     case (catch test()) of
         ok ->
@@ -69,10 +67,7 @@ main(_) ->
 
 % Test motivated by COUCHDB-1365.
 test() ->
-    couch_server_sup:start_link(test_util:config_files()),
-    couch_httpd_sup:start_link(),
-    couch_replicator_sup:start_link(),
-    ibrowse:start(),
+    test_util:start_couch(),
 
     Pairs = [
         {source_db_name(), target_db_name()},
@@ -113,7 +108,7 @@ test() ->
         end,
         Pairs),
 
-    couch_server_sup:stop(),
+    test_util:stop_couch(),
     ok.
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/79992023/test/07-use-checkpoints.t
----------------------------------------------------------------------
diff --git a/test/07-use-checkpoints.t b/test/07-use-checkpoints.t
index 193b17d..9f975e2 100755
--- a/test/07-use-checkpoints.t
+++ b/test/07-use-checkpoints.t
@@ -79,8 +79,6 @@ target_db_name() -> <<"couch_test_rep_db_b">>.
 
 
 main(_) ->
-    test_util:init_code_path(),
-
     etap:plan(16),
     case (catch test()) of
         ok ->
@@ -93,15 +91,12 @@ main(_) ->
 
 
 test() ->
-    couch_server_sup:start_link(test_util:config_files()),
-    couch_httpd_sup:start_link(),
-    couch_replicator_sup:start_link(),
-    ibrowse:start(),
+    test_util:start_couch(),
 
     test_use_checkpoints(false),
     test_use_checkpoints(true),
 
-    couch_server_sup:stop(),
+    test_util:stop_couch(),
     ok.
 
 


[02/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
inital move to rebar compilation

- move src/apps
- download dependencies using rebar
- replace ejson by jiffy
- replace couch_drv & couch_ejson_compare by couch_collate


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/05cdb348
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/05cdb348
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/05cdb348

Branch: refs/heads/1994-merge-rcouch
Commit: 05cdb348bb715d89b633d73e27ad1eba8efd63c7
Parents: b58ffb9
Author: benoitc <be...@apache.org>
Authored: Mon Jan 6 21:12:45 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:57 2014 -0600

----------------------------------------------------------------------
 src/couch_replicator.erl            | 2 +-
 src/couch_replicator_api_wrap.erl   | 2 +-
 src/couch_replicator_httpc.erl      | 4 ++--
 src/couch_replicator_httpc_pool.erl | 2 +-
 src/couch_replicator_httpd.erl      | 2 +-
 src/couch_replicator_job_sup.erl    | 2 +-
 src/couch_replicator_manager.erl    | 2 +-
 src/couch_replicator_notifier.erl   | 2 +-
 src/couch_replicator_utils.erl      | 4 ++--
 src/couch_replicator_worker.erl     | 2 +-
 10 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index 91039b6..d470c8a 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -24,7 +24,7 @@
 -export([init/1, terminate/2, code_change/3]).
 -export([handle_call/3, handle_cast/2, handle_info/2]).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 -include("couch_replicator_api_wrap.hrl").
 -include("couch_replicator.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_api_wrap.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_api_wrap.erl b/src/couch_replicator_api_wrap.erl
index 52e15b7..311025b 100644
--- a/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator_api_wrap.erl
@@ -18,7 +18,7 @@
 % Notes:
 % Many options and apis aren't yet supported here, they are added as needed.
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 -include("couch_replicator_api_wrap.hrl").
 
 -export([

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_httpc.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_httpc.erl b/src/couch_replicator_httpc.erl
index b8fb31b..c13bf18 100644
--- a/src/couch_replicator_httpc.erl
+++ b/src/couch_replicator_httpc.erl
@@ -12,9 +12,9 @@
 
 -module(couch_replicator_httpc).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 -include("couch_replicator_api_wrap.hrl").
--include("../ibrowse/ibrowse.hrl").
+-include_lib("ibrowse/include/ibrowse.hrl").
 
 -export([setup/1]).
 -export([send_req/3]).

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_httpc_pool.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_httpc_pool.erl b/src/couch_replicator_httpc_pool.erl
index b065b7c..a82a2df 100644
--- a/src/couch_replicator_httpc_pool.erl
+++ b/src/couch_replicator_httpc_pool.erl
@@ -21,7 +21,7 @@
 -export([init/1, handle_call/3, handle_info/2, handle_cast/2]).
 -export([code_change/3, terminate/2]).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 
 -import(couch_util, [
     get_value/2,

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_httpd.erl b/src/couch_replicator_httpd.erl
index c0fe004..0a21d52 100644
--- a/src/couch_replicator_httpd.erl
+++ b/src/couch_replicator_httpd.erl
@@ -12,7 +12,7 @@
 
 -module(couch_replicator_httpd).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 
 -import(couch_httpd, [
     send_json/2,

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_job_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_job_sup.erl b/src/couch_replicator_job_sup.erl
index e8a7b96..484cc1a 100644
--- a/src/couch_replicator_job_sup.erl
+++ b/src/couch_replicator_job_sup.erl
@@ -14,7 +14,7 @@
 -behaviour(supervisor).
 -export([init/1, start_link/0]).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 
 start_link() ->
     supervisor:start_link({local,?MODULE}, ?MODULE, []).

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_manager.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_manager.erl b/src/couch_replicator_manager.erl
index 4891c4c..8055727 100644
--- a/src/couch_replicator_manager.erl
+++ b/src/couch_replicator_manager.erl
@@ -22,7 +22,7 @@
 -export([start_link/0, init/1, handle_call/3, handle_info/2, handle_cast/2]).
 -export([code_change/3, terminate/2]).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 -include("couch_replicator.hrl").
 -include("couch_replicator_js_functions.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_notifier.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_notifier.erl b/src/couch_replicator_notifier.erl
index 3b48b71..39fd68b 100644
--- a/src/couch_replicator_notifier.erl
+++ b/src/couch_replicator_notifier.erl
@@ -21,7 +21,7 @@
 -export([init/1, terminate/2, code_change/3]).
 -export([handle_event/2, handle_call/2, handle_info/2]).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 
 start_link(FunAcc) ->
     couch_event_sup:start_link(couch_replication,

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_utils.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_utils.erl b/src/couch_replicator_utils.erl
index 240d7d4..0baddc2 100644
--- a/src/couch_replicator_utils.erl
+++ b/src/couch_replicator_utils.erl
@@ -18,10 +18,10 @@
 -export([replication_id/2]).
 -export([sum_stats/2]).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 -include("couch_replicator_api_wrap.hrl").
 -include("couch_replicator.hrl").
--include("../ibrowse/ibrowse.hrl").
+-include_lib("ibrowse/include/ibrowse.hrl").
 
 -import(couch_util, [
     get_value/2,

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/05cdb348/src/couch_replicator_worker.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_worker.erl b/src/couch_replicator_worker.erl
index d66d478..0f65900 100644
--- a/src/couch_replicator_worker.erl
+++ b/src/couch_replicator_worker.erl
@@ -20,7 +20,7 @@
 -export([init/1, terminate/2, code_change/3]).
 -export([handle_call/3, handle_cast/2, handle_info/2]).
 
--include("couch_db.hrl").
+-include_lib("couch/include/couch_db.hrl").
 -include("couch_replicator_api_wrap.hrl").
 -include("couch_replicator.hrl").
 


[06/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
fix replication tests


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/0aaa2211
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/0aaa2211
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/0aaa2211

Branch: refs/heads/1994-merge-rcouch
Commit: 0aaa221118913643b7051df80e973f93e7b80e00
Parents: 600dc4a
Author: benoitc <be...@apache.org>
Authored: Thu Jan 9 23:41:26 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 test/05-replication-many-leaves.t | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/0aaa2211/test/05-replication-many-leaves.t
----------------------------------------------------------------------
diff --git a/test/05-replication-many-leaves.t b/test/05-replication-many-leaves.t
index 8a5008b..d10419f 100755
--- a/test/05-replication-many-leaves.t
+++ b/test/05-replication-many-leaves.t
@@ -1,5 +1,7 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
+%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of
 % the License at


[10/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
couch_replicator: fix test 03-replication-compact.t

the record rep has bene upddated in the previous change to handle a
replication based on a view index. Fix it.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/c8f517dc
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/c8f517dc
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/c8f517dc

Branch: refs/heads/1994-merge-rcouch
Commit: c8f517dc4b6d9515f1e1de5830477385aa968bc3
Parents: 09d7a60
Author: benoitc <bc...@gmail.com>
Authored: Tue Feb 11 11:48:46 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 test/03-replication-compact.t | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/c8f517dc/test/03-replication-compact.t
----------------------------------------------------------------------
diff --git a/test/03-replication-compact.t b/test/03-replication-compact.t
index 699f698..2deb9dd 100755
--- a/test/03-replication-compact.t
+++ b/test/03-replication-compact.t
@@ -61,6 +61,8 @@
     target,
     options,
     user_ctx,
+    type = db,
+    view = nil,
     doc_id
 }).
 
@@ -69,7 +71,7 @@ source_db_name() -> <<"couch_test_rep_db_a">>.
 target_db_name() -> <<"couch_test_rep_db_b">>.
 
 
-main(_) ->    
+main(_) ->
 etap:plan(376),
     case (catch test()) of
         ok ->
@@ -115,7 +117,7 @@ test() ->
             delete_db(TargetDb),
             test_util:stop_couch(),
             ok = timer:sleep(1000),
-            test_util:start_couch()  
+            test_util:start_couch()
         end,
         Pairs),
 


[09/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
add `make test` target . all erlang test pass

note: from time to time there is a timing issue on 200- test that need
to be fixed. It is most probably due to the way the indexer is
supervised.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/7da1d78b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/7da1d78b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/7da1d78b

Branch: refs/heads/1994-merge-rcouch
Commit: 7da1d78bb5e4571507112409613a4bc3ea504de7
Parents: 4a84e12
Author: benoitc <be...@apache.org>
Authored: Thu Jan 9 16:24:32 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 test/01-load.t                    | 1 +
 test/02-httpc-pool.t              | 2 ++
 test/03-replication-compact.t     | 6 +++++-
 test/04-replication-large-atts.t  | 4 ++++
 test/05-replication-many-leaves.t | 2 ++
 test/06-doc-missing-stubs.t       | 3 +++
 test/07-use-checkpoints.t         | 3 +++
 7 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7da1d78b/test/01-load.t
----------------------------------------------------------------------
diff --git a/test/01-load.t b/test/01-load.t
index 8bd82dd..d901ee8 100644
--- a/test/01-load.t
+++ b/test/01-load.t
@@ -1,5 +1,6 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
+%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
 
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7da1d78b/test/02-httpc-pool.t
----------------------------------------------------------------------
diff --git a/test/02-httpc-pool.t b/test/02-httpc-pool.t
index a7bde6c..aac2eb5 100755
--- a/test/02-httpc-pool.t
+++ b/test/02-httpc-pool.t
@@ -1,5 +1,7 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
+%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of
 % the License at

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7da1d78b/test/03-replication-compact.t
----------------------------------------------------------------------
diff --git a/test/03-replication-compact.t b/test/03-replication-compact.t
index 7c4d38c..3e52b37 100755
--- a/test/03-replication-compact.t
+++ b/test/03-replication-compact.t
@@ -1,5 +1,7 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
+%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of
 % the License at
@@ -83,6 +85,8 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_replicator_sup:start_link(),
+
     ibrowse:start(),
 
     Pairs = [
@@ -484,5 +488,5 @@ cancel_replication(RepId, RepPid) ->
 
 att_data() ->
     {ok, Data} = file:read_file(
-        test_util:source_file("share/www/image/logo.png")),
+        test_util:build_file("share/www/image/logo.png")),
     Data.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7da1d78b/test/04-replication-large-atts.t
----------------------------------------------------------------------
diff --git a/test/04-replication-large-atts.t b/test/04-replication-large-atts.t
index a7063c7..da927e9 100755
--- a/test/04-replication-large-atts.t
+++ b/test/04-replication-large-atts.t
@@ -1,5 +1,7 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
+%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of
 % the License at
@@ -64,6 +66,8 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_replicator_sup:start_link(),
+
     application:start(ibrowse),
     application:start(crypto),
     couch_config:set("attachments", "compressible_types", "text/*", false),

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7da1d78b/test/05-replication-many-leaves.t
----------------------------------------------------------------------
diff --git a/test/05-replication-many-leaves.t b/test/05-replication-many-leaves.t
index 212ee99..8a5008b 100755
--- a/test/05-replication-many-leaves.t
+++ b/test/05-replication-many-leaves.t
@@ -76,6 +76,8 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_replicator_sup:start_link(),
+
     ibrowse:start(),
     crypto:start(),
     couch_config:set("replicator", "connection_timeout", "90000", false),

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7da1d78b/test/06-doc-missing-stubs.t
----------------------------------------------------------------------
diff --git a/test/06-doc-missing-stubs.t b/test/06-doc-missing-stubs.t
index e17efc9..cee19ca 100755
--- a/test/06-doc-missing-stubs.t
+++ b/test/06-doc-missing-stubs.t
@@ -1,5 +1,7 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
+%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of
 % the License at
@@ -68,6 +70,7 @@ main(_) ->
 % Test motivated by COUCHDB-1365.
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_replicator_sup:start_link(),
     ibrowse:start(),
 
     Pairs = [

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7da1d78b/test/07-use-checkpoints.t
----------------------------------------------------------------------
diff --git a/test/07-use-checkpoints.t b/test/07-use-checkpoints.t
index cefc1a7..af7ec44 100755
--- a/test/07-use-checkpoints.t
+++ b/test/07-use-checkpoints.t
@@ -1,4 +1,6 @@
 #!/usr/bin/env escript
+%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+
 %% -*- erlang -*-
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of
@@ -92,6 +94,7 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_replicator_sup:start_link(),
     ibrowse:start(),
 
     test_use_checkpoints(false),


[11/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
make couch_httpd a full couch application

With this change, the HTTP API is now handled by its own erlang
application and supervision. It also improved the way you can reload the
configuration and the modules. Now upgrading a listener or its
configuration is first removing it from the supervsion then start the
new process with the new configuration. This behaviour is similar to the
one you have in nginx.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/bf97776e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/bf97776e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/bf97776e

Branch: refs/heads/1994-merge-rcouch
Commit: bf97776e398f0cad7b2523160c03588902a5a48f
Parents: 0aaa221
Author: benoitc <be...@apache.org>
Authored: Sat Jan 11 11:20:27 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 test/02-httpc-pool.t              | 1 +
 test/03-replication-compact.t     | 3 ++-
 test/04-replication-large-atts.t  | 3 ++-
 test/05-replication-many-leaves.t | 3 ++-
 test/06-doc-missing-stubs.t       | 3 ++-
 test/07-use-checkpoints.t         | 3 ++-
 6 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/bf97776e/test/02-httpc-pool.t
----------------------------------------------------------------------
diff --git a/test/02-httpc-pool.t b/test/02-httpc-pool.t
index aac2eb5..50f40db 100755
--- a/test/02-httpc-pool.t
+++ b/test/02-httpc-pool.t
@@ -30,6 +30,7 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_httpd_sup:start_link(),
     ibrowse:start(),
 
     test_pool_full(),

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/bf97776e/test/03-replication-compact.t
----------------------------------------------------------------------
diff --git a/test/03-replication-compact.t b/test/03-replication-compact.t
index 801b173..d42049a 100755
--- a/test/03-replication-compact.t
+++ b/test/03-replication-compact.t
@@ -85,6 +85,7 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_httpd_sup:start_link(),
     couch_replicator_sup:start_link(),
 
     ibrowse:start(),
@@ -440,7 +441,7 @@ maybe_pause(Parent, Counter) ->
 db_url(DbName) ->
     iolist_to_binary([
         "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
-        ":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
+        ":", integer_to_list(mochiweb_socket_server:get(couch_http, port)),
         "/", DbName
     ]).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/bf97776e/test/04-replication-large-atts.t
----------------------------------------------------------------------
diff --git a/test/04-replication-large-atts.t b/test/04-replication-large-atts.t
index da927e9..eb750e6 100755
--- a/test/04-replication-large-atts.t
+++ b/test/04-replication-large-atts.t
@@ -66,6 +66,7 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_httpd_sup:start_link(),
     couch_replicator_sup:start_link(),
 
     application:start(ibrowse),
@@ -232,7 +233,7 @@ att_decoded_md5(Att) ->
 db_url(DbName) ->
     iolist_to_binary([
         "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
-        ":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
+        ":", integer_to_list(mochiweb_socket_server:get(couch_http, port)),
         "/", DbName
     ]).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/bf97776e/test/05-replication-many-leaves.t
----------------------------------------------------------------------
diff --git a/test/05-replication-many-leaves.t b/test/05-replication-many-leaves.t
index d10419f..5c2aa27 100755
--- a/test/05-replication-many-leaves.t
+++ b/test/05-replication-many-leaves.t
@@ -78,6 +78,7 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_httpd_sup:start_link(),
     couch_replicator_sup:start_link(),
 
     ibrowse:start(),
@@ -259,7 +260,7 @@ add_attachments(SourceDb, [{DocId, RevList} | Rest], NumAtts, IdRevsAcc) ->
 db_url(DbName) ->
     iolist_to_binary([
         "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
-        ":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
+        ":", integer_to_list(mochiweb_socket_server:get(couch_http, port)),
         "/", DbName
     ]).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/bf97776e/test/06-doc-missing-stubs.t
----------------------------------------------------------------------
diff --git a/test/06-doc-missing-stubs.t b/test/06-doc-missing-stubs.t
index cee19ca..2e37d59 100755
--- a/test/06-doc-missing-stubs.t
+++ b/test/06-doc-missing-stubs.t
@@ -70,6 +70,7 @@ main(_) ->
 % Test motivated by COUCHDB-1365.
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_httpd_sup:start_link(),
     couch_replicator_sup:start_link(),
     ibrowse:start(),
 
@@ -268,7 +269,7 @@ att_decoded_md5(Att) ->
 db_url(DbName) ->
     iolist_to_binary([
         "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
-        ":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
+        ":", integer_to_list(mochiweb_socket_server:get(couch_http, port)),
         "/", DbName
     ]).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/bf97776e/test/07-use-checkpoints.t
----------------------------------------------------------------------
diff --git a/test/07-use-checkpoints.t b/test/07-use-checkpoints.t
index af7ec44..1631328 100755
--- a/test/07-use-checkpoints.t
+++ b/test/07-use-checkpoints.t
@@ -94,6 +94,7 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_httpd_sup:start_link(),
     couch_replicator_sup:start_link(),
     ibrowse:start(),
 
@@ -210,7 +211,7 @@ compare_dbs(#db{name = SourceName}, #db{name = TargetName}) ->
 db_url(DbName) ->
     iolist_to_binary([
         "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
-        ":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
+        ":", integer_to_list(mochiweb_socket_server:get(couch_http, port)),
         "/", DbName
     ]).
 


[07/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
move src/* to the root

There is no need of an src/ folder except for an aesthetic reason, we
are obviously distributing a source. This layout is alos more common in
the Erlang world, and most editor and package manager understand it.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/a92ef9ac
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/a92ef9ac
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/a92ef9ac

Branch: refs/heads/1994-merge-rcouch
Commit: a92ef9aceabf86d493e6b3e12e11b9520ef8fd17
Parents: bf97776
Author: benoitc <be...@apache.org>
Authored: Sun Jan 12 10:17:31 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 test/01-load.t                    | 2 +-
 test/02-httpc-pool.t              | 2 +-
 test/03-replication-compact.t     | 2 +-
 test/04-replication-large-atts.t  | 2 +-
 test/05-replication-many-leaves.t | 2 +-
 test/06-doc-missing-stubs.t       | 2 +-
 test/07-use-checkpoints.t         | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/a92ef9ac/test/01-load.t
----------------------------------------------------------------------
diff --git a/test/01-load.t b/test/01-load.t
index d901ee8..b900297 100644
--- a/test/01-load.t
+++ b/test/01-load.t
@@ -1,6 +1,6 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
-%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap
 
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/a92ef9ac/test/02-httpc-pool.t
----------------------------------------------------------------------
diff --git a/test/02-httpc-pool.t b/test/02-httpc-pool.t
index 50f40db..9446c9b 100755
--- a/test/02-httpc-pool.t
+++ b/test/02-httpc-pool.t
@@ -1,6 +1,6 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
-%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap
 
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/a92ef9ac/test/03-replication-compact.t
----------------------------------------------------------------------
diff --git a/test/03-replication-compact.t b/test/03-replication-compact.t
index d42049a..d89a539 100755
--- a/test/03-replication-compact.t
+++ b/test/03-replication-compact.t
@@ -1,6 +1,6 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
-%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap
 
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/a92ef9ac/test/04-replication-large-atts.t
----------------------------------------------------------------------
diff --git a/test/04-replication-large-atts.t b/test/04-replication-large-atts.t
index eb750e6..04e7861 100755
--- a/test/04-replication-large-atts.t
+++ b/test/04-replication-large-atts.t
@@ -1,6 +1,6 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
-%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap
 
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/a92ef9ac/test/05-replication-many-leaves.t
----------------------------------------------------------------------
diff --git a/test/05-replication-many-leaves.t b/test/05-replication-many-leaves.t
index 5c2aa27..fbb9d95 100755
--- a/test/05-replication-many-leaves.t
+++ b/test/05-replication-many-leaves.t
@@ -1,6 +1,6 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
-%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap
 
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/a92ef9ac/test/06-doc-missing-stubs.t
----------------------------------------------------------------------
diff --git a/test/06-doc-missing-stubs.t b/test/06-doc-missing-stubs.t
index 2e37d59..5fbb7f3 100755
--- a/test/06-doc-missing-stubs.t
+++ b/test/06-doc-missing-stubs.t
@@ -1,6 +1,6 @@
 #!/usr/bin/env escript
 %% -*- erlang -*-
-%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap
 
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not
 % use this file except in compliance with the License. You may obtain a copy of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/a92ef9ac/test/07-use-checkpoints.t
----------------------------------------------------------------------
diff --git a/test/07-use-checkpoints.t b/test/07-use-checkpoints.t
index 1631328..193b17d 100755
--- a/test/07-use-checkpoints.t
+++ b/test/07-use-checkpoints.t
@@ -1,5 +1,5 @@
 #!/usr/bin/env escript
-%%! -pa ./src/deps/*/ebin -pa ./src/apps/*/ebin -pa ./src/test/etap
+%%! -pa ./deps/*/ebin -pa ./apps/*/ebin -pa ./test/etap
 
 %% -*- erlang -*-
 % Licensed under the Apache License, Version 2.0 (the "License"); you may not


[12/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
couch_replicator: add replication using changes in a view

Instead of a database, the replicator can now filter the documents using
a view index. All documents having a key emitted in the view can be
replicated.

View parameters can be used. Which means that you can replicate results
corresponding to a key in a view or a range.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/09d7a60c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/09d7a60c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/09d7a60c

Branch: refs/heads/1994-merge-rcouch
Commit: 09d7a60c29e4e800b6e80efd2337e9b744ae1229
Parents: 7999202
Author: benoitc <be...@apache.org>
Authored: Sun Feb 9 00:43:23 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 src/couch_replicator.erl          | 39 ++++++++++++++++++++++++++++++----
 src/couch_replicator.hrl          |  2 ++
 src/couch_replicator_api_wrap.erl | 25 +++++++++++++++++++++-
 src/couch_replicator_utils.erl    | 27 +++++++++++++++++++++--
 4 files changed, 86 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/09d7a60c/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index d470c8a..10aaf37 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -70,7 +70,9 @@
     target_monitor = nil,
     source_seq = nil,
     use_checkpoints = true,
-    checkpoint_interval = 5000
+    checkpoint_interval = 5000,
+    type = db,
+    view = nil
 }).
 
 
@@ -533,7 +535,8 @@ cancel_timer(#rep_state{timer = Timer} = State) ->
 init_state(Rep) ->
     #rep{
         source = Src, target = Tgt,
-        options = Options, user_ctx = UserCtx
+        options = Options, user_ctx = UserCtx,
+        type = Type, view = View
     } = Rep,
     {ok, Source} = couch_replicator_api_wrap:db_open(Src, [{user_ctx, UserCtx}]),
     {ok, Target} = couch_replicator_api_wrap:db_open(Tgt, [{user_ctx, UserCtx}],
@@ -547,6 +550,17 @@ init_state(Rep) ->
     {StartSeq0, History} = compare_replication_logs(SourceLog, TargetLog),
     StartSeq1 = get_value(since_seq, Options, StartSeq0),
     StartSeq = {0, StartSeq1},
+
+    SourceSeq = case Type of
+        db -> get_value(<<"update_seq">>, SourceInfo, ?LOWEST_SEQ);
+        view ->
+            {DDoc, VName} = View,
+            {ok, VInfo} = couch_replicator_api_wrap:get_view_info(Source, DDoc,
+                                                                  VName),
+            get_value(<<"update_seq">>, VInfo, ?LOWEST_SEQ)
+    end,
+
+
     #doc{body={CheckpointHistory}} = SourceLog,
     State = #rep_state{
         rep_details = Rep,
@@ -571,9 +585,12 @@ init_state(Rep) ->
             start_db_compaction_notifier(Target, self()),
         source_monitor = db_monitor(Source),
         target_monitor = db_monitor(Target),
-        source_seq = get_value(<<"update_seq">>, SourceInfo, ?LOWEST_SEQ),
+        source_seq = SourceSeq,
         use_checkpoints = get_value(use_checkpoints, Options, true),
-        checkpoint_interval = get_value(checkpoint_interval, Options, 5000)
+        checkpoint_interval = get_value(checkpoint_interval, Options,
+                                        5000),
+        type = Type,
+        view = View
     },
     State#rep_state{timer = start_timer(State)}.
 
@@ -914,6 +931,20 @@ db_monitor(#db{} = Db) ->
 db_monitor(_HttpDb) ->
     nil.
 
+source_cur_seq(#rep_state{source = #httpdb{} = Db, source_seq = Seq,
+                          type = view, view = {DDoc, VName}}) ->
+    case (catch couch_replicator_api_wrap:get_view_info(
+                Db#httpdb{retries = 3}, DDoc, VName)) of
+    {ok, Info} ->
+        get_value(<<"update_seq">>, Info, Seq);
+    _ ->
+        Seq
+    end;
+
+source_cur_seq(#rep_state{source = Db, source_seq = Seq,
+                          type = view, view = {DDoc, VName}}) ->
+    {ok, Info} = couch_replicator_api_wrap:get_view_info(Db, DDoc, VName),
+    get_value(<<"update_seq">>, Info, Seq);
 
 source_cur_seq(#rep_state{source = #httpdb{} = Db, source_seq = Seq}) ->
     case (catch couch_replicator_api_wrap:get_db_info(Db#httpdb{retries = 3})) of

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/09d7a60c/src/couch_replicator.hrl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.hrl b/src/couch_replicator.hrl
index 018aa4b..1eee88e 100644
--- a/src/couch_replicator.hrl
+++ b/src/couch_replicator.hrl
@@ -18,6 +18,8 @@
     target,
     options,
     user_ctx,
+    type = db,
+    view = nil,
     doc_id
 }).
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/09d7a60c/src/couch_replicator_api_wrap.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_api_wrap.erl b/src/couch_replicator_api_wrap.erl
index 311025b..1e0e660 100644
--- a/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator_api_wrap.erl
@@ -19,6 +19,7 @@
 % Many options and apis aren't yet supported here, they are added as needed.
 
 -include_lib("couch/include/couch_db.hrl").
+-include_lib("couch_mrview/include/couch_mrview.hrl").
 -include("couch_replicator_api_wrap.hrl").
 
 -export([
@@ -26,6 +27,7 @@
     db_open/3,
     db_close/1,
     get_db_info/1,
+    get_view_info/3,
     update_doc/3,
     update_doc/4,
     update_docs/3,
@@ -121,6 +123,16 @@ get_db_info(#db{name = DbName, user_ctx = UserCtx}) ->
     {ok, [{couch_util:to_binary(K), V} || {K, V} <- Info]}.
 
 
+get_view_info(#httpdb{} = Db, DDocId, ViewName) ->
+    Path = iolist_to_binary([DDocId, "/_view/", ViewName, "/_info"]),
+    send_req(Db, [{path, Path}],
+        fun(200, _, {Props}) ->
+            {ok, Props}
+        end);
+get_view_info(#db{name = DbName}, DDocId, ViewName) ->
+    couch_mrview:get_view_info(DbName, DDocId, ViewName).
+
+
 ensure_full_commit(#httpdb{} = Db) ->
     send_req(
         Db,
@@ -439,7 +451,8 @@ changes_since(Db, Style, StartSeq, UserFun, Options) ->
     },
     QueryParams = get_value(query_params, Options, {[]}),
     Req = changes_json_req(Db, Filter, QueryParams, Options),
-    ChangesFeedFun = couch_changes:handle_changes(Args, {json_req, Req}, Db),
+    ChangesFeedFun = couch_httpd_changes:handle_changes(Args, {json_req, Req},
+                                                        Db),
     ChangesFeedFun(fun({change, Change, _}, _) ->
             UserFun(json_to_doc_info(Change));
         (_, _) ->
@@ -454,6 +467,10 @@ maybe_add_changes_filter_q_args(BaseQS, Options) ->
     undefined ->
         BaseQS;
     FilterName ->
+        %% get list of view attributes
+        ViewFields0 = [atom_to_list(F) || F <- record_info(fields,  mrargs)],
+        ViewFields = ["key" | ViewFields0],
+
         {Params} = get_value(query_params, Options, {[]}),
         [{"filter", ?b2l(FilterName)} | lists:foldl(
             fun({K, V}, QSAcc) ->
@@ -461,6 +478,12 @@ maybe_add_changes_filter_q_args(BaseQS, Options) ->
                 case lists:keymember(Ks, 1, QSAcc) of
                 true ->
                     QSAcc;
+                false when FilterName =:= <<"_view">> ->
+                    V1 = case lists:member(Ks, ViewFields) of
+                        true -> ?JSON_ENCODE(V);
+                        false -> couch_util:to_list(V)
+                    end,
+                    [{Ks, V1} | QSAcc];
                 false ->
                     [{Ks, couch_util:to_list(V)} | QSAcc]
                 end

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/09d7a60c/src/couch_replicator_utils.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_utils.erl b/src/couch_replicator_utils.erl
index 0baddc2..085df43 100644
--- a/src/couch_replicator_utils.erl
+++ b/src/couch_replicator_utils.erl
@@ -37,13 +37,34 @@ parse_rep_doc({Props}, UserCtx) ->
     true ->
         {ok, #rep{options = Options, user_ctx = UserCtx}};
     false ->
-        Source = parse_rep_db(get_value(<<"source">>, Props), ProxyParams, Options),
-        Target = parse_rep_db(get_value(<<"target">>, Props), ProxyParams, Options),
+        Source = parse_rep_db(get_value(<<"source">>, Props),
+                              ProxyParams, Options),
+        Target = parse_rep_db(get_value(<<"target">>, Props),
+                              ProxyParams, Options),
+
+
+        {RepType, View} = case get_value(<<"filter">>, Props) of
+                <<"_view">> ->
+                    {QP}  = get_value(query_params, Options, {[]}),
+                    ViewParam = get_value(<<"view">>, QP),
+                    View1 = case re:split(ViewParam, <<"/">>) of
+                        [DName, ViewName] ->
+                            {<< "_design/", DName/binary >>, ViewName};
+                        _ ->
+                            throw({bad_request, "Invalid `view` parameter."})
+                    end,
+                    {view, View1};
+                _ ->
+                    {db, nil}
+            end,
+
         Rep = #rep{
             source = Source,
             target = Target,
             options = Options,
             user_ctx = UserCtx,
+            type = RepType,
+            view = View,
             doc_id = get_value(<<"_id">>, Props, null)
         },
         {ok, Rep#rep{id = replication_id(Rep)}}
@@ -100,6 +121,8 @@ maybe_append_filters(Base,
             DocIds ->
                 [DocIds]
             end;
+        <<"_", _/binary>> = Filter ->
+                [Filter, get_value(query_params, Options, {[]})];
         Filter ->
             [filter_code(Filter, Source, UserCtx),
                 get_value(query_params, Options, {[]})]


[05/12] couch-replicator commit: updated refs/heads/1994-merge-rcouch to c8f517d

Posted by da...@apache.org.
fix tests


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/600dc4af
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/600dc4af
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/600dc4af

Branch: refs/heads/1994-merge-rcouch
Commit: 600dc4af37c9d3b61fb12fb1f7482a98498531c0
Parents: 7da1d78
Author: benoitc <be...@apache.org>
Authored: Thu Jan 9 20:56:15 2014 +0100
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 12 18:16:58 2014 -0600

----------------------------------------------------------------------
 src/couch_replicator_sup.erl  | 6 +++++-
 test/03-replication-compact.t | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/600dc4af/src/couch_replicator_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_sup.erl b/src/couch_replicator_sup.erl
index 905e2cf..7ae5367 100644
--- a/src/couch_replicator_sup.erl
+++ b/src/couch_replicator_sup.erl
@@ -17,6 +17,7 @@
 
 %% API
 -export([start_link/0]).
+-export([stop/0]).
 
 %% Supervisor callbacks
 -export([init/1]).
@@ -31,6 +32,9 @@
 start_link() ->
     supervisor:start_link({local, ?MODULE}, ?MODULE, []).
 
+stop() ->
+    catch exit(whereis(couch_replicator_sup), normal).
+
 %% ===================================================================
 %% Supervisor callbacks
 %% ===================================================================
@@ -56,4 +60,4 @@ init([]) ->
             supervisor,
             [couch_replicator_manager_sup]}
     ],
-    {ok, { {one_for_one, 10, 3600}, Children} }.
+    {ok, { {one_for_one, 100, 3600}, Children} }.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/600dc4af/test/03-replication-compact.t
----------------------------------------------------------------------
diff --git a/test/03-replication-compact.t b/test/03-replication-compact.t
index 3e52b37..801b173 100755
--- a/test/03-replication-compact.t
+++ b/test/03-replication-compact.t
@@ -119,8 +119,11 @@ test() ->
             delete_db(SourceDb),
             delete_db(TargetDb),
             couch_server_sup:stop(),
+            couch_replicator_sup:stop(),
+
             ok = timer:sleep(1000),
-            couch_server_sup:start_link(test_util:config_files())
+            couch_server_sup:start_link(test_util:config_files()),
+            couch_replicator_sup:start_link()
         end,
         Pairs),