##// END OF EJS Templates
memfilectx: make changectx argument mandatory in constructor (API)...
memfilectx: make changectx argument mandatory in constructor (API) committablefilectx has three subclasses: workingfilectx, memfilectx, and overlayfilectx. committablefilectx takes an optional (change) ctx instance to its constructor. If it's provided, it's set on the instance as self._changectx. If not, that property is supposed to be defined by the class. However, only workingfilectx does that. The other two will have the property undefined if it's not passed in the constructor. That seems bad to me. This patch makes the changectx argument to the memfilectx constructor mandatory because that fixes the failure I ran into. It seems like we should also fix the overlayfilectx case. Differential Revision: https://phab.mercurial-scm.org/D1658

File last commit:

r34626:f1c2552c default
r35401:8a0cac20 default
Show More
builddeb
104 lines | 2.4 KiB | text/plain | TextLexer
#!/bin/sh -e
#
# Build a Mercurial debian package from the current repo
#
# Tested on Jessie (stable as of original script authoring.)
. $(dirname $0)/packagelib.sh
BUILD=1
CLEANUP=1
DISTID=`(lsb_release -is 2> /dev/null | tr '[:upper:]' '[:lower:]') || echo debian`
CODENAME=`lsb_release -cs 2> /dev/null || echo unknown`
DEBFLAGS=-b
while [ "$1" ]; do
case "$1" in
--distid )
shift
DISTID="$1"
shift
;;
--codename )
shift
CODENAME="$1"
shift
;;
--cleanup )
shift
BUILD=
;;
--build )
shift
CLEANUP=
;;
--source-only )
shift
DEBFLAGS=-S
;;
* )
echo "Invalid parameter $1!" 1>&2
exit 1
;;
esac
done
trap "if [ '$CLEANUP' ] ; then rm -r '$PWD/debian' ; fi" EXIT
set -u
if [ ! -d .hg ]; then
echo 'You are not inside a Mercurial repository!' 1>&2
exit 1
fi
gethgversion
debver="$version"
if [ -n "$type" ] ; then
debver="$debver~$type"
fi
if [ -n "$distance" ] ; then
debver="$debver+$distance-$CODENAME-$node"
elif [ "$DEBFLAGS" = "-S" ] ; then
# for building a ppa (--source-only) for a release (distance == 0), we need
# to version the distroseries so that we can upload to launchpad
debver="$debver~${CODENAME}1"
fi
control=debian/control
changelog=debian/changelog
if [ "$BUILD" ]; then
if [ -d debian ] ; then
echo "Error! debian control directory already exists!"
exit 1
fi
cp -r "$PWD"/contrib/debian debian
sed -i.tmp "s/__VERSION__/$debver/" $changelog
sed -i.tmp "s/__DATE__/$(date --rfc-2822)/" $changelog
sed -i.tmp "s/__CODENAME__/$CODENAME/" $changelog
rm $changelog.tmp
# remove the node from the version string
SRCFILE="mercurial_$(echo $debver | sed "s,-$node,,").orig.tar.gz"
"$PWD/hg" archive $SRCFILE
mv $SRCFILE ..
debuild -us -uc -i -I $DEBFLAGS
if [ $? != 0 ]; then
echo 'debuild failed!'
exit 1
fi
fi
if [ "$CLEANUP" ] ; then
echo
OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
mkdir -p "$OUTPUTDIR"
find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
../mercurial*.dsc ../mercurial*.gz \
-type f -newer $control -print0 2>/dev/null | \
xargs -Inarf -0 mv narf "$OUTPUTDIR"
echo "Built packages for $debver:"
find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
fi