From d8e50e8c2d3af9234d27e8e5a652c5575d1493ad Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 9 Dec 2010 19:45:58 +0100 Subject: Implement update-deps and disable auto update --- src/rebar_deps.erl | 65 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 23 deletions(-) (limited to 'src/rebar_deps.erl') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 0852b01..a86b83c 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -33,6 +33,7 @@ compile/2, 'check-deps'/2, 'get-deps'/2, + 'update-deps'/2, 'delete-deps'/2]). @@ -54,7 +55,7 @@ preprocess(Config, _) -> %% Get the list of deps for the current working directory and identify those %% deps that are available/present. Deps = rebar_config:get_local(Config, deps, []), - {AvailableDeps, MissingDeps} = find_deps(Deps), + {AvailableDeps, MissingDeps} = find_deps(find, Deps), ?DEBUG("Available deps: ~p\n", [AvailableDeps]), ?DEBUG("Missing deps : ~p\n", [MissingDeps]), @@ -93,7 +94,7 @@ compile(Config, AppFile) -> 'check-deps'(Config, _) -> %% Get the list of immediate (i.e. non-transitive) deps that are missing Deps = rebar_config:get_local(Config, deps, []), - case find_deps(Deps) of + case find_deps(find, Deps) of {_, []} -> %% No missing deps ok; @@ -108,26 +109,31 @@ compile(Config, AppFile) -> 'get-deps'(Config, _) -> %% Determine what deps are available and missing Deps = rebar_config:get_local(Config, deps, []), - {AvailableDeps, MissingDeps} = find_deps(Deps), + {_AvailableDeps, MissingDeps} = find_deps(find, Deps), %% For each missing dep with a specified source, try to pull it. - PulledDeps0 = [use_source(D) || D <- MissingDeps, D#dep.source /= undefined], - - %% For each available dep try to update the source to the specified - %% version. - PulledDeps1 = [update_source(D) || D <- AvailableDeps, - D#dep.source /= undefined], + PulledDeps = [use_source(D) || D <- MissingDeps, D#dep.source /= undefined], %% Add each pulled dep to our list of dirs for post-processing. This yields %% the necessary transitivity of the deps - erlang:put(?MODULE, [D#dep.dir || D <- PulledDeps0 ++ PulledDeps1]), + erlang:put(?MODULE, [D#dep.dir || D <- PulledDeps]), + ok. + +'update-deps'(Config, _) -> + %% Determine what deps are available and missing + Deps = rebar_config:get_local(Config, deps, []), + UpdatedDeps = [update_source(D) || D <- find_deps(read, Deps), + D#dep.source /= undefined], + %% Add each updated dep to our list of dirs for post-processing. This yields + %% the necessary transitivity of the deps + erlang:put(?MODULE, [D#dep.dir || D <- UpdatedDeps]), ok. 'delete-deps'(Config, _) -> %% Delete all the available deps in our deps/ directory, if any DepsDir = get_deps_dir(), Deps = rebar_config:get_local(Config, deps, []), - {AvailableDeps, _} = find_deps(Deps), + {AvailableDeps, _} = find_deps(find, Deps), _ = [delete_dep(D) || D <- AvailableDeps, lists:prefix(DepsDir, D#dep.dir) == true], ok. @@ -163,35 +169,48 @@ update_deps_code_path([Dep | Rest]) -> end, update_deps_code_path(Rest). -find_deps(Deps) -> - find_deps(Deps, {[], []}). -find_deps([], {Avail, Missing}) -> +find_deps(find=Mode, Deps) -> + find_deps(Mode, Deps, {[], []}); +find_deps(read=Mode, Deps) -> + find_deps(Mode, Deps, []). + +find_deps(find, [], {Avail, Missing}) -> {lists:reverse(Avail), lists:reverse(Missing)}; -find_deps([App | Rest], Acc) when is_atom(App) -> - find_deps([{App, ".*", undefined} | Rest], Acc); -find_deps([{App, VsnRegex} | Rest], Acc) when is_atom(App) -> - find_deps([{App, VsnRegex, undefined} | Rest], Acc); -find_deps([{App, VsnRegex, Source} | Rest], {Avail, Missing}) -> +find_deps(read, [], Deps) -> + lists:reverse(Deps); +find_deps(Mode, [App | Rest], Acc) when is_atom(App) -> + find_deps(Mode, [{App, ".*", undefined} | Rest], Acc); +find_deps(Mode, [{App, VsnRegex} | Rest], Acc) when is_atom(App) -> + find_deps(Mode, [{App, VsnRegex, undefined} | Rest], Acc); +find_deps(Mode, [{App, VsnRegex, Source} | Rest], Acc) -> Dep = #dep { app = App, vsn_regex = VsnRegex, source = Source }, case is_app_available(App, VsnRegex) of {true, AppDir} -> - find_deps(Rest, {[Dep#dep { dir = AppDir } | Avail], Missing}); + find_deps(Mode, Rest, acc_deps(Mode, avail, Dep, AppDir, Acc)); {false, _} -> AppDir = filename:join(get_deps_dir(), Dep#dep.app), case is_app_available(App, VsnRegex, AppDir) of {true, AppDir} -> - find_deps(Rest, {[Dep#dep { dir = AppDir } | Avail], Missing}); + find_deps(Mode, Rest, + acc_deps(Mode, avail, Dep, AppDir, Acc)); {false, _} -> - find_deps(Rest, {Avail, [Dep#dep { dir = AppDir } | Missing]}) + find_deps(Mode, Rest, + acc_deps(Mode, missing, Dep, AppDir, Acc)) end end; -find_deps([Other | _Rest], _Acc) -> +find_deps(_Mode, [Other | _Rest], _Acc) -> ?ABORT("Invalid dependency specification ~p in ~s\n", [Other, rebar_utils:get_cwd()]). +acc_deps(find, avail, Dep, AppDir, {Avail, Missing}) -> + {[Dep#dep { dir = AppDir } | Avail], Missing}; +acc_deps(find, missing, Dep, AppDir, {Avail, Missing}) -> + {Avail, [Dep#dep { dir = AppDir } | Missing]}; +acc_deps(read, _, Dep, AppDir, Acc) -> + [Dep#dep { dir = AppDir } | Acc]. delete_dep(D) -> case filelib:is_dir(D#dep.dir) of -- cgit v1.1 From 52ca7795feb001f0624ec87e717e3019f8a810bd Mon Sep 17 00:00:00 2001 From: Juhani Rankimies Date: Sun, 5 Dec 2010 02:07:12 +0200 Subject: Unify executable invocation Add flags to rebar_utils:sh to control output and error handling. Replace calls to os:cmd with calls to rebar_utils:sh. --- src/rebar_deps.erl | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'src/rebar_deps.erl') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index a86b83c..ded75db 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -292,28 +292,31 @@ use_source(Dep, Count) -> download_source(AppDir, {hg, Url, Rev}) -> ok = filelib:ensure_dir(AppDir), - rebar_utils:sh(?FMT("hg clone -U ~s ~s", [Url, filename:basename(AppDir)]), [], filename:dirname(AppDir)), - rebar_utils:sh(?FMT("hg update ~s", [Rev]), [], AppDir); + rebar_utils:sh(?FMT("hg clone -U ~s ~s", [Url, filename:basename(AppDir)]), + [{cd, filename:dirname(AppDir)}]), + rebar_utils:sh(?FMT("hg update ~s", [Rev]), [{cd, AppDir}]); download_source(AppDir, {git, Url, {branch, Branch}}) -> ok = filelib:ensure_dir(AppDir), - rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]), [], filename:dirname(AppDir)), - rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), [], AppDir); + rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]), + [{cd, filename:dirname(AppDir)}]), + rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), [{cd, AppDir}]); download_source(AppDir, {git, Url, {tag, Tag}}) -> ok = filelib:ensure_dir(AppDir), - rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]), [], filename:dirname(AppDir)), - rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [], AppDir); + rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]), + [{cd, filename:dirname(AppDir)}]), + rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [{cd, AppDir}]); download_source(AppDir, {git, Url, Rev}) -> download_source(AppDir, {git, Url, {branch, Rev}}); download_source(AppDir, {bzr, Url, Rev}) -> ok = filelib:ensure_dir(AppDir), rebar_utils:sh(?FMT("bzr branch -r ~s ~s ~s", - [Rev, Url, filename:basename(AppDir)]), [], - filename:dirname(AppDir)); + [Rev, Url, filename:basename(AppDir)]), + [{cd, filename:dirname(AppDir)}]); download_source(AppDir, {svn, Url, Rev}) -> ok = filelib:ensure_dir(AppDir), rebar_utils:sh(?FMT("svn checkout -r ~s ~s ~s", - [Rev, Url, filename:basename(AppDir)]), [], - filename:dirname(AppDir)). + [Rev, Url, filename:basename(AppDir)]), + [{cd, filename:dirname(AppDir)}]). update_source(Dep) -> %% It's possible when updating a source, that a given dep does not have a @@ -333,19 +336,19 @@ update_source(Dep) -> end. update_source(AppDir, {git, _Url, {branch, Branch}}) -> - rebar_utils:sh(?FMT("git fetch origin", []), [], AppDir), - rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), [], AppDir); + rebar_utils:sh("git fetch origin", [{cd, AppDir}]), + rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), [{cd, AppDir}]); update_source(AppDir, {git, _Url, {tag, Tag}}) -> - rebar_utils:sh(?FMT("git fetch --tags origin", []), [], AppDir), - rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [], AppDir); + rebar_utils:sh("git fetch --tags origin", [{cd, AppDir}]), + rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [{cd, AppDir}]); update_source(AppDir, {git, Url, Refspec}) -> update_source(AppDir, {git, Url, {branch, Refspec}}); update_source(AppDir, {svn, _Url, Rev}) -> - rebar_utils:sh(?FMT("svn up -r ~s", [Rev]), [], AppDir); + rebar_utils:sh(?FMT("svn up -r ~s", [Rev]), [{cd, AppDir}]); update_source(AppDir, {hg, _Url, Rev}) -> - rebar_utils:sh(?FMT("hg pull -u -r ~s", [Rev]), [], AppDir); + rebar_utils:sh(?FMT("hg pull -u -r ~s", [Rev]), [{cd, AppDir}]); update_source(AppDir, {bzr, _Url, Rev}) -> - rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [], AppDir). + rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [{cd, AppDir}]). @@ -366,7 +369,8 @@ source_engine_avail({Name, _, _}=Source) scm_client_vsn(false, _VsnArg, _VsnRegex) -> false; scm_client_vsn(Path, VsnArg, VsnRegex) -> - Info = os:cmd("LANG=C " ++ Path ++ VsnArg), + {ok, Info} = rebar_utils:sh(Path ++ VsnArg, [{env, [{"LANG", "C"}]}, + {use_stdout, false}]), case re:run(Info, VsnRegex, [{capture, all_but_first, list}]) of {match, Match} -> list_to_tuple([list_to_integer(S) || S <- Match]); -- cgit v1.1 From 422beee324e24d5db404b9f61d26cceb73a9fcce Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 6 Jan 2011 14:51:35 +0100 Subject: Return more descriptive dependency errors --- src/rebar_deps.erl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/rebar_deps.erl') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index ded75db..72d982a 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -247,16 +247,19 @@ is_app_available(App, VsnRegex, Path) -> nomatch -> ?WARN("~s has version ~p; requested regex was ~s\n", [AppFile, Vsn, VsnRegex]), - {false, version_mismatch} + {false, {version_mismatch, + {AppFile, + {expected, VsnRegex}, {has, Vsn}}}} end; OtherApp -> ?WARN("~s has application id ~p; expected ~p\n", [AppFile, OtherApp, App]), - {false, name_mismatch} + {false, {name_mismatch, + {AppFile, {expected, App}, {has, OtherApp}}}} end; false -> ?WARN("Expected ~s to be an app dir (containing ebin/*.app), but no .app found.\n", [Path]), - {false, missing_app_file} + {false, {missing_app_file, Path}} end. use_source(Dep) -> @@ -280,7 +283,7 @@ use_source(Dep, Count) -> %% The app that was downloaded doesn't match up (or had %% errors or something). For the time being, abort. ?ABORT("Dependency dir ~s failed application validation " - "with reason ~p.\n", [Dep#dep.dir, Reason]) + "with reason:~n~p.\n", [Dep#dep.dir, Reason]) end; false -> ?CONSOLE("Pulling ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), -- cgit v1.1 From e4036cbe56de29be1a4773d459c87700884f17d0 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sat, 8 Jan 2011 19:09:24 +0100 Subject: Apply Tidier suggestions --- src/rebar_deps.erl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/rebar_deps.erl') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 72d982a..d93b158 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -134,8 +134,9 @@ compile(Config, AppFile) -> DepsDir = get_deps_dir(), Deps = rebar_config:get_local(Config, deps, []), {AvailableDeps, _} = find_deps(find, Deps), - _ = [delete_dep(D) || D <- AvailableDeps, - lists:prefix(DepsDir, D#dep.dir) == true], + _ = [delete_dep(D) + || D <- AvailableDeps, + lists:prefix(DepsDir, D#dep.dir)], ok. @@ -339,11 +340,13 @@ update_source(Dep) -> end. update_source(AppDir, {git, _Url, {branch, Branch}}) -> - rebar_utils:sh("git fetch origin", [{cd, AppDir}]), - rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), [{cd, AppDir}]); + ShOpts = [{cd, AppDir}], + rebar_utils:sh("git fetch origin", ShOpts), + rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), ShOpts); update_source(AppDir, {git, _Url, {tag, Tag}}) -> - rebar_utils:sh("git fetch --tags origin", [{cd, AppDir}]), - rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [{cd, AppDir}]); + ShOpts = [{cd, AppDir}], + rebar_utils:sh("git fetch --tags origin", ShOpts), + rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), ShOpts); update_source(AppDir, {git, Url, Refspec}) -> update_source(AppDir, {git, Url, {branch, Refspec}}); update_source(AppDir, {svn, _Url, Rev}) -> -- cgit v1.1 From c466076ffb5a1ea4c00d49fefff0dcfbceb58236 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Mon, 31 Jan 2011 17:43:31 +0100 Subject: Clean up emacs file local variables --- src/rebar_deps.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rebar_deps.erl') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index d93b158..8f31d0f 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -1,4 +1,4 @@ -%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- %% ex: ts=4 sw=4 et %% ------------------------------------------------------------------- %% -- cgit v1.1 From 63de05d914f3c2bef6dcfc6cf966400d93c9c80d Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Fri, 28 Jan 2011 16:08:27 +0100 Subject: Clean up code --- src/rebar_deps.erl | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'src/rebar_deps.erl') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 8f31d0f..99ede3d 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -47,9 +47,9 @@ %% =================================================================== preprocess(Config, _) -> - %% Side effect to set deps_dir globally for all dependencies from top level down. - %% Means the root deps_dir is honoured or the default used globally - %% since it will be set on the first time through here + %% Side effect to set deps_dir globally for all dependencies from + %% top level down. Means the root deps_dir is honoured or the default + %% used globally since it will be set on the first time through here set_global_deps_dir(Config, rebar_config:get_global(deps_dir, [])), %% Get the list of deps for the current working directory and identify those @@ -69,8 +69,8 @@ preprocess(Config, _) -> case rebar_config:get_global(skip_deps, false) of "true" -> lists:foreach(fun (#dep{dir = Dir}) -> - rebar_core:skip_dir(Dir) - end, AvailableDeps); + rebar_core:skip_dir(Dir) + end, AvailableDeps); _ -> ok end, @@ -100,9 +100,9 @@ compile(Config, AppFile) -> ok; {_, MissingDeps} -> lists:foreach(fun (#dep{app=App, vsn_regex=Vsn, source=Src}) -> - ?CONSOLE("Dependency not available: ~p-~s (~p)\n", - [App, Vsn, Src]) - end, MissingDeps), + ?CONSOLE("Dependency not available: " + "~p-~s (~p)\n", [App, Vsn, Src]) + end, MissingDeps), ?FAIL end. @@ -148,7 +148,8 @@ compile(Config, AppFile) -> %% need all deps in same dir and should be the one set by the root rebar.config %% Sets a default if root config has no deps_dir set set_global_deps_dir(Config, []) -> - rebar_config:set_global(deps_dir, rebar_config:get_local(Config, deps_dir, "deps")); + rebar_config:set_global(deps_dir, + rebar_config:get_local(Config, deps_dir, "deps")); set_global_deps_dir(_Config, _DepsDir) -> ok. @@ -253,13 +254,14 @@ is_app_available(App, VsnRegex, Path) -> {expected, VsnRegex}, {has, Vsn}}}} end; OtherApp -> - ?WARN("~s has application id ~p; expected ~p\n", [AppFile, OtherApp, App]), + ?WARN("~s has application id ~p; expected ~p\n", + [AppFile, OtherApp, App]), {false, {name_mismatch, {AppFile, {expected, App}, {has, OtherApp}}}} end; false -> - ?WARN("Expected ~s to be an app dir (containing ebin/*.app), but no .app found.\n", - [Path]), + ?WARN("Expected ~s to be an app dir (containing ebin/*.app), " + "but no .app found.\n", [Path]), {false, {missing_app_file, Path}} end. @@ -267,12 +269,14 @@ use_source(Dep) -> use_source(Dep, 3). use_source(Dep, 0) -> - ?ABORT("Failed to acquire source from ~p after 3 tries.\n", [Dep#dep.source]); + ?ABORT("Failed to acquire source from ~p after 3 tries.\n", + [Dep#dep.source]); use_source(Dep, Count) -> case filelib:is_dir(Dep#dep.dir) of true -> - %% Already downloaded -- verify the versioning matches up with our regex - case is_app_available(Dep#dep.app, Dep#dep.vsn_regex, Dep#dep.dir) of + %% Already downloaded -- verify the versioning matches the regex + case is_app_available(Dep#dep.app, + Dep#dep.vsn_regex, Dep#dep.dir) of {true, _} -> Dir = filename:join(Dep#dep.dir, "ebin"), ok = filelib:ensure_dir(filename:join(Dir, "dummy")), @@ -284,7 +288,7 @@ use_source(Dep, Count) -> %% The app that was downloaded doesn't match up (or had %% errors or something). For the time being, abort. ?ABORT("Dependency dir ~s failed application validation " - "with reason:~n~p.\n", [Dep#dep.dir, Reason]) + "with reason:~n~p.\n", [Dep#dep.dir, Reason]) end; false -> ?CONSOLE("Pulling ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), @@ -335,7 +339,8 @@ update_source(Dep) -> update_source(AppDir, Dep#dep.source), Dep; false -> - ?WARN("Skipping update for ~p: no VCS directory available!\n", [Dep]), + ?WARN("Skipping update for ~p: " + "no VCS directory available!\n", [Dep]), Dep end. @@ -390,13 +395,17 @@ required_scm_client_vsn(bzr) -> {2, 0}; required_scm_client_vsn(svn) -> {1, 6}. scm_client_vsn(hg) -> - scm_client_vsn(rebar_utils:find_executable("hg"), " --version", "version (\\d+).(\\d+)"); + scm_client_vsn(rebar_utils:find_executable("hg"), " --version", + "version (\\d+).(\\d+)"); scm_client_vsn(git) -> - scm_client_vsn(rebar_utils:find_executable("git"), " --version", "git version (\\d+).(\\d+)"); + scm_client_vsn(rebar_utils:find_executable("git"), " --version", + "git version (\\d+).(\\d+)"); scm_client_vsn(bzr) -> - scm_client_vsn(rebar_utils:find_executable("bzr"), " --version", "Bazaar \\(bzr\\) (\\d+).(\\d+)"); + scm_client_vsn(rebar_utils:find_executable("bzr"), " --version", + "Bazaar \\(bzr\\) (\\d+).(\\d+)"); scm_client_vsn(svn) -> - scm_client_vsn(rebar_utils:find_executable("svn"), " --version", "svn, version (\\d+).(\\d+)"). + scm_client_vsn(rebar_utils:find_executable("svn"), " --version", + "svn, version (\\d+).(\\d+)"). has_vcs_dir(git, Dir) -> filelib:is_dir(filename:join(Dir, ".git")); -- cgit v1.1 From 3241165ced709246935701f0b638d759e54316a2 Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 7 Feb 2011 15:32:12 -0800 Subject: Support 2 forms of implicit HEAD for git In git origin/HEAD is a pointer to the default branch. This patch allows two alternatives to explicitly specifying "HEAD" in git VC specs. The first is a 2 arity form {git, Url} and the second is {git, Url, ""} which worked in pre-update-deps rebars. --- src/rebar_deps.erl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/rebar_deps.erl') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 99ede3d..69f5fc1 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -303,6 +303,10 @@ download_source(AppDir, {hg, Url, Rev}) -> rebar_utils:sh(?FMT("hg clone -U ~s ~s", [Url, filename:basename(AppDir)]), [{cd, filename:dirname(AppDir)}]), rebar_utils:sh(?FMT("hg update ~s", [Rev]), [{cd, AppDir}]); +download_source(AppDir, {git, Url}) -> + download_source(AppDir, {git, Url, "HEAD"}); +download_source(AppDir, {git, Url, ""}) -> + download_source(AppDir, {git, Url, "HEAD"}); download_source(AppDir, {git, Url, {branch, Branch}}) -> ok = filelib:ensure_dir(AppDir), rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]), @@ -344,6 +348,10 @@ update_source(Dep) -> Dep end. +update_source(AppDir, {git, Url}) -> + update_source(AppDir, {git, Url, "HEAD"}); +update_source(AppDir, {git, Url, ""}) -> + update_source(AppDir, {git, Url, "HEAD"}); update_source(AppDir, {git, _Url, {branch, Branch}}) -> ShOpts = [{cd, AppDir}], rebar_utils:sh("git fetch origin", ShOpts), -- cgit v1.1