diff --git a/dockerfiles/alpine/Dockerfile b/dockerfiles/alpine/Dockerfile index ab67201..b074e10 100644 --- a/dockerfiles/alpine/Dockerfile +++ b/dockerfiles/alpine/Dockerfile @@ -17,7 +17,14 @@ RUN apk add --update \ jq \ openssh \ tar \ - mercurial + python2 \ + python2-dev \ + py2-pip \ + build-base + +RUN pip2 install mercurial +RUN pip2 install hg-evolve + COPY --from=builder /assets /opt/resource ADD assets/askpass.sh /opt/resource RUN chmod +x /opt/resource/* diff --git a/dockerfiles/ubuntu/Dockerfile b/dockerfiles/ubuntu/Dockerfile index 588e943..ce061b4 100644 --- a/dockerfiles/ubuntu/Dockerfile +++ b/dockerfiles/ubuntu/Dockerfile @@ -15,8 +15,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gnupg \ jq \ openssh-client \ - mercurial \ - && rm -rf /var/lib/apt/lists/* + python \ + python-pip \ + build-essential \ + python-all-dev \ + python-setuptools \ + python-wheel \ + && rm -rf /var/lib/apt/lists/* \ + && pip2 install mercurial \ + && pip2 install hg-evolve + COPY --from=builder /assets /opt/resource ADD assets/askpass.sh /opt/resource RUN chmod +x /opt/resource/* diff --git a/hgrc b/hgrc index d2d45ca..0d3599f 100644 --- a/hgrc +++ b/hgrc @@ -3,3 +3,6 @@ username = User Name [phases] publish = false + +[extensions] +evolve = \ No newline at end of file diff --git a/test/test_in.sh b/test/test_in.sh index 8503a1a..fd27269 100755 --- a/test/test_in.sh +++ b/test/test_in.sh @@ -162,6 +162,35 @@ test_it_can_get_with_ssl_cert_checks_disabled() { sleep 0.1 } +test_it_ignores_obsolete() { + local repo=$(init_repo) + local ref1=$(make_commit $repo) + local ref2=$(make_commit $repo) + + local dest=$TMPDIR/destination + + local expected1=$(echo "{\"ref\": $(echo $ref2 | jq -R .)}" | jq ".") + assertEquals "$expected1" "$(get_uri $repo $dest | jq '.version')" + + if [ ! -e "$dest/some-file" ]; then + fail "expected some-file to exist in the working directory" + fi + assertEquals "$ref2" "$(get_working_dir_ref $dest)" + + rm -rf $dest + + # prune $ref2 and verify that concourse sees $ref1 as the tip + hg prune --cwd $repo $ref2 + + local expected2=$(echo "{\"ref\": $(echo $ref1 | jq -R .)}" | jq ".") + assertEquals "$expected2" "$(get_uri $repo $dest | jq '.version')" + + if [ ! -e "$dest/some-file" ]; then + fail "expected some-file to exist in the working directory" + fi + assertEquals "$ref1" "$(get_working_dir_ref $dest)" +} + test_path_changed() { local repo1=$(init_repo) local repo1_ref=$(make_commit $repo1)