From 3ef3a7abece87ff8b2cc9957a1242e91141a6380 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Tue, 3 Mar 2015 15:37:42 +0000 Subject: Fix hg diffing - fetch more complete refs for tags (may download more history than required, but it works) - Fix comparison of tag distance by using lists everywhere --- src/rebar_hg_resource.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rebar_hg_resource.erl b/src/rebar_hg_resource.erl index 1bd992e..a67abb9 100644 --- a/src/rebar_hg_resource.erl +++ b/src/rebar_hg_resource.erl @@ -61,7 +61,7 @@ download(Dir, {hg, Url, {branch, Branch}}, _State) -> [{cd, filename:dirname(Dir)}]); download(Dir, {hg, Url, {tag, Tag}}, _State) -> ok = filelib:ensure_dir(Dir), - rebar_utils:sh(?FMT("hg clone -q -r ~s ~s ~s", + rebar_utils:sh(?FMT("hg clone -q -u ~s ~s ~s", [Tag, Url, filename:basename(Dir)]), [{cd, filename:dirname(Dir)}]); download(Dir, {hg, Url, {ref, Ref}}, _State) -> @@ -115,7 +115,7 @@ get_tag_distance(Dir, Ref) -> [{use_stdout, false}, {debug_abort_on_error, AbortMsg}]), Log = string:strip(LogString, both, $\n), - [Tag, Distance] = re:split(Log, "-([0-9]+)$", [{parts,0}]), + [Tag, Distance] = re:split(Log, "-([0-9]+)$", [{parts,0}, {return, list}]), {Tag, Distance}. get_branch_ref(Dir, Branch) -> -- cgit v1.1