Mercurial > hg
view contrib/builddeb @ 25652:2882d6886919
repair: add functionality to rebuild fncache
Currently, there is no way to recover from a missing or corrupt fncache
file in place (a clone is required). For certain use cases such as
servers and with large repositories, an in-place repair may be
desirable. This patch adds functionality for in-place repair of the
fncache.
The `hg debugrebuildfncache` command is introduced. It ensures the
fncache is up to date by reconstructing the fncache from all seen files
encountered during a brute force traversal of the repository's entire
history.
The command will add missing entries and will prune excess ones.
Currently, the command no-ops unless the repository has the fncache
requirement. The command could later grow the ability to "upgrade" an
existing repository to be fncache enabled, if desired.
When testing this patch on a local clone of the Firefox repository, it
removed a bunch of entries. Investigation revealed that removed entries
belonged to empty (0 byte size) .i filelogs. The functionality for
pruning fncache of stripped revlogs was introduced in f49d60fa40a5, so
the presence of these entries likely predates this feature.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 22 Jun 2015 09:59:48 -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