diff options
author | merakor <cem@ckyln.com> | 2020-08-31 22:04:48 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-08-31 22:04:48 +0000 |
commit | 88c6043753abf9686a2f6a18a216bc75b9e15586 (patch) | |
tree | a8a2452da3a288ec5e0ebf3e2fe716dc908e533a /src | |
parent | fc4621724b699f7acadbcfbb5048ea1762b3e344 (diff) | |
download | cpt-88c6043753abf9686a2f6a18a216bc75b9e15586.tar.gz |
pkg_fetch(): go to repository root before checking for Mercurial
also check remotes
FossilOrigin-Name: 482f5e133fec61f9b02a190e896acbe198e61fc1605d5ee149f32a2b5dc643bd
Diffstat (limited to 'src')
-rw-r--r-- | src/cpt-lib | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cpt-lib b/src/cpt-lib index e9e3014..8ef82c5 100644 --- a/src/cpt-lib +++ b/src/cpt-lib @@ -1497,7 +1497,8 @@ pkg_fetch() { for repo; do # Go to the root of the repository (if it exists). cd "$repo" - cd "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null ||: + cd "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || + cd "$(hg root 2>/dev/null)" 2>/dev/null ||: if [ -d .git ]; then @@ -1549,10 +1550,17 @@ pkg_fetch() { ) fi } - elif hg root >/dev/null 2>&1; then - cd "$(hg root)" + elif [ -d .hg ]; then + + [ "$(hg showconfig paths 2>/dev/null)" ] || { + log "$repo" " " + printf '%s\n' "No remote, skipping." + continue + } + contains "$repos $PWD" || { repos="$repos $PWD" + if [ -w "$PWD" ] && [ "$uid" != 0 ]; then hg pull hg update |