view hgeditor @ 28796:08a686a4a0a2

hghave: add cvsnt cvsnt is a maintained commercial fork of cvs https://en.wikipedia.org/wiki/CVSNT It is possible to build a version of it from sources (github), it requires libpcre and libltdl (libtool). We already have a test that relates to cvsnt: test-convert-cvsnt-mergepoints.t cvsnt installs: cvs, cvslockd, cvsnt, cvsscript I think we should definitely have a check for cvsnt because it makes the version checks for cvs make a lot more sense. When I use the version I built, cvs --version says: """ Concurrent Versions System (CVSNT) 2.5.05 (Gan) Build 3744 (Suite) (client/server) CVSNT 2.5.05 (Apr 4 2016) Copyright (c) 2008 March Hare Software Ltd. see http://www.march-hare.com/cvspro CVS Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn, Jeff Polk, and other authors CVSNT Copyright (c) 1999-2008 Tony Hoyle and others see http://www.cvsnt.org Commercial support and training provided by March Hare Software Ltd. see http://www.march-hare.com/cvspro CVSNT may be copied only under the terms of the GNU General Public License v2, a copy of which can be found with the CVS distribution. The CVSNT Application API is licensed under the terms of the GNU Library (or Lesser) General Public License. Specify the --help option for further information about CVS """
author timeless <timeless@mozdev.org>
date Mon, 04 Apr 2016 06:27:12 +0000
parents 1aee2ab0f902
children
line wrap: on
line source

#!/bin/sh
#
# This is an example of using HGEDITOR to create of diff to review the
# changes while committing.

# If you want to pass your favourite editor some other parameters
# only for Mercurial, modify this:
case "${EDITOR}" in
    "")
        EDITOR="vi"
        ;;
    emacs)
        EDITOR="$EDITOR -nw"
        ;;
    gvim|vim)
        EDITOR="$EDITOR -f -o"
        ;;
esac


HGTMP=""
cleanup_exit() {
    rm -rf "$HGTMP"
}

# Remove temporary files even if we get interrupted
trap "cleanup_exit" 0 # normal exit
trap "exit 255" HUP INT QUIT ABRT TERM

HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX)
[ x$HGTMP != x -a -d $HGTMP ] || {
  echo "Could not create temporary directory! Exiting." 1>&2
  exit 1
}

(
    grep '^HG: changed' "$1" | cut -b 13- | while read changed; do
        "$HG" diff "$changed" >> "$HGTMP/diff"
    done
)

cat "$1" > "$HGTMP/msg"

MD5=$(which md5sum 2>/dev/null) || \
    MD5=$(which md5 2>/dev/null)
[ -x "${MD5}" ] && CHECKSUM=`${MD5} "$HGTMP/msg"`
if [ -s "$HGTMP/diff" ]; then
    $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
else
    $EDITOR "$HGTMP/msg" || exit $?
fi
[ -x "${MD5}" ] && (echo "$CHECKSUM" | ${MD5} -c >/dev/null 2>&1 && exit 13)

mv "$HGTMP/msg" "$1"

exit $?