mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Add {vsn,Vcs} support for bzr, hg and svn
This commit is contained in:
parent
b0860da124
commit
01a7473dac
1 changed files with 15 additions and 6 deletions
|
@ -90,12 +90,11 @@ app_vsn(AppFile) ->
|
||||||
case load_app_file(AppFile) of
|
case load_app_file(AppFile) of
|
||||||
{ok, _, AppInfo} ->
|
{ok, _, AppInfo} ->
|
||||||
case get_value(vsn, AppInfo, AppFile) of
|
case get_value(vsn, AppInfo, AppFile) of
|
||||||
git ->
|
git -> vcs_vsn(git);
|
||||||
Cmd = "git describe --tags --always",
|
hg -> vcs_vsn(hg);
|
||||||
{ok, VsnString} = rebar_utils:sh(Cmd, []),
|
bzr -> vcs_vsn(bzr);
|
||||||
string:strip(VsnString, right, $\n);
|
svn -> vcs_vsn(svn);
|
||||||
Version ->
|
Version -> Version
|
||||||
Version
|
|
||||||
end;
|
end;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?ABORT("Failed to extract vsn from ~s: ~p\n",
|
?ABORT("Failed to extract vsn from ~s: ~p\n",
|
||||||
|
@ -131,3 +130,13 @@ get_value(Key, AppInfo, AppFile) ->
|
||||||
Value ->
|
Value ->
|
||||||
Value
|
Value
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
vcs_vsn(Vcs) ->
|
||||||
|
Cmd = vcs_vsn_cmd(Vcs),
|
||||||
|
{ok, VsnString} = rebar_utils:sh(Cmd, [{use_stdout, false}]),
|
||||||
|
string:strip(VsnString, right, $\n).
|
||||||
|
|
||||||
|
vcs_vsn_cmd(git) -> "git describe --always --tags";
|
||||||
|
vcs_vsn_cmd(hg) -> "hg identify -i";
|
||||||
|
vcs_vsn_cmd(bzr) -> "bzr revno";
|
||||||
|
vcs_vsn_cmd(svn) -> "svnversion".
|
||||||
|
|
Loading…
Reference in a new issue