summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav Kovalev <kovyl2404@gmail.com>2015-04-22 14:41:39 +0300
committerViacheslav Kovalev <kovyl2404@gmail.com>2015-04-22 14:41:39 +0300
commit82b0d4b7b29fe5d33148022be28eab55320f47a9 (patch)
treea8de73ae7fccc5e6d1eddb93a39b88812cd92c97 /src
parent83d738a829fae4547776c87c3c4689cf17e69541 (diff)
Implement opts umerge deduplication
Diffstat (limited to 'src')
-rw-r--r--src/rebar_state.erl1
-rw-r--r--src/rebar_utils.erl15
2 files changed, 14 insertions, 2 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index 22e5497..f73370b 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -231,7 +231,6 @@ do_deduplicate([Head | Rest], Acc) ->
merge_opts(Profile, NewOpts, OldOpts) ->
Opts = merge_opts(NewOpts, OldOpts),
-
case dict:find(deps, NewOpts) of
{ok, Value} ->
dict:store({deps, Profile}, Value, Opts);
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index bc2e4ac..76be9a8 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -257,7 +257,20 @@ tup_sort(List) ->
tup_umerge([], Olds) ->
Olds;
tup_umerge([New|News], Olds) ->
- lists:reverse(umerge(News, Olds, [], New)).
+ reverse_deduplicate( umerge(News, Olds, [], New) ).
+
+reverse_deduplicate(List) ->
+ lists:reverse( do_deduplicate(lists:reverse(List), []) ).
+
+do_deduplicate([], Acc) ->
+ Acc;
+do_deduplicate([Value | Rest], Acc) ->
+ case lists:member(Value, Acc) of
+ true ->
+ do_deduplicate(Rest, Acc);
+ false ->
+ do_deduplicate(Rest, [Value | Acc])
+ end.
%% This is equivalent to umerge2_2 in the stdlib, except we use the expanded
%% value/key only to compare