Document git vsn cmd and fix formatting

This commit is contained in:
Tuncer Ayaz 2011-08-27 15:45:50 +02:00
parent 15b7798e46
commit a53fc2d8f5

View file

@ -152,9 +152,11 @@ vcs_vsn(Vcs, Dir) ->
%% tree structure, there may be one higher up, but that can %% tree structure, there may be one higher up, but that can
%% yield unexpected results when used with deps. So, we %% yield unexpected results when used with deps. So, we
%% fallback to searching for a priv/vsn.Vcs file. %% fallback to searching for a priv/vsn.Vcs file.
case file:read_file(filename:join([Dir, "priv", "vsn" ++ Extension])) of VsnFile = filename:join([Dir, "priv", "vsn" ++ Extension]),
case file:read_file(VsnFile) of
{ok, VsnBin} -> {ok, VsnBin} ->
?DEBUG("vcs_vsn: Read ~s from priv/vsn.~p\n", [VsnBin, Vcs]), ?DEBUG("vcs_vsn: Read ~s from priv/vsn.~p\n",
[VsnBin, Vcs]),
string:strip(binary_to_list(VsnBin), right, $\n); string:strip(binary_to_list(VsnBin), right, $\n);
{error, enoent} -> {error, enoent} ->
?DEBUG("vcs_vsn: Fallback to vcs for ~s\n", [Dir]), ?DEBUG("vcs_vsn: Fallback to vcs for ~s\n", [Dir]),
@ -163,7 +165,9 @@ vcs_vsn(Vcs, Dir) ->
end end
end. end.
vcs_vsn_cmd(git) -> "git describe --always --tags `git log -n 1 --pretty=format:%h .`"; vcs_vsn_cmd(git) ->
%% git describe a committish to accomodate for subtrees or deps/apps
"git describe --always --tags `git log -n 1 --pretty=format:%h .`";
vcs_vsn_cmd(hg) -> "hg identify -i"; vcs_vsn_cmd(hg) -> "hg identify -i";
vcs_vsn_cmd(bzr) -> "bzr revno"; vcs_vsn_cmd(bzr) -> "bzr revno";
vcs_vsn_cmd(svn) -> "svnversion"; vcs_vsn_cmd(svn) -> "svnversion";