mercurial.eclass: leave unchanged working dir
authorChristoph Junghans <ottxor@gentoo.org>
Sun, 20 Dec 2015 20:45:53 +0000 (13:45 -0700)
committerChristoph Junghans <ottxor@gentoo.org>
Sun, 20 Dec 2015 20:48:20 +0000 (13:48 -0700)
Gentoo-bug: 568892

eclass/mercurial.eclass

index f58335a4ce75a963446a905acea3d51cdb5cc753..bf85aaab639576cf8fa353e5786ce47be3545bf8 100644 (file)
@@ -112,7 +112,7 @@ mercurial_fetch() {
                die "failed to create ${EHG_STORE_DIR}/${EHG_PROJECT}"
        chmod -f g+rw "${EHG_STORE_DIR}/${EHG_PROJECT}" || \
                echo "Warning: failed to chmod g+rw ${EHG_PROJECT}"
-       cd "${EHG_STORE_DIR}/${EHG_PROJECT}" || \
+       pushd "${EHG_STORE_DIR}/${EHG_PROJECT}" > /dev/null || \
                die "failed to cd to ${EHG_STORE_DIR}/${EHG_PROJECT}"
 
        # Clone/update repository:
@@ -122,12 +122,13 @@ mercurial_fetch() {
                        rm -rf "${module}"
                        die "failed to clone ${EHG_REPO_URI}"
                }
-               cd "${module}"
        elif [[ -z "${EHG_OFFLINE}" ]]; then
                einfo "Updating ${EHG_STORE_DIR}/${EHG_PROJECT}/${module} from ${EHG_REPO_URI}"
-               cd "${module}" || die "failed to cd to ${module}"
+               pushd "${module}" > /dev/null || die "failed to cd to ${module}"
                ${EHG_PULL_CMD} "${EHG_REPO_URI}" || die "update failed"
+               popd > /dev/null || die
        fi
+       popd > /dev/null || die
 
        # Checkout working copy:
        einfo "Creating working directory in ${sourcedir} (target revision: ${EHG_REVISION})"