abort: added logic for of hg abort
This is part of `GSoC19` project `Implement abort and
continue commands`. This patch is part of the `abort plan`.
This adds the basic logic for `hg abort`. This command
aborts an multistep operation like graft, histedit, rebase,
merge and unshelve if they are in an unfinished state.
The first part of the logic is determining the unfinished
operation from the state detection API under `statemod`.
This API is extended to support `hg abort` by adding a method
to register the abort logic as a function (here `abortfunc`).
Once the unfinished operation is determined the registered
logic is used to abort the command. The benefit of this kind
of framework is that any new extension developed can support
`hg abort` by registering the command and logic under
statedetection API.
`hg abort` currently supports `--dry-run/-n` flag only.
It is used to dry run `hg abort`
Further patches sequentially add support for `graft`, `rebase`,
`unshelve`, `histedit` and `merge`.
Differential Revision: https://phab.mercurial-scm.org/D6566
CACHEDIR=$PWD/hgcache
cat >> $HGRCPATH <<EOF
[remotefilelog]
cachepath=$CACHEDIR
debug=True
[extensions]
remotefilelog=
rebase=
strip=
[ui]
ssh=python "$TESTDIR/dummyssh"
[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 | egrep '(remotefilelog|getflogheads|getfile)' | sort
}