diff options
author | Viacheslav V. Kovalev <kovyl2404@gmail.com> | 2015-04-22 14:44:45 +0300 |
---|---|---|
committer | Viacheslav V. Kovalev <kovyl2404@gmail.com> | 2015-04-22 14:44:45 +0300 |
commit | 0b682e364da25287aa45784150702013f4c4aee0 (patch) | |
tree | a8de73ae7fccc5e6d1eddb93a39b88812cd92c97 /src | |
parent | b725711d638bef39aa6a2685c3dabd57c80a8024 (diff) | |
parent | 82b0d4b7b29fe5d33148022be28eab55320f47a9 (diff) |
Merge branch 'app-discover-profile-duplication' of https://github.com/kovyl2404/rebar3 into app-discover-profile-duplication
Conflicts:
test/rebar_profiles_SUITE.erl
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_state.erl | 1 | ||||
-rw-r--r-- | src/rebar_utils.erl | 15 |
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 |