tests/remotefilelog-library.sh
author Mads Kiilerich <mads@kiilerich.com>
Mon, 26 Jun 2023 14:34:58 +0200
branchstable
changeset 50725 7e5be4a7cda7
parent 47921 0c92cd9286ee
permissions -rw-r--r--
tests: use grep -E instead of obsolescent egrep Testing on Fedora 38 failed with: egrep: warning: egrep is obsolescent; using grep -E The warning comes from https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1 . For further anecdotal evidence of the change, see https://www.phoronix.com/news/GNU-Grep-3.8-Stop-egrep-fgrep . This reverses the code check that goes back to e7d3b509af8b. grep -E is POSIX, but there is a risk that it doesn't work the same on all platforms - especially older Unix versions. It should however always be possible to put a GNU grep in $PATH before running the tests.

CACHEDIR=$PWD/hgcache
cat >> $HGRCPATH <<EOF
[remotefilelog]
cachepath=$CACHEDIR
debug=True
[extensions]
remotefilelog=
rebase=
strip=
[server]
preferuncompressed=True
[experimental]
changegroup3=True
[rebase]
singletransaction=True
EOF

hgcloneshallow() {
  local name
  local dest
  orig=$1
  shift
  dest=$1
  shift
  hg clone --shallow --config remotefilelog.reponame=master $orig $dest $@
  cat >> $dest/.hg/hgrc <<EOF
[remotefilelog]
reponame=master
[phases]
publish=False
EOF
}

hgcloneshallowlfs() {
  local name
  local dest
  local lfsdir
  orig=$1
  shift
  dest=$1
  shift
  lfsdir=$1
  shift
  hg clone --shallow --config "extensions.lfs=" --config "lfs.url=$lfsdir" --config remotefilelog.reponame=master $orig $dest $@
  cat >> $dest/.hg/hgrc <<EOF
[extensions]
lfs=
[lfs]
url=$lfsdir
[remotefilelog]
reponame=master
[phases]
publish=False
EOF
}

clearcache() {
  rm -rf $CACHEDIR/*
}

mkcommit() {
  echo "$1" > "$1"
  hg add "$1"
  hg ci -m "$1"
}

ls_l() {
  "$PYTHON" $TESTDIR/ls-l.py "$@"
}

identifyrflcaps() {
    xargs -n 1 echo | grep -E '(remotefilelog|getflogheads|getfile)' | sort
}