diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-05-03 16:06:26 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-05-03 16:06:26 -0400 |
commit | 9b770b896718aee800e43ac045582cd8abb266da (patch) | |
tree | 38b2ebf4f65f44274628a6bc4c10ef43d0bc5976 | |
parent | b4b6638ba9f7fb41f776c18eb08d31c3f804f00a (diff) | |
parent | d4c7dea7351435eaafe56a23845d8772e4bac0ac (diff) |
Merge pull request #381 from tsloughter/upgrade_branch
on upgrade of git branch check against remote
-rw-r--r-- | rebar.config | 2 | ||||
-rw-r--r-- | rebar.lock | 6 | ||||
-rw-r--r-- | src/rebar_git_resource.erl | 11 | ||||
-rw-r--r-- | src/rebar_prv_upgrade.erl | 1 |
4 files changed, 9 insertions, 11 deletions
diff --git a/rebar.config b/rebar.config index 89acac7..abd34c5 100644 --- a/rebar.config +++ b/rebar.config @@ -46,4 +46,4 @@ ]}. %% Overrides -{overrides, [{override, erlware_commons, [{plugins, []}]}]}. +{overrides, [{override, erlware_commons, [{deps, []}, {plugins, []}]}]}. @@ -1,8 +1,4 @@ -[{<<"rebar_vsn_plugin">>, - {git,"https://github.com/erlware/rebar_vsn_plugin.git", - {ref,"fd40c960c7912193631d948fe962e1162a8d1334"}}, - 2}, - {<<"relx">>, +[{<<"relx">>, {git,"https://github.com/tsloughter/relx.git", {ref,"6e0d048d3840464539deddd9d5b53e9f421edee4"}}, 0}, diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl index 3b77da2..07c9b4d 100644 --- a/src/rebar_git_resource.erl +++ b/src/rebar_git_resource.erl @@ -31,11 +31,14 @@ needs_update(Dir, {git, Url, {tag, Tag}}) -> ?DEBUG("Comparing git tag ~s with ~s", [Tag, Current1]), not ((Current1 =:= Tag) andalso compare_url(Dir, Url)); needs_update(Dir, {git, Url, {branch, Branch}}) -> - {ok, Current} = rebar_utils:sh(?FMT("git symbolic-ref -q --short HEAD", []), + %% Fetch remote so we can check if the branch has changed + {ok, _} = rebar_utils:sh(?FMT("git fetch origin ~s", [Branch]), + [{cd, Dir}]), + %% Check for new commits to origin/Branch + {ok, Current} = rebar_utils:sh(?FMT("git log HEAD..origin/~s --oneline", [Branch]), [{cd, Dir}]), - Current1 = string:strip(string:strip(Current, both, $\n), both, $\r), - ?DEBUG("Comparing git branch ~s with ~s", [Branch, Current1]), - not ((Current1 =:= Branch) andalso compare_url(Dir, Url)); + ?DEBUG("Checking git branch ~s for updates", [Branch]), + not ((Current =:= []) andalso compare_url(Dir, Url)); needs_update(Dir, {git, Url, "master"}) -> needs_update(Dir, {git, Url, {branch, "master"}}); needs_update(Dir, {git, Url, Ref}) -> diff --git a/src/rebar_prv_upgrade.erl b/src/rebar_prv_upgrade.erl index d7d2921..05845e4 100644 --- a/src/rebar_prv_upgrade.erl +++ b/src/rebar_prv_upgrade.erl @@ -140,4 +140,3 @@ info_useless(Old, New) -> || Name <- Old, not lists:member(Name, New)], ok. - |