view contrib/builddeb @ 25018:93e015a3d1ea

commit: add ui.allowemptycommit config option This adds a config flag that enables a user to make empty commits. This is useful in a number of cases. For instance, automation that creates release branches via bookmarks may want to make empty commits to that release bookmark so that it can't be fast-forwarded and so it can record information about the release bookmark's creation. This is already possible with named branches, so making it possible for bookmarks makes sense. Another case we've wanted it is for mirroring repositories into Mercurial. We have automation that syncs commits into hg by running things from the command line. The ability to produce empty commits is useful for syncing unusual commits from other VCS's. In general, allowing the user to create the DAG as they see fit seems useful, and when I mentioned this in IRC more than one person piped up and said they were already hacking around this limitation by using mq, import, and commit-dummy-change-then-amend-the-content-away style solutions.
author Durham Goode <durham@fb.com>
date Mon, 11 May 2015 16:18:28 -0700
parents 56c64c91b429
children e5f2a2a095cb
line wrap: on
line source

#!/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
DEBBUILDDIR="$PWD/debbuild"
while [ "$1" ]; do
    case "$1" in
    --prepare )
        shift
        BUILD=
        ;;
    --debbuilddir )
        shift
        DEBBUILDDIR="$1"
        shift
        ;;
    * )
        echo "Invalid parameter $1!" 1>&2
        exit 1
        ;;
    esac
done

set -u

rm -rf $DEBBUILDDIR
mkdir -p $DEBBUILDDIR

if [ ! -d .hg ]; then
    echo 'You are not inside a Mercurial repository!' 1>&2
    exit 1
fi

gethgversion

cp -r $PWD/contrib/debian $DEBBUILDDIR/DEBIAN
chmod -R 0755 $DEBBUILDDIR/DEBIAN

control=$DEBBUILDDIR/DEBIAN/control

# This looks like sed -i, but sed -i behaves just differently enough
# between BSD and GNU sed that I gave up and did the dumb thing.
sed "s/__VERSION__/$version/" < $control > $control.tmp
mv $control.tmp $control

if [ "$BUILD" ]; then
    dpkg-deb --build $DEBBUILDDIR
    mv $DEBBUILDDIR.deb $DEBBUILDDIR/mercurial-$version-$release.deb
    if [ $? = 0 ]; then
        echo
        echo "Built packages for $version-$release:"
        find $DEBBUILDDIR/ -type f -newer $control
    fi
else
    echo "Prepared sources for $version-$release $control are in $DEBBUILDDIR - use like:"
    echo "dpkg-deb --build $DEBBUILDDIR"
fi