# 00-defs-build -  misc shell wrappers for quilt

# ------------------------------------------
# Top of Tree and navigation defs
export TOP=$(pwd)

# could usurp 'top', but let's not.
gotop() { cd $TOP/$1; pwd; }
Top() { cd $TOP/$1; pwd; }

# ------------------------------------------
# Quilt Defs:

export QUILT_PATCHES=$TOP/.patches
export QUILT_PC=$TOP/.pc
export QUILT_DIFF_OPTS="-u -p"

qt() { quilt top; }
qf() { quilt files; }
qa() { quilt applied; }
qr() { quilt refresh --diffstat; }
qs() { quilt series; }

qp() { quilt push "$@"; }
qpa() { quilt push -a "$@"; }
qpf() { quilt push -f "$@"; }
qpr() { quilt push; qr; }
qpp() { quilt pop "$@"; }

qvs() { ${EDITOR:-vi} $QUILT_PATCHES/series; }
vp() { [[ -z "$1" ]] || ${EDITOR:-vi} $QUILT_PATCHES/$1; }


echo "TOP = $TOP" >&2
