diff --git a/msys/mingw/bin/WhoUses.exe b/msys/mingw/bin/WhoUses.exe new file mode 100644 index 000000000..f1a6fd16c Binary files /dev/null and b/msys/mingw/bin/WhoUses.exe differ diff --git a/msys/mingw/bin/acountry.exe b/msys/mingw/bin/acountry.exe new file mode 100644 index 000000000..7016df584 Binary files /dev/null and b/msys/mingw/bin/acountry.exe differ diff --git a/msys/mingw/bin/adig.exe b/msys/mingw/bin/adig.exe new file mode 100644 index 000000000..90ea8492c Binary files /dev/null and b/msys/mingw/bin/adig.exe differ diff --git a/msys/mingw/bin/ahost.exe b/msys/mingw/bin/ahost.exe new file mode 100644 index 000000000..29cef8887 Binary files /dev/null and b/msys/mingw/bin/ahost.exe differ diff --git a/msys/mingw/bin/antiword.exe b/msys/mingw/bin/antiword.exe new file mode 100644 index 000000000..7662115b2 Binary files /dev/null and b/msys/mingw/bin/antiword.exe differ diff --git a/msys/mingw/bin/blocked-file-util.exe b/msys/mingw/bin/blocked-file-util.exe new file mode 100644 index 000000000..7ecae10fd Binary files /dev/null and b/msys/mingw/bin/blocked-file-util.exe differ diff --git a/msys/mingw/bin/bunzip2.exe b/msys/mingw/bin/bunzip2.exe new file mode 100644 index 000000000..cd8f8b6f4 Binary files /dev/null and b/msys/mingw/bin/bunzip2.exe differ diff --git a/msys/mingw/bin/bzcat.exe b/msys/mingw/bin/bzcat.exe new file mode 100644 index 000000000..cd8f8b6f4 Binary files /dev/null and b/msys/mingw/bin/bzcat.exe differ diff --git a/msys/mingw/bin/bzcmp b/msys/mingw/bin/bzcmp new file mode 100644 index 000000000..6fc38f92d --- /dev/null +++ b/msys/mingw/bin/bzcmp @@ -0,0 +1,76 @@ +#!/bin/sh +# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh + +# Bzcmp/diff wrapped for bzip2, +# adapted from zdiff by Philippe Troin for Debian GNU/Linux. + +# Bzcmp and bzdiff are used to invoke the cmp or the diff pro- +# gram on compressed files. All options specified are passed +# directly to cmp or diff. If only 1 file is specified, then +# the files compared are file1 and an uncompressed file1.gz. +# If two files are specified, then they are uncompressed (if +# necessary) and fed to cmp or diff. The exit status from cmp +# or diff is preserved. + +PATH="/usr/bin:/bin:$PATH"; export PATH +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *cmp) comp=${CMP-cmp} ;; + *) comp=${DIFF-diff} ;; +esac + +OPTIONS= +FILES= +for ARG +do + case "$ARG" in + -*) OPTIONS="$OPTIONS $ARG";; + *) if test -f "$ARG"; then + FILES="$FILES $ARG" + else + echo "${prog}: $ARG not found or not a regular file" + exit 1 + fi ;; + esac +done +if test -z "$FILES"; then + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi +tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || { + echo 'cannot create a temporary file' >&2 + exit 1 +} +set $FILES +if test $# -eq 1; then + FILE=`echo "$1" | sed 's/.bz2$//'` + bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE" + STAT="$?" + +elif test $# -eq 2; then + case "$1" in + *.bz2) + case "$2" in + *.bz2) + F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` + bzip2 -cdfq "$2" > $tmp + bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp + STAT="$?" + /bin/rm -f $tmp;; + + *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" + STAT="$?";; + esac;; + *) case "$2" in + *.bz2) + bzip2 -cdfq "$2" | $comp $OPTIONS "$1" - + STAT="$?";; + *) $comp $OPTIONS "$1" "$2" + STAT="$?";; + esac;; + esac + exit "$STAT" +else + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi diff --git a/msys/mingw/bin/bzdiff b/msys/mingw/bin/bzdiff new file mode 100644 index 000000000..6fc38f92d --- /dev/null +++ b/msys/mingw/bin/bzdiff @@ -0,0 +1,76 @@ +#!/bin/sh +# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh + +# Bzcmp/diff wrapped for bzip2, +# adapted from zdiff by Philippe Troin for Debian GNU/Linux. + +# Bzcmp and bzdiff are used to invoke the cmp or the diff pro- +# gram on compressed files. All options specified are passed +# directly to cmp or diff. If only 1 file is specified, then +# the files compared are file1 and an uncompressed file1.gz. +# If two files are specified, then they are uncompressed (if +# necessary) and fed to cmp or diff. The exit status from cmp +# or diff is preserved. + +PATH="/usr/bin:/bin:$PATH"; export PATH +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *cmp) comp=${CMP-cmp} ;; + *) comp=${DIFF-diff} ;; +esac + +OPTIONS= +FILES= +for ARG +do + case "$ARG" in + -*) OPTIONS="$OPTIONS $ARG";; + *) if test -f "$ARG"; then + FILES="$FILES $ARG" + else + echo "${prog}: $ARG not found or not a regular file" + exit 1 + fi ;; + esac +done +if test -z "$FILES"; then + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi +tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || { + echo 'cannot create a temporary file' >&2 + exit 1 +} +set $FILES +if test $# -eq 1; then + FILE=`echo "$1" | sed 's/.bz2$//'` + bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE" + STAT="$?" + +elif test $# -eq 2; then + case "$1" in + *.bz2) + case "$2" in + *.bz2) + F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` + bzip2 -cdfq "$2" > $tmp + bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp + STAT="$?" + /bin/rm -f $tmp;; + + *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" + STAT="$?";; + esac;; + *) case "$2" in + *.bz2) + bzip2 -cdfq "$2" | $comp $OPTIONS "$1" - + STAT="$?";; + *) $comp $OPTIONS "$1" "$2" + STAT="$?";; + esac;; + esac + exit "$STAT" +else + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi diff --git a/msys/mingw/bin/bzegrep b/msys/mingw/bin/bzegrep new file mode 100644 index 000000000..37de592d2 --- /dev/null +++ b/msys/mingw/bin/bzegrep @@ -0,0 +1,132 @@ +#!/bin/sh + +# bzgrep -- a wrapper around a grep program that decompresses files as needed +# Adapted from zgrep of the Debian gzip package by Anibal Monsalve Salazar. +# Adapted from a version sent by Charles Levert + +# Copyright (C) 1998, 2001, 2002 Free Software Foundation +# Copyright (C) 1993 Jean-loup Gailly + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo "$0" | sed 's|.*/||'` +case "$prog" in + *egrep) grep=${EGREP-egrep} ;; + *fgrep) grep=${FGREP-fgrep} ;; + *) grep=${GREP-grep} ;; +esac + +pat="" +after_dash_dash="" +files_with_matches=0 +files_without_matches=0 +no_filename=0 +with_filename=0 + +while test $# -ne 0; do + case "$after_dash_dash$1" in + --d* | --rec*) echo >&2 "$0: $1: option not supported"; exit 2;; + --files-with-*) files_with_matches=1;; + --files-witho*) files_without_matches=1;; + --no-f*) no_filename=1;; + --wi*) with_filename=1;; + --*) ;; + -*) + case "$1" in + -*[dr]*) echo >&2 "$0: $1: option not supported"; exit 2;; + esac + case "$1" in + -*H*) with_filename=1;; + esac + case "$1" in + -*h*) no_filename=1;; + esac + case "$1" in + -*L*) files_without_matches=1;; + esac + case "$1" in + -*l*) files_with_matches=1;; + esac;; + esac + case "$after_dash_dash$1" in + -[ef]) opt="$opt $1"; shift; pat="$1" + if test "$grep" = grep; then # grep is buggy with -e on SVR4 + grep=egrep + fi;; + -[ABCdm])opt="$opt $1 $2"; shift;; + --) opt="$opt $1"; after_dash_dash=1;; + -*) opt="$opt $1";; + *) if test -z "$pat"; then + pat="$1" + else + break; + fi;; + esac + shift +done + +if test -z "$pat"; then + echo "grep through bzip2 files" + echo "usage: $prog [grep_options] pattern [files]" + exit 2 +fi + +if test $# -eq 0; then + bzip2 -cdfq | $grep $opt "$pat" + exit $? +fi + +res=0 +for i do + bzip2 -cdfq -- "$i" | + if test $files_with_matches -eq 1; then + $grep $opt "$pat" > /dev/null && printf "%s\n" "$i" + elif test $files_without_matches -eq 1; then + $grep $opt "$pat" > /dev/null || printf "%s\n" "$i" + elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then + $grep $opt "$pat" + else + i=$(echo "$i" | sed -e 's/[\\|&]/\\&/g') + if test $with_filename -eq 1; then + sed_script="s|^[^:]*:|${i}:|" + else + sed_script="s|^|${i}:|" + fi + # Hack adapted from GPLed code at + # http://home.comcast.net/~j.p.h/cus-faq-2 + # Has the same effect as the following two lines of bash: + # + # $grep $opt "$pat" | sed "$sed_script" + # exit ${PIPESTATUS[0]} + # + # Inside the `...`, fd4 goes to the pipe whose other end is read + # and passed to eval; fd1 is the normal standard output + # preserved the line before with exec 3>&1 + exec 3>&1 + eval ` + exec 4>&1 >&3 3>&- + { + $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 + } | sed "$sed_script" + ` + exit $r + fi + r=$? + test $res -lt $r && res=$r +done +exit $res diff --git a/msys/mingw/bin/bzfgrep b/msys/mingw/bin/bzfgrep new file mode 100644 index 000000000..37de592d2 --- /dev/null +++ b/msys/mingw/bin/bzfgrep @@ -0,0 +1,132 @@ +#!/bin/sh + +# bzgrep -- a wrapper around a grep program that decompresses files as needed +# Adapted from zgrep of the Debian gzip package by Anibal Monsalve Salazar. +# Adapted from a version sent by Charles Levert + +# Copyright (C) 1998, 2001, 2002 Free Software Foundation +# Copyright (C) 1993 Jean-loup Gailly + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo "$0" | sed 's|.*/||'` +case "$prog" in + *egrep) grep=${EGREP-egrep} ;; + *fgrep) grep=${FGREP-fgrep} ;; + *) grep=${GREP-grep} ;; +esac + +pat="" +after_dash_dash="" +files_with_matches=0 +files_without_matches=0 +no_filename=0 +with_filename=0 + +while test $# -ne 0; do + case "$after_dash_dash$1" in + --d* | --rec*) echo >&2 "$0: $1: option not supported"; exit 2;; + --files-with-*) files_with_matches=1;; + --files-witho*) files_without_matches=1;; + --no-f*) no_filename=1;; + --wi*) with_filename=1;; + --*) ;; + -*) + case "$1" in + -*[dr]*) echo >&2 "$0: $1: option not supported"; exit 2;; + esac + case "$1" in + -*H*) with_filename=1;; + esac + case "$1" in + -*h*) no_filename=1;; + esac + case "$1" in + -*L*) files_without_matches=1;; + esac + case "$1" in + -*l*) files_with_matches=1;; + esac;; + esac + case "$after_dash_dash$1" in + -[ef]) opt="$opt $1"; shift; pat="$1" + if test "$grep" = grep; then # grep is buggy with -e on SVR4 + grep=egrep + fi;; + -[ABCdm])opt="$opt $1 $2"; shift;; + --) opt="$opt $1"; after_dash_dash=1;; + -*) opt="$opt $1";; + *) if test -z "$pat"; then + pat="$1" + else + break; + fi;; + esac + shift +done + +if test -z "$pat"; then + echo "grep through bzip2 files" + echo "usage: $prog [grep_options] pattern [files]" + exit 2 +fi + +if test $# -eq 0; then + bzip2 -cdfq | $grep $opt "$pat" + exit $? +fi + +res=0 +for i do + bzip2 -cdfq -- "$i" | + if test $files_with_matches -eq 1; then + $grep $opt "$pat" > /dev/null && printf "%s\n" "$i" + elif test $files_without_matches -eq 1; then + $grep $opt "$pat" > /dev/null || printf "%s\n" "$i" + elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then + $grep $opt "$pat" + else + i=$(echo "$i" | sed -e 's/[\\|&]/\\&/g') + if test $with_filename -eq 1; then + sed_script="s|^[^:]*:|${i}:|" + else + sed_script="s|^|${i}:|" + fi + # Hack adapted from GPLed code at + # http://home.comcast.net/~j.p.h/cus-faq-2 + # Has the same effect as the following two lines of bash: + # + # $grep $opt "$pat" | sed "$sed_script" + # exit ${PIPESTATUS[0]} + # + # Inside the `...`, fd4 goes to the pipe whose other end is read + # and passed to eval; fd1 is the normal standard output + # preserved the line before with exec 3>&1 + exec 3>&1 + eval ` + exec 4>&1 >&3 3>&- + { + $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 + } | sed "$sed_script" + ` + exit $r + fi + r=$? + test $res -lt $r && res=$r +done +exit $res diff --git a/msys/mingw/bin/bzgrep b/msys/mingw/bin/bzgrep new file mode 100644 index 000000000..37de592d2 --- /dev/null +++ b/msys/mingw/bin/bzgrep @@ -0,0 +1,132 @@ +#!/bin/sh + +# bzgrep -- a wrapper around a grep program that decompresses files as needed +# Adapted from zgrep of the Debian gzip package by Anibal Monsalve Salazar. +# Adapted from a version sent by Charles Levert + +# Copyright (C) 1998, 2001, 2002 Free Software Foundation +# Copyright (C) 1993 Jean-loup Gailly + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo "$0" | sed 's|.*/||'` +case "$prog" in + *egrep) grep=${EGREP-egrep} ;; + *fgrep) grep=${FGREP-fgrep} ;; + *) grep=${GREP-grep} ;; +esac + +pat="" +after_dash_dash="" +files_with_matches=0 +files_without_matches=0 +no_filename=0 +with_filename=0 + +while test $# -ne 0; do + case "$after_dash_dash$1" in + --d* | --rec*) echo >&2 "$0: $1: option not supported"; exit 2;; + --files-with-*) files_with_matches=1;; + --files-witho*) files_without_matches=1;; + --no-f*) no_filename=1;; + --wi*) with_filename=1;; + --*) ;; + -*) + case "$1" in + -*[dr]*) echo >&2 "$0: $1: option not supported"; exit 2;; + esac + case "$1" in + -*H*) with_filename=1;; + esac + case "$1" in + -*h*) no_filename=1;; + esac + case "$1" in + -*L*) files_without_matches=1;; + esac + case "$1" in + -*l*) files_with_matches=1;; + esac;; + esac + case "$after_dash_dash$1" in + -[ef]) opt="$opt $1"; shift; pat="$1" + if test "$grep" = grep; then # grep is buggy with -e on SVR4 + grep=egrep + fi;; + -[ABCdm])opt="$opt $1 $2"; shift;; + --) opt="$opt $1"; after_dash_dash=1;; + -*) opt="$opt $1";; + *) if test -z "$pat"; then + pat="$1" + else + break; + fi;; + esac + shift +done + +if test -z "$pat"; then + echo "grep through bzip2 files" + echo "usage: $prog [grep_options] pattern [files]" + exit 2 +fi + +if test $# -eq 0; then + bzip2 -cdfq | $grep $opt "$pat" + exit $? +fi + +res=0 +for i do + bzip2 -cdfq -- "$i" | + if test $files_with_matches -eq 1; then + $grep $opt "$pat" > /dev/null && printf "%s\n" "$i" + elif test $files_without_matches -eq 1; then + $grep $opt "$pat" > /dev/null || printf "%s\n" "$i" + elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then + $grep $opt "$pat" + else + i=$(echo "$i" | sed -e 's/[\\|&]/\\&/g') + if test $with_filename -eq 1; then + sed_script="s|^[^:]*:|${i}:|" + else + sed_script="s|^|${i}:|" + fi + # Hack adapted from GPLed code at + # http://home.comcast.net/~j.p.h/cus-faq-2 + # Has the same effect as the following two lines of bash: + # + # $grep $opt "$pat" | sed "$sed_script" + # exit ${PIPESTATUS[0]} + # + # Inside the `...`, fd4 goes to the pipe whose other end is read + # and passed to eval; fd1 is the normal standard output + # preserved the line before with exec 3>&1 + exec 3>&1 + eval ` + exec 4>&1 >&3 3>&- + { + $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 + } | sed "$sed_script" + ` + exit $r + fi + r=$? + test $res -lt $r && res=$r +done +exit $res diff --git a/msys/mingw/bin/bzip2.exe b/msys/mingw/bin/bzip2.exe new file mode 100644 index 000000000..cd8f8b6f4 Binary files /dev/null and b/msys/mingw/bin/bzip2.exe differ diff --git a/msys/mingw/bin/bzip2recover.exe b/msys/mingw/bin/bzip2recover.exe new file mode 100644 index 000000000..8c98b0956 Binary files /dev/null and b/msys/mingw/bin/bzip2recover.exe differ diff --git a/msys/mingw/bin/bzless b/msys/mingw/bin/bzless new file mode 100644 index 000000000..f423ed905 --- /dev/null +++ b/msys/mingw/bin/bzless @@ -0,0 +1,61 @@ +#!/bin/sh + +# Bzmore wrapped for bzip2, +# adapted from zmore by Philippe Troin for Debian GNU/Linux. + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *less) more=less ;; + *) more=more ;; +esac + +if test "`echo -n a`" = "-n a"; then + # looks like a SysV system: + n1=''; n2='\c' +else + n1='-n'; n2='' +fi +oldtty=`stty -g 2>/dev/null` +if stty -cbreak 2>/dev/null; then + cb='cbreak'; ncb='-cbreak' +else + # 'stty min 1' resets eof to ^a on both SunOS and SysV! + cb='min 1 -icanon'; ncb='icanon eof ^d' +fi +if test $? -eq 0 && test -n "$oldtty"; then + trap 'stty $oldtty 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM +else + trap 'stty $ncb echo 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM +fi + +if test $# = 0; then + if test -t 0; then + echo usage: $prog files... + else + bzip2 -cdfq | eval $more + fi +else + FIRST=1 + for FILE + do + if test $FIRST -eq 0; then + echo $n1 "--More--(Next file: $FILE)$n2" + stty $cb -echo 2>/dev/null + ANS=`dd bs=1 count=1 2>/dev/null` + stty $ncb echo 2>/dev/null + echo " " + if test "$ANS" = 'e' || test "$ANS" = 'q'; then + exit + fi + fi + if test "$ANS" != 's'; then + echo "------> $FILE <------" + bzip2 -cdfq "$FILE" | eval $more + fi + if test -t; then + FIRST=0 + fi + done +fi diff --git a/msys/mingw/bin/bzmore b/msys/mingw/bin/bzmore new file mode 100644 index 000000000..f423ed905 --- /dev/null +++ b/msys/mingw/bin/bzmore @@ -0,0 +1,61 @@ +#!/bin/sh + +# Bzmore wrapped for bzip2, +# adapted from zmore by Philippe Troin for Debian GNU/Linux. + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *less) more=less ;; + *) more=more ;; +esac + +if test "`echo -n a`" = "-n a"; then + # looks like a SysV system: + n1=''; n2='\c' +else + n1='-n'; n2='' +fi +oldtty=`stty -g 2>/dev/null` +if stty -cbreak 2>/dev/null; then + cb='cbreak'; ncb='-cbreak' +else + # 'stty min 1' resets eof to ^a on both SunOS and SysV! + cb='min 1 -icanon'; ncb='icanon eof ^d' +fi +if test $? -eq 0 && test -n "$oldtty"; then + trap 'stty $oldtty 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM +else + trap 'stty $ncb echo 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM +fi + +if test $# = 0; then + if test -t 0; then + echo usage: $prog files... + else + bzip2 -cdfq | eval $more + fi +else + FIRST=1 + for FILE + do + if test $FIRST -eq 0; then + echo $n1 "--More--(Next file: $FILE)$n2" + stty $cb -echo 2>/dev/null + ANS=`dd bs=1 count=1 2>/dev/null` + stty $ncb echo 2>/dev/null + echo " " + if test "$ANS" = 'e' || test "$ANS" = 'q'; then + exit + fi + fi + if test "$ANS" != 's'; then + echo "------> $FILE <------" + bzip2 -cdfq "$FILE" | eval $more + fi + if test -t; then + FIRST=0 + fi + done +fi diff --git a/msys/mingw/bin/connect.exe b/msys/mingw/bin/connect.exe new file mode 100644 index 000000000..2a43bf98d Binary files /dev/null and b/msys/mingw/bin/connect.exe differ diff --git a/msys/mingw/bin/create-shortcut.exe b/msys/mingw/bin/create-shortcut.exe new file mode 100644 index 000000000..c14357d7a Binary files /dev/null and b/msys/mingw/bin/create-shortcut.exe differ diff --git a/msys/mingw/bin/curl.exe b/msys/mingw/bin/curl.exe new file mode 100644 index 000000000..d8f278618 Binary files /dev/null and b/msys/mingw/bin/curl.exe differ diff --git a/msys/mingw/bin/edit_test.exe b/msys/mingw/bin/edit_test.exe new file mode 100644 index 000000000..dac336ab5 Binary files /dev/null and b/msys/mingw/bin/edit_test.exe differ diff --git a/msys/mingw/bin/edit_test_dll.exe b/msys/mingw/bin/edit_test_dll.exe new file mode 100644 index 000000000..250e6eccb Binary files /dev/null and b/msys/mingw/bin/edit_test_dll.exe differ diff --git a/msys/mingw/bin/envsubst.exe b/msys/mingw/bin/envsubst.exe new file mode 100644 index 000000000..b55050737 Binary files /dev/null and b/msys/mingw/bin/envsubst.exe differ diff --git a/msys/mingw/bin/gettext.exe b/msys/mingw/bin/gettext.exe new file mode 100644 index 000000000..a46441d29 Binary files /dev/null and b/msys/mingw/bin/gettext.exe differ diff --git a/msys/mingw/bin/gettext.sh b/msys/mingw/bin/gettext.sh new file mode 100644 index 000000000..f031a43e3 --- /dev/null +++ b/msys/mingw/bin/gettext.sh @@ -0,0 +1,121 @@ +#! /bin/sh +# +# Copyright (C) 2003, 2005-2007, 2011, 2015-2016 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# + +# Find a way to echo strings without interpreting backslash. +if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + echo='echo' +else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + echo='printf %s\n' + else + echo_func () { + cat < +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo "Written by" "Bruno Haible" + } + if test $# = 1; then + case "$1" in + --help | --hel | --he | --h ) + func_usage; exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version; exit 0 ;; + esac + fi + func_usage 1>&2 + exit 1 + ;; + esac +fi + +# eval_gettext MSGID +# looks up the translation of MSGID and substitutes shell variables in the +# result. +eval_gettext () { + gettext "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1") +} + +# eval_ngettext MSGID MSGID-PLURAL COUNT +# looks up the translation of MSGID / MSGID-PLURAL for COUNT and substitutes +# shell variables in the result. +eval_ngettext () { + ngettext "$1" "$2" "$3" | (export PATH `envsubst --variables "$1 $2"`; envsubst "$1 $2") +} + +# Note: This use of envsubst is much safer than using the shell built-in 'eval' +# would be. +# 1) The security problem with Chinese translations that happen to use a +# character such as \xe0\x60 is avoided. +# 2) The security problem with malevolent translators who put in command lists +# like "$(...)" or "`...`" is avoided. +# 3) The translations can only refer to shell variables that are already +# mentioned in MSGID or MSGID-PLURAL. +# +# Note: "export PATH" above is a dummy; this is for the case when +# `envsubst --variables ...` returns nothing. +# +# Note: In eval_ngettext above, "$1 $2" means a string whose variables set is +# the union of the variables set of "$1" and "$2". +# +# Note: The minimal use of backquote above ensures that trailing newlines are +# not dropped, not from the gettext invocation and not from the value of any +# shell variable. +# +# Note: Field splitting on the `envsubst --variables ...` result is desired, +# since envsubst outputs the variables, separated by newlines. Pathname +# wildcard expansion or tilde expansion has no effect here, since the words +# output by "envsubst --variables ..." consist solely of alphanumeric +# characters and underscore. diff --git a/msys/mingw/bin/gettextize b/msys/mingw/bin/gettextize new file mode 100644 index 000000000..8b2380147 --- /dev/null +++ b/msys/mingw/bin/gettextize @@ -0,0 +1,1347 @@ +#! /bin/sh +# +# Copyright (C) 1995-1998, 2000-2016 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# This file is meant for authors or maintainers which want to +# internationalize their package with the help of GNU gettext. For +# further information how to use it consult the GNU gettext manual. + +progname=$0 +package=gettext-tools +version=0.19.8.1 +archive_version=0.19.8 + +# Set variables +# - gettext_datadir directory where the data files are stored. +prefix="/mingw64" +datarootdir="${prefix}/share" +: ${gettext_datadir="${datarootdir}/gettext"} +: ${AUTOM4TE=autom4te} + +# func_tmpdir +# creates a temporary directory. +# Sets variable +# - tmp pathname of freshly created temporary directory +func_tmpdir () +{ + # Use the environment variable TMPDIR, falling back to /tmp. This allows + # users to specify a different temporary directory, for example, if their + # /tmp is filled up or too small. + : ${TMPDIR=/tmp} + { + # Use the mktemp program if available. If not available, hide the error + # message. + tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" + } || + { + # Use a simple mkdir command. It is guaranteed to fail if the directory + # already exists. $RANDOM is bash specific and expands to empty in shells + # other than bash, ksh and zsh. Its use does not increase security; + # rather, it minimizes the probability of failure in a very cluttered /tmp + # directory. + tmp=$TMPDIR/gt$$-$RANDOM + (umask 077 && mkdir "$tmp") + } || + { + echo "$0: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } + } +} + +# Support for relocatability. +func_find_curr_installdir () +{ + # Determine curr_installdir, even taking into account symlinks. + curr_executable="$0" + case "$curr_executable" in + */* | *\\*) ;; + *) # Need to look in the PATH. + save_IFS="$IFS"; IFS="${PATH_SEPARATOR=':'}" + for dir in $PATH; do + IFS="$save_IFS" + test -z "$dir" && dir=. + for exec_ext in ''; do + if test -f "$dir/$curr_executable$exec_ext"; then + curr_executable="$dir/$curr_executable$exec_ext" + break 2 + fi + done + done + IFS="$save_IFS" + ;; + esac + # Make absolute. + case "$curr_executable" in + /* | ?:/* | ?:\\*) ;; + *) curr_executable=`pwd`/"$curr_executable" ;; + esac + # Resolve symlinks. + sed_dirname='s,[\\/][^\\/]*$,,' + sed_linkdest='s,^.* -> \(.*\),\1,p' + while : ; do + lsline=`LC_ALL=C ls -l "$curr_executable"` + case "$lsline" in + *" -> "*) + linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"` + case "$linkdest" in + /* | ?:/* | ?:\\*) curr_executable="$linkdest" ;; + *) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;; + esac ;; + *) break ;; + esac + done + curr_installdir=`echo "$curr_executable" | sed -e 's,[\\/][^\\/]*$,,'` + # Canonicalize. + curr_installdir=`cd "$curr_installdir" && pwd` +} +func_find_prefixes () +{ + # Compute the original/current installation prefixes by stripping the + # trailing directories off the original/current installation directories. + orig_installprefix="$orig_installdir" + curr_installprefix="$curr_installdir" + while true; do + orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*[\\/]\([^\\/]*\)$,\1,p'` + curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*]\\/]\([^\\/]*\)$,\1,p'` + if test -z "$orig_last" || test -z "$curr_last"; then + break + fi + if test "$orig_last" != "$curr_last"; then + break + fi + orig_installprefix=`echo "$orig_installprefix" | sed -e 's,[\\/][^\\/]*$,,'` + curr_installprefix=`echo "$curr_installprefix" | sed -e 's,[\\/][^\\/]*$,,'` + done +} +if test "no" = yes; then + exec_prefix="${prefix}" + bindir="${exec_prefix}/bin" + orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables + func_find_curr_installdir # determine curr_installdir + func_find_prefixes + # Relocate the directory variables that we use. + gettext_datadir=`echo "$gettext_datadir/" | sed -e "s%^${orig_installprefix}\([\\/]\)%${curr_installprefix}\1%" | sed -e 's,[\\/]$,,'` +fi + +# func_trace_autoconf macro configure.ac +# traces an Autoconf macro call and outputs the arguments to stdout, +# using autom4te. +func_trace_autoconf () +{ + echo '\ +dnl replace macros which may abort autom4te with a no-op variant +m4_pushdef([m4_assert]) +m4_pushdef([m4_fatal]) +m4_pushdef([m4_warn]) +m4_pushdef([m4_errprintn]) +m4_pushdef([m4_exit]) +m4_pushdef([m4_include]) +m4_pushdef([m4_esyscmd]) +' \ + | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 \ + --trace="$1":\$% - "$2" 2>/dev/null +} + +# func_trace_sed macro configure.ac +# traces an Autoconf macro call and outputs the arguments to stdout, +# using sed. +func_trace_sed () +{ + sed_extract_arguments=' +s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; +/'"$1"'(/ { + ta + :a + s/)/)/ + tb + s/\\$// + N + ba + :b + s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p +} +d' + sed -e "$sed_extract_arguments" "$2" +} + +# func_usage +# outputs to stdout the --help usage message. +func_usage () +{ + echo "\ +Usage: gettextize [OPTION]... [package-dir] + +Prepares a source package to use gettext. + +Options: + --help print this help and exit + --version print version information and exit + -f, --force force writing of new files even if old exist + --intl install libintl in a subdirectory (deprecated) + --po-dir=DIR specify directory with PO files + --no-changelog don't update or create ChangeLog files + --symlink make symbolic links instead of copying files + -n, --dry-run print modifications but don't perform them + +Report bugs to ." +} + +# func_version +# outputs to stdout the --version message. +func_version () +{ + echo "$progname (GNU $package) $version" + echo "Copyright (C) 1995-1998, 2000-2013 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo "Written by" "Ulrich Drepper" +} + +# func_fatal_error message +# outputs to stderr a fatal error message, and terminates the program. +func_fatal_error () +{ + echo "gettextize: *** $1" 1>&2 + echo "gettextize: *** Stop." 1>&2 + exit 1 +} + +# Nuisances. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +# Command-line option processing. +# Removes the OPTIONS from the arguments. Sets the variables: +# - force 1 if --force was given, 0 otherwise +# - intldir yes if --intl was given, empty otherwise +# - podirs list of directories specified with --po-dir +# - try_ln_s : if --symlink was given, false otherwise +# - do_changelog false if --no-changelog was given, : otherwise +# - doit false if --dry-run was given, : otherwise +{ + force=0 + intldir= + podirs= + try_ln_s=false + do_changelog=: + doit=: + + while test $# -gt 0; do + case "$1" in + -c | --copy | --cop | --co | --c ) # accepted for backward compatibility + shift ;; + -n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d ) + shift + doit=false ;; + -f | --force | --forc | --for | --fo | --f ) + shift + force=1 ;; + --help | --hel | --he | --h ) + func_usage; exit 0 ;; + --intl | --int | --in | --i ) + shift + intldir=yes ;; + --po-dir | --po-di | --po-d | --po- | --po | --p ) + shift + if test $# = 0; then + func_fatal_error "missing argument for --po-dir" + fi + case "$1" in + -*) func_fatal_error "missing argument for --po-dir" ;; + esac + podirs="$podirs $1" + shift ;; + --po-dir=* ) + arg=`echo "X$1" | sed -e 's/^X--po-dir=//'` + podirs="$podirs $arg" + shift ;; + --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c ) + shift + do_changelog=false ;; + --symlink | --symlin | --symli | --syml | --sym | --sy | --s ) + shift + try_ln_s=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version + exit 0 ;; + -- ) # Stop option prcessing + shift; break ;; + -* ) + echo "gettextize: unknown option $1" 1>&2 + echo "Try 'gettextize --help' for more information." 1>&2 + exit 1 ;; + * ) + break ;; + esac + done + # podirs defaults to "po". + test -n "$podirs" || podirs="po" +} + +# Warn about deprecated options. +if test -n "$intldir"; then + echo "gettextize: warning: the option '--intl' is deprecated and will be removed" 1>&2 +fi + +# Command-line argument processing. +# Analyzes the remaining arguments. +# Sets the variables +# - origdir to the original directory, +# - srcdir to the package directory, and cd-s into it. +{ + if test $# -gt 1; then + func_usage 1>&2 + exit 1 + fi + origdir=`pwd` + if test $# -eq 1; then + srcdir=$1 + if cd "$srcdir"; then + srcdir=`pwd` + else + func_fatal_error "Cannot change directory to '$srcdir'." + fi + else + srcdir=$origdir + fi +} + +# The current directory is now $srcdir. + +# Check integrity of package: A configure.in/ac must be present. Sets variable +# - configure_in name of configure.in/ac file. +test -f configure.in || test -f configure.ac || + func_fatal_error "Missing configure.in or configure.ac, please cd to your package first." +configure_in=NONE +if test -f configure.in; then + configure_in=configure.in +else + if test -f configure.ac; then + configure_in=configure.ac + fi +fi + +# Check whether the --force option is needed but has not been specified. +if test $force -eq 0; then + if test -d intl; then + func_fatal_error "intl/ subdirectory exists: use option -f if you really want to delete it." + fi + for podir in $podirs; do + if test -f "$podir/Makefile.in.in"; then + func_fatal_error "$podir/Makefile.in.in exists: use option -f if you really want to delete it." + fi + done + if test -f ABOUT-NLS; then + func_fatal_error "ABOUT-NLS exists: use option -f if you really want to delete it." + fi +fi + +# Select the method for Autoconf macro tracing. func_trace_autoconf +# is more accurate than func_trace_sed, but it only works with +# autoconf >= 2.69. +if echo "AC_PREREQ([2.69])" \ + | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 - 2>&1; then + func_trace=func_trace_autoconf +else + func_trace=func_trace_sed +fi + +# Check in which directory config.rpath etc. belong. +auxdir=`"$func_trace" AC_CONFIG_AUX_DIR "$configure_in"` +if test -n "$auxdir"; then + auxdir="$auxdir/" +fi + +# Check in which directory gettext.m4 etc. belong. +macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR_TRACE "$configure_in"` +if test -z "$macrodirs"; then + macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR "$configure_in"` +fi +for arg in $macrodirs; do + m4dir="$arg" + break +done + +# For simplicity we change to the gettext source directory. +cd "$gettext_datadir" || + func_fatal_error "gettext source directory '${gettext_datadir}' doesn't exist" + +# Variables which keep track what has been modified. +added_directories= +removed_directory= +added_extradist= +added_acoutput= +removed_acoutput=" intl/intlh.inst" + +# Variable: +# - please accumulates instructions for the user. +please= + +# Variable: +# - date current date, for use in ChangeLog entries. +date=`date +%Y-%m-%d` + +# func_copy from to +# copies a file. +# 'from' is a relative pathname, relative to the current directory. +# 'to' is a relative pathname, relative to $srcdir. +func_copy () +{ + if $doit; then + rm -f "$srcdir/$2" + echo "Copying file $2" + cp "$1" "$srcdir/$2" + else + echo "Copy file $2" + fi +} + +# func_linkorcopy from absfrom to +# links or copies a file. +# 'from' is a relative pathname, relative to the current directory. +# 'absfrom' is the corresponding absolute pathname. +# 'to' is a relative pathname, relative to $srcdir. +func_linkorcopy () +{ + if $doit; then + rm -f "$srcdir/$3" + ($try_ln_s && ln -s "$2" "$srcdir/$3" && echo "Symlinking file $3") 2>/dev/null || + { echo "Copying file $3"; cp "$1" "$srcdir/$3"; } + else + if $try_ln_s; then + echo "Symlink file $3" + else + echo "Copy file $3" + fi + fi +} + +# func_backup to +# makes a backup of a file that is about to be overwritten or replaced. +# 'to' is a relative pathname, relative to $srcdir. +func_backup () +{ + if $doit; then + if test -f "$srcdir/$1"; then + rm -f "$srcdir/$1~" + cp -p "$srcdir/$1" "$srcdir/$1~" + fi + fi +} + +# func_remove to +# removes a file. +# 'to' is a relative pathname, relative to $srcdir. +func_remove () +{ + if $doit; then + echo "Removing $1" + rm -f "$srcdir/$1" + else + echo "Remove $1" + fi +} + +# func_ChangeLog_init +# func_ChangeLog_add_entry line +# func_ChangeLog_finish +# manage the ChangeLog file, relative to $srcdir. +func_ChangeLog_init () +{ + modified_ChangeLog= +} +func_ChangeLog_add_entry () +{ + if $doit; then + if test -z "$modified_ChangeLog"; then + echo "$date gettextize " > "$srcdir/ChangeLog.tmp" + echo >> "$srcdir/ChangeLog.tmp" + modified_ChangeLog=yes + fi + echo "$1" >> "$srcdir/ChangeLog.tmp" + else + modified_ChangeLog=yes + fi +} +func_ChangeLog_finish () +{ + if test -n "$modified_ChangeLog"; then + if $doit; then + echo >> "$srcdir/ChangeLog.tmp" + if test -f "$srcdir/ChangeLog"; then + echo "Adding an entry to ChangeLog (backup is in ChangeLog~)" + cat "$srcdir/ChangeLog" >> "$srcdir/ChangeLog.tmp" + rm -f "$srcdir/ChangeLog~" + cp -p "$srcdir/ChangeLog" "$srcdir/ChangeLog~" + else + echo "Creating ChangeLog" + fi + cp "$srcdir/ChangeLog.tmp" "$srcdir/ChangeLog" + rm -f "$srcdir/ChangeLog.tmp" + else + if test -f "$srcdir/ChangeLog"; then + echo "Add an entry to ChangeLog" + else + echo "Create ChangeLog" + fi + fi + fi +} + +# func_poChangeLog_init +# func_poChangeLog_add_entry line +# func_poChangeLog_finish +# manage the $podir/ChangeLog file, relative to $srcdir. +func_poChangeLog_init () +{ + modified_poChangeLog= +} +func_poChangeLog_add_entry () +{ + if $doit; then + if test -z "$modified_poChangeLog"; then + echo "$date gettextize " > "$srcdir/$podir/ChangeLog.tmp" + echo >> "$srcdir/$podir/ChangeLog.tmp" + modified_poChangeLog=yes + fi + echo "$1" >> "$srcdir/$podir/ChangeLog.tmp" + else + modified_poChangeLog=yes + fi +} +func_poChangeLog_finish () +{ + if test -n "$modified_poChangeLog"; then + if $doit; then + echo >> "$srcdir/$podir/ChangeLog.tmp" + if test -f "$srcdir/$podir/ChangeLog"; then + echo "Adding an entry to $podir/ChangeLog (backup is in $podir/ChangeLog~)" + cat "$srcdir/$podir/ChangeLog" >> "$srcdir/$podir/ChangeLog.tmp" + rm -f "$srcdir/$podir/ChangeLog~" + cp -p "$srcdir/$podir/ChangeLog" "$srcdir/$podir/ChangeLog~" + else + echo "Creating $podir/ChangeLog" + fi + cp "$srcdir/$podir/ChangeLog.tmp" "$srcdir/$podir/ChangeLog" + rm -f "$srcdir/$podir/ChangeLog.tmp" + else + if test -f "$srcdir/$podir/ChangeLog"; then + echo "Add an entry to $podir/ChangeLog" + else + echo "Create $podir/ChangeLog" + fi + fi + fi +} + +# func_m4ChangeLog_init +# func_m4ChangeLog_add_entry line +# func_m4ChangeLog_finish +# manage the $m4dir/ChangeLog file, relative to $srcdir. +func_m4ChangeLog_init () +{ + if test -n "$using_m4ChangeLog"; then + modified_m4ChangeLog= + created_m4ChangeLog= + fi +} +func_m4ChangeLog_add_entry () +{ + if test -n "$using_m4ChangeLog"; then + if $doit; then + if test -z "$modified_m4ChangeLog"; then + echo "$date gettextize " > "$srcdir/$m4dir/ChangeLog.tmp" + echo >> "$srcdir/$m4dir/ChangeLog.tmp" + modified_m4ChangeLog=yes + fi + echo "$1" >> "$srcdir/$m4dir/ChangeLog.tmp" + else + modified_m4ChangeLog=yes + fi + else + line="$1" + line=`echo "$line" | sed -e "s%^ \\* % * $m4dir/%"` + func_ChangeLog_add_entry "$line" + fi +} +func_m4ChangeLog_finish () +{ + if test -n "$using_m4ChangeLog"; then + if test -n "$modified_m4ChangeLog"; then + if $doit; then + echo >> "$srcdir/$m4dir/ChangeLog.tmp" + if test -f "$srcdir/$m4dir/ChangeLog"; then + echo "Adding an entry to $m4dir/ChangeLog (backup is in $m4dir/ChangeLog~)" + cat "$srcdir/$m4dir/ChangeLog" >> "$srcdir/$m4dir/ChangeLog.tmp" + rm -f "$srcdir/$m4dir/ChangeLog~" + cp -p "$srcdir/$m4dir/ChangeLog" "$srcdir/$m4dir/ChangeLog~" + else + echo "Creating $m4dir/ChangeLog" + created_m4ChangeLog=yes + fi + cp "$srcdir/$m4dir/ChangeLog.tmp" "$srcdir/$m4dir/ChangeLog" + rm -f "$srcdir/$m4dir/ChangeLog.tmp" + else + if test -f "$srcdir/$m4dir/ChangeLog"; then + echo "Add an entry to $m4dir/ChangeLog" + else + echo "Create $m4dir/ChangeLog" + created_m4ChangeLog=yes + fi + fi + fi + fi +} +using_m4ChangeLog=yes + +if test ! -f "$srcdir/intl/Makefile.in" && test -n "$intldir"; then + added_acoutput="$added_acoutput intl/Makefile" +fi +if test -f "$srcdir/intl/Makefile.in" && test -z "$intldir"; then + removed_acoutput="$removed_acoutput intl/Makefile" +fi +if test -d "$srcdir/intl"; then + # Remove everything inside intl except for RCS and CVS subdirs and invisible + # files. + if $doit; then + echo "Wiping out intl/ subdirectory" + (cd "$srcdir/intl" && + for f in *; do + if test CVS != "$f" && test RCS != "$f"; then + rm -rf "$f" + fi + done) + else + echo "Wipe out intl/ subdirectory" + fi + if test -z "$intldir"; then + removed_directory=intl + fi +else + if test -n "$intldir"; then + if $doit; then + echo "Creating intl/ subdirectory" + mkdir "$srcdir/intl" || func_fatal_error "failed to create intl/ subdirectory" + else + echo "Create intl/ subdirectory" + fi + added_directories="$added_directories intl" + fi +fi + +$do_changelog && func_ChangeLog_init + +for podir in $podirs; do + test -d "$srcdir/$podir" || { + if $doit; then + echo "Creating $podir/ subdirectory" + mkdir "$srcdir/$podir" || func_fatal_error "failed to create $podir/ subdirectory" + else + echo "Create $podir/ subdirectory" + fi + added_directories="$added_directories $podir" + } +done + +# Create the directory for config.rpath, if needed. +# This is for consistency with autoreconf and automake. +# Note that $auxdir is either empty or ends in a slash. +test -d "$srcdir/$auxdir" || { + if $doit; then + echo "Creating $auxdir subdirectory" + mkdir "$srcdir/$auxdir" || func_fatal_error "failed to create $auxdir subdirectory" + else + echo "Create $auxdir subdirectory" + fi +} + +# Now copy all files. Take care for the destination directories. +for file in *; do + case $file in + ABOUT-NLS) + func_linkorcopy $file "$gettext_datadir/$file" $file + ;; + config.rpath) + if test -f "$srcdir/$auxdir$file"; then + : + else + added_extradist="$added_extradist $auxdir$file" + fi + func_linkorcopy $file "$gettext_datadir/$file" "$auxdir$file" + ;; + esac +done + +# Copy files to intl/ subdirectory. +if test -n "$intldir"; then + cd intl + for file in *; do + if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then + if test $file != plural.c; then + func_linkorcopy $file "$gettext_datadir/intl/$file" intl/$file + else + # plural.c is a generated file; it must be copied and touched. + func_copy $file intl/$file + if $doit; then + (sleep 2; touch "$srcdir/intl/$file") & + fi + fi + fi + done + cd .. +else + echo "Not copying intl/ directory." + # Tell the user what to put into configure.ac, if it is not already there. + external= + # Need to use func_trace_sed instead of $func_trace, since + # AM_GNU_GETTEXT is not a standard Autoconf trace. + xargs=`func_trace_sed AM_GNU_GETTEXT "$srcdir/$configure_in"` + save_IFS="$IFS"; IFS=: + for arg in $xargs; do + if test 'external' = "$arg"; then + external=yes + break + fi + done + IFS="$save_IFS" + if test -z "$external"; then + please="$please +Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration +to look for an external libintl. +" + fi +fi + +# Copy files to po/ subdirectory. +cd po +for podir in $podirs; do + $do_changelog && func_poChangeLog_init + for file in Makefile.in.in; do + same=no + if test -f "$srcdir/$podir/$file"; then + if cmp -s $file "$srcdir/$podir/$file"; then + same=yes + fi + else + added_acoutput="$added_acoutput $podir/Makefile.in" + fi + if $do_changelog && test $same = no; then + if test -f "$srcdir/$podir/$file"; then + func_poChangeLog_add_entry " * $file: Upgrade to gettext-${version}." + else + func_poChangeLog_add_entry " * $file: New file, from gettext-${version}." + fi + fi + func_backup "$podir/$file" + func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file" + done + for file in *; do + case $file in + Makefile.in.in) + # Already handled above. + ;; + Makevars.template) + func_linkorcopy Makevars.template "$gettext_datadir/po/Makevars.template" "$podir/Makevars.template" + if test -f "$srcdir/po/Makevars"; then + LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/$podir/Makevars" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp1" + LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/$podir/Makevars.template" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp2" + missingvars=`LC_ALL=C comm -13 "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"` + rm -f "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2" + if test -n "$missingvars"; then + please="$please +Please update $podir/Makevars so that it defines all the variables mentioned +in $podir/Makevars.template. +You can then remove $podir/Makevars.template. +" + fi + else + please="$please +Please create $podir/Makevars from the template in $podir/Makevars.template. +You can then remove $podir/Makevars.template. +" + fi + ;; + *) + same=no + if test -f "$srcdir/$podir/$file"; then + if cmp -s $file "$srcdir/$podir/$file"; then + same=yes + fi + fi + if $do_changelog && test $same = no; then + if test -f "$srcdir/$podir/$file"; then + func_poChangeLog_add_entry " * $file: Upgrade to gettext-${version}." + else + func_poChangeLog_add_entry " * $file: New file, from gettext-${version}." + fi + fi + func_backup "$podir/$file" + func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file" + ;; + esac + done + if test -f "$srcdir/$podir/cat-id-tbl.c"; then + func_remove "$podir/cat-id-tbl.c" + $do_changelog && func_poChangeLog_add_entry " * cat-id-tbl.c: Remove file." + fi + if test -f "$srcdir/$podir/stamp-cat-id"; then + func_remove "$podir/stamp-cat-id" + $do_changelog && func_poChangeLog_add_entry " * stamp-cat-id: Remove file." + fi + if test ! -f "$srcdir/$podir/POTFILES.in"; then + if $doit; then + echo "Creating initial $podir/POTFILES.in" + echo '# List of source files which contain translatable strings.' > "$srcdir/$podir/POTFILES.in" + else + echo "Create initial $podir/POTFILES.in" + fi + $do_changelog && func_poChangeLog_add_entry " * POTFILES.in: New file." + please="$please +Please fill $podir/POTFILES.in as described in the documentation. +" + fi + $do_changelog && func_poChangeLog_finish +done + +# Determine whether we can assume automake 1.9 or newer. +have_automake19= +if (aclocal --version) >/dev/null 2>/dev/null; then + aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'` + case $aclocal_version in + 1.9* | 1.[1-9][0-9]* | [2-9]*) have_automake19=yes ;; + esac +fi + +m4filelist='gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 + po.m4 progtest.m4' +# With aclocal versions < 1.9 we need all m4 files, otherwise "aclocal -I m4" +# might give an error. (aclocal < 1.9 didn't know which macros are really +# needed, it looked which macros are potentially needed.) +min_automake_version=1.9 +if test -n "$intldir" || test -z "$have_automake19"; then + # Add intldir.m4, intl.m4 and its dependencies. + m4filelist=$m4filelist' codeset.m4 fcntl-o.m4 glibc2.m4 glibc21.m4 intdiv0.m4 + intl.m4 intldir.m4 intlmacosx.m4 intmax.m4 inttypes_h.m4 inttypes-pri.m4 + lcmessage.m4 lock.m4 longlong.m4 printf-posix.m4 size_max.m4 stdint_h.m4 + threadlib.m4 uintmax_t.m4 visibility.m4 wchar_t.m4 wint_t.m4 xsize.m4' + min_automake_version=1.8 +fi + +# All sorts of bugs could occur if the configure file was remade with the wrong +# version of gettext.m4 et al. (because then the configure and the po/Makefile.in.in +# don't fit together). It is therefore important that the package carries the +# right versions of gettext.m4 et al. with it. +if test -f "$srcdir/Makefile.am"; then + # A package using automake. + + # Determine whether it's using automake 1.8 or newer. + have_automake18= + if (aclocal --version) >/dev/null 2>/dev/null; then + aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'` + case $aclocal_version in + 1.[8-9]* | 1.[1-9][0-9]* | [2-9]*) have_automake18=yes ;; + esac + fi + + if test -z "$m4dir"; then + # Extract the macro directory name from Makefile.am. + aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'` + m4dir_is_next= + for arg in $aclocal_amflags; do + if test -n "$m4dir_is_next"; then + # Ignore absolute directory pathnames, like /usr/local/share/aclocal. + case "$arg" in + /*) ;; + *) + test -z "$m4dir" || m4dir="$arg" + macrodirs="$macrodirs $arg" + ;; + esac + m4dir_is_next= + else + if test "X$arg" = "X-I"; then + m4dir_is_next=yes + else + m4dir_is_next= + fi + fi + done + for arg in $macrodirs; do + m4dir="$arg" + break + done + fi + + if test -z "$m4dir"; then + m4dir=m4 + m4dir_defaulted=yes + fi + + # Decide whether to use $m4dir/ChangeLog, or to use ChangeLog instead. + if test -d "$srcdir/$m4dir" && test -f "$srcdir/ChangeLog" && test ! -f "$srcdir/$m4dir/ChangeLog"; then + # The programmer has no $m4dir/ChangeLog so far. Don't introduce one. + using_m4ChangeLog= + fi + + # Update the *.m4 files and the corresponding Makefile.am. + $do_changelog && func_m4ChangeLog_init + added_m4dir= + added_m4files= + if test -d "$srcdir/$m4dir"; then + : + else + if $doit; then + echo "Creating directory $m4dir" + mkdir "$srcdir/$m4dir" + else + echo "Create directory $m4dir" + fi + added_m4dir=yes + fi + for file in $m4filelist; do + same=no + if test -f "$srcdir/$m4dir/$file"; then + if cmp -s "${datarootdir}/aclocal/$file" "$srcdir/$m4dir/$file"; then + same=yes + fi + else + added_m4files="$added_m4files $file" + fi + if $do_changelog && test $same = no; then + if test -f "$srcdir/$m4dir/$file"; then + func_m4ChangeLog_add_entry " * $file: Upgrade to gettext-${version}." + else + func_m4ChangeLog_add_entry " * $file: New file, from gettext-${version}." + fi + fi + func_backup "$m4dir/$file" + func_linkorcopy "${datarootdir}/aclocal/$file" "${datarootdir}/aclocal/$file" "$m4dir/$file" + done + missing_m4Makefileam= + if test -n "$added_m4files"; then + if test -f "$srcdir/$m4dir/Makefile.am"; then + if $doit; then + echo "Updating EXTRA_DIST in $m4dir/Makefile.am (backup is in $m4dir/Makefile.am~)" + func_backup "$m4dir/Makefile.am" + rm -f "$srcdir/$m4dir/Makefile.am" + if grep '^EXTRA_DIST[ ]*=' "$srcdir/$m4dir/Makefile.am~" > /dev/null; then + sed -e "s%^\(EXTRA_DIST[ ]*=\) \\?%\\1$added_m4files %" < "$srcdir/$m4dir/Makefile.am~" > "$srcdir/$m4dir/Makefile.am" + $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): Add the new files." + else + (cat "$srcdir/$m4dir/Makefile.am~"; echo; echo "EXTRA_DIST =$added_m4files") > "$srcdir/$m4dir/Makefile.am" + $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): New variable." + fi + else + echo "Update EXTRA_DIST in $m4dir/Makefile.am" + $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST)." + fi + else + # $m4dir/Makefile.am is not needed any more when aclocal 1.8 or newer + # is used. + if test -z "$have_automake18"; then + if $doit; then + echo "Creating $m4dir/Makefile.am" + echo "EXTRA_DIST =$added_m4files" > "$srcdir/$m4dir/Makefile.am" + else + echo "Create $m4dir/Makefile.am" + fi + $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am: New file." + added_acoutput="$added_acoutput $m4dir/Makefile" + else + missing_m4Makefileam=yes + fi + fi + fi + if test -n "$added_m4dir" && test -z "$missing_m4Makefileam"; then + added_directories="$added_directories $m4dir" + fi + $do_changelog && func_m4ChangeLog_finish + # automake will arrange for $m4dir/ChangeLog to be distributed if a + # $m4dir/Makefile.am exists. If not, we need to add it to Makefile.am's + # EXTRA_DIST explicitly. + if test -n "$created_m4ChangeLog" && test -n "$missing_m4Makefileam"; then + added_extradist="$added_extradist $m4dir/ChangeLog" + fi + + # Update the top-level Makefile.am. + modified_Makefile_am= + # func_modify_Makefile_am changelog_comment + # assumes a modified copy of $srcdir/Makefile.am in $srcdir/Makefile.am.tmp + # and replaces the original Makefile.am file with the modified one if + # the two files differ. Then it removes the modified copy. + func_modify_Makefile_am () + { + if cmp -s "$srcdir/Makefile.am" "$srcdir/Makefile.am.tmp"; then + : + else + if test -z "$modified_Makefile_am"; then + if $doit; then + echo "Updating Makefile.am (backup is in Makefile.am~)" + func_backup Makefile.am + else + echo "Update Makefile.am" + fi + fi + if $doit; then + rm -f "$srcdir/Makefile.am" + cp "$srcdir/Makefile.am.tmp" "$srcdir/Makefile.am" + fi + if $do_changelog; then + if test -z "$modified_Makefile_am"; then + func_ChangeLog_add_entry " * Makefile.am $1" + else + func_ChangeLog_add_entry " $1" + fi + fi + modified_Makefile_am=yes + fi + rm -f "$srcdir/Makefile.am.tmp" + } + + if test -n "$added_directories"; then + if grep '^SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then + sed -e "s%^\(SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp" + added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'` + func_modify_Makefile_am "(SUBDIRS): Add $added_directories_pretty." + else + (cat "$srcdir/Makefile.am"; echo; echo "SUBDIRS =$added_directories") > "$srcdir/Makefile.am.tmp" + func_modify_Makefile_am "(SUBDIRS): New variable." + fi + fi + if test -n "$removed_directory"; then + sed -e '/^SUBDIRS[ ]*=/ { + :a + s%\([ ]\)'"$removed_directory"'[ ]%\1% + s%[ ]'"$removed_directory"'$%% + tb + :b + s%\\$%\\% + tc + bd + :c + n + ba + :d + }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp" + func_modify_Makefile_am "(SUBDIRS): Remove $removed_directory." + fi + if test -n "$added_directories"; then + if grep '^DIST_SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then + sed -e "s%^\(DIST_SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp" + added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'` + func_modify_Makefile_am "(DIST_SUBDIRS): Add $added_directories_pretty." + fi + fi + if test -n "$removed_directory"; then + sed -e '/^DIST_SUBDIRS[ ]*=/ { + :a + s%\([ ]\)'"$removed_directory"'[ ]%\1% + s%[ ]'"$removed_directory"'$%% + tb + :b + s%\\$%\\% + tc + bd + :c + n + ba + :d + }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp" + func_modify_Makefile_am "(DIST_SUBDIRS): Remove $removed_directory." + fi + if test -n "$m4dir_defaulted"; then + if grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then + sed -e "s%^\(ACLOCAL_AMFLAGS[ ]*=\) \\?%\\1 -I $m4dir %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp" + func_modify_Makefile_am "(ACLOCAL_AMFLAGS): Add -I $m4dir." + else + (cat "$srcdir/Makefile.am"; echo; echo "ACLOCAL_AMFLAGS = -I $m4dir") > "$srcdir/Makefile.am.tmp" + func_modify_Makefile_am "(ACLOCAL_AMFLAGS): New variable." + fi + # Also update Makefile.in and, if existent, Makefile. Otherwise they + # would take into account the new flags only after a few rounds of + # "./configure", "make", "touch configure.in", "make distclean". + if $doit; then + for file in Makefile.in Makefile; do + if test -f "$srcdir/$file"; then + func_backup $file + rm -f "$srcdir/$file" + sed -e "s%(ACLOCAL)%(ACLOCAL) -I $m4dir%" < "$srcdir/$file~" > "$srcdir/$file" + fi + done + fi + fi + if test -n "$added_extradist"; then + if grep '^EXTRA_DIST[ ]*=' "$srcdir/Makefile.am" > /dev/null; then + sed -e "s%^\(EXTRA_DIST[ ]*=\)%\\1$added_extradist %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp" + added_extradist_pretty=`echo $added_extradist | sed -e 's/ /, /g'` + func_modify_Makefile_am "(EXTRA_DIST): Add $added_extradist_pretty." + else + (cat "$srcdir/Makefile.am"; echo; echo "EXTRA_DIST =$added_extradist") > "$srcdir/Makefile.am.tmp" + func_modify_Makefile_am "(EXTRA_DIST): New variable." + fi + fi + # Extract the aclocal options name from Makefile.am. + aclocal_options= + for arg in $macrodirs; do + aclocal_options="$aclocal_options -I $arg" + done + please="$please +Please run 'aclocal$aclocal_options' to regenerate the aclocal.m4 file. +You need aclocal from GNU automake $min_automake_version (or newer) to do this. +Then run 'autoconf' to regenerate the configure file. +" + + # Also create $m4dir/Makefile.in from $m4dir/Makefile.am, because automake + # doesn't do it by itself. + if $doit; then + case "$added_acoutput" in + *" $m4dir/Makefile") + (cd "$srcdir" && automake "$m4dir/Makefile") 2>/dev/null || + please="$please +Please run 'automake $m4dir/Makefile' to create $m4dir/Makefile.in +" + ;; + esac + fi +else + please="$please +Please add the files +$m4filelist +from the ${datarootdir}/aclocal directory to your aclocal.m4 file. +" +fi + +modified_configure_in= +# func_modify_configure_in changelog_comment +# assumes a modified copy of $srcdir/$configure_in in $srcdir/$configure_in.tmp +# and replaces the original configure.in/ac file with the modified one if +# the two files differ. Then it removes the modified copy. +func_modify_configure_in () +{ + if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then + : + else + if test -z "$modified_configure_in"; then + if $doit; then + echo "Updating $configure_in (backup is in $configure_in~)" + func_backup $configure_in + else + echo "Update $configure_in" + fi + fi + if $doit; then + rm -f "$srcdir/$configure_in" + cp "$srcdir/$configure_in.tmp" "$srcdir/$configure_in" + fi + if $do_changelog; then + if test -z "$modified_configure_in"; then + func_ChangeLog_add_entry " * $configure_in $1" + else + func_ChangeLog_add_entry " $1" + fi + fi + modified_configure_in=yes + fi + rm -f "$srcdir/$configure_in.tmp" +} + +if test -n "$added_acoutput"; then + if grep '^AC_CONFIG_FILES(' "$srcdir/$configure_in" > /dev/null; then + sedprog=' +ta +b +:a +n +ba' + sed -e "s%^\\(AC_CONFIG_FILES([^])\\,]*\\)%\\1$added_acoutput%$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" + added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'` + func_modify_configure_in "(AC_CONFIG_FILES): Add $added_acoutput_pretty." + else + if grep '^AC_OUTPUT(' "$srcdir/$configure_in" > /dev/null; then + sed -e "s%^\\(AC_OUTPUT([^])\\,]*\\)%\\1$added_acoutput%" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" + added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'` + func_modify_configure_in "(AC_OUTPUT): Add $added_acoutput_pretty." + else + please="$please +Please add$added_acoutput to the AC_OUTPUT or AC_CONFIG_FILES invocation in the $configure_in file. +" + fi + fi +fi +if test -n "$removed_acoutput"; then + for file in $removed_acoutput; do + tag= + sedprog='{ + s%\([[ ]\)'"$file"'[ ]%\1% + s%\([[ ]\)'"$file"'\([]),]\)%\1\2% + s%[[ ]'"$file"'$%% + :a + tb + :b + s%\\$%\\% + tc + bd + :c + n + s%\([ ]\)'"$file"'[ ]%\1% + s%\([ ]\)'"$file"'\([]),]\)%\1\2% + s%[ ]'"$file"'$%% + ba + :d + }' + sed -e '/^AC_CONFIG_FILES(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" + if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then + sed -e '/^AC_OUTPUT(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" + if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then + : + else + tag=AC_OUTPUT + fi + else + tag=AC_CONFIG_FILES + fi + if test -n "$tag"; then + func_modify_configure_in "($tag): Remove $file." + else + rm -f "$srcdir/$configure_in.tmp" + if test "$file" != intl/intlh.inst; then + please="$please +Please remove $file from the AC_OUTPUT or AC_CONFIG_FILES invocation +in the $configure_in file. +" + fi + fi + done +fi +sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *%%' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" +func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile." +sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" +func_modify_configure_in "(AC_LINK_FILES): Remove invocation." +# AM_GNU_GETTEXT_VERSION may not be present, when AM_GNU_GETTEXT_REQUIRE_VERSION is used. +if grep '^AM_GNU_GETTEXT_VERSION(' "$srcdir/$configure_in" 2>&1 >/dev/null; then + sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp" + func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version." +fi +$do_changelog && func_ChangeLog_finish + +# Recommend replacement for deprecated Makefile variables. +use_libtool=`cat "$srcdir/$configure_in" | grep '^A[CM]_PROG_LIBTOOL'` +for file in `(cd "$srcdir"; find . -name Makefile.am -print; find . -name Makefile.in -print) | sed -e 's,^\./,,'`; do + if test -f "$srcdir/$file"; then + if test `echo "$file" | sed -e 's,^.*/,,'` = Makefile.in && grep automake "$srcdir/$file" >/dev/null 2>&1; then + continue; + fi + # INTLLIBS is deprecated because it doesn't distinguish the two + # cases: with libtool, without libtool. + if grep '@''INTLLIBS''@' "$srcdir/$file" >/dev/null 2>&1; then + if test -n "$use_libtool"; then + please="$please +Please change $file to use @""LTLIBINTL""@ or @""LIBINTL""@ instead of +@""INTLLIBS""@. Which one, depends whether it is used with libtool or not. +@""INTLLIBS""@ will go away. +" + else + please="$please +Please change $file to use @""LIBINTL""@ instead of @""INTLLIBS""@. +@""INTLLIBS""@ will go away. +" + fi + fi + # DATADIRNAME is deprecated because we install only .gmo files nowadays, + # which can be stored in the platform independent $prefix/share hierarchy. + if grep '@''DATADIRNAME''@' "$srcdir/$file" >/dev/null 2>&1; then + please="$please +Please change $file to use the constant string \"share\" instead of +@""DATADIRNAME""@. @""DATADIRNAME""@ will go away. +" + fi + # INSTOBJEXT is deprecated because we install only .gmo files nowadays, + # no catgets .cat catalogs. + if grep '@''INSTOBJEXT''@' "$srcdir/$file" >/dev/null 2>&1; then + please="$please +Please change $file to use the constant string \".mo\" instead of +@""INSTOBJEXT""@. @""INSTOBJEXT""@ will go away. +" + fi + # GENCAT is deprecated because we install no catgets catalogs anymore. + if grep '@''GENCAT''@' "$srcdir/$file" >/dev/null 2>&1; then + please="$please +Please change $file to use the constant string \"gencat\" instead of +@""GENCAT""@. @""GENCAT""@ will go away. Maybe you don't even need it any more? +" + fi + # POSUB is deprecated because it causes "./configure --disable-nls", "make", + # "make dist" to create a buggy tarfile. + if grep '@''POSUB''@' "$srcdir/$file" >/dev/null 2>&1; then + please="$please +Please change $file to use the constant string \"po\" instead of +@""POSUB""@. @""POSUB""@ will go away. +" + fi + fi +done + +# Recommend replacement for deprecated configure variables. +if grep '\$nls_cv_header_' "$srcdir/$configure_in" >/dev/null 2>&1; then + please="$please +Please stop using \$nls_cv_header_intl or \$nls_cv_header_libgt in the +$configure_in file. Both will go away. Use or \"gettext.h\" instead. +" +fi + +# Recommend fetching config.guess and config.sub. +if test -f "$srcdir/$auxdir"config.guess && test -f "$srcdir/$auxdir"config.sub; then + : +else + please="$please +You will also need config.guess and config.sub, which you can get from the CVS +of the 'config' project at http://savannah.gnu.org/. The commands to fetch them +are +\$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess' +\$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub' +" +fi + +if $doit; then + echo "$please" + echo "You might also want to copy the convenience header file gettext.h" + echo "from the $gettext_datadir directory into your package." + echo "It is a wrapper around that implements the configure --disable-nls" + echo "option." + echo + count=`echo "$please" | grep '^$' | wc -l` + count=`echo "$count" | sed -e 's/[ ]//g'` + case "$count" in + 1) count="paragraph";; + 2) count="two paragraphs";; + 3) count="three paragraphs";; + 4) count="four paragraphs";; + 5) count="five paragraphs";; + *) count="$count paragraphs";; + esac + echo "Press Return to acknowledge the previous $count." + # Read from /dev/tty, not stdin, so that gettextize cannot be abused by + # non-interactive tools. + read dummy < /dev/tty +fi + +exit 0 diff --git a/msys/mingw/bin/git-lfs.exe b/msys/mingw/bin/git-lfs.exe new file mode 100644 index 000000000..526465fe4 Binary files /dev/null and b/msys/mingw/bin/git-lfs.exe differ diff --git a/msys/mingw/bin/git-receive-pack.exe b/msys/mingw/bin/git-receive-pack.exe new file mode 100644 index 000000000..f0a6aa3fd Binary files /dev/null and b/msys/mingw/bin/git-receive-pack.exe differ diff --git a/msys/mingw/bin/git-upload-archive.exe b/msys/mingw/bin/git-upload-archive.exe new file mode 100644 index 000000000..f0a6aa3fd Binary files /dev/null and b/msys/mingw/bin/git-upload-archive.exe differ diff --git a/msys/mingw/bin/git-upload-pack.exe b/msys/mingw/bin/git-upload-pack.exe new file mode 100644 index 000000000..289e8af47 Binary files /dev/null and b/msys/mingw/bin/git-upload-pack.exe differ diff --git a/msys/mingw/bin/gitk b/msys/mingw/bin/gitk new file mode 100644 index 000000000..d1d77d832 --- /dev/null +++ b/msys/mingw/bin/gitk @@ -0,0 +1,12645 @@ +#!/bin/sh +# Tcl ignores the next line -*- tcl -*- \ +exec wish "$0" -- "$@" + +# Copyright © 2005-2016 Paul Mackerras. All rights reserved. +# This program is free software; it may be used, copied, modified +# and distributed under the terms of the GNU General Public Licence, +# either version 2, or (at your option) any later version. + +package require Tk + +proc hasworktree {} { + return [expr {[exec git rev-parse --is-bare-repository] == "false" && + [exec git rev-parse --is-inside-git-dir] == "false"}] +} + +proc reponame {} { + global gitdir + set n [file normalize $gitdir] + if {[string match "*/.git" $n]} { + set n [string range $n 0 end-5] + } + return [file tail $n] +} + +proc gitworktree {} { + variable _gitworktree + if {[info exists _gitworktree]} { + return $_gitworktree + } + # v1.7.0 introduced --show-toplevel to return the canonical work-tree + if {[catch {set _gitworktree [exec git rev-parse --show-toplevel]}]} { + # try to set work tree from environment, core.worktree or use + # cdup to obtain a relative path to the top of the worktree. If + # run from the top, the ./ prefix ensures normalize expands pwd. + if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} { + catch {set _gitworktree [exec git config --get core.worktree]} + if {$_gitworktree eq ""} { + set _gitworktree [file normalize ./[exec git rev-parse --show-cdup]] + } + } + } + return $_gitworktree +} + +# A simple scheduler for compute-intensive stuff. +# The aim is to make sure that event handlers for GUI actions can +# run at least every 50-100 ms. Unfortunately fileevent handlers are +# run before X event handlers, so reading from a fast source can +# make the GUI completely unresponsive. +proc run args { + global isonrunq runq currunq + + set script $args + if {[info exists isonrunq($script)]} return + if {$runq eq {} && ![info exists currunq]} { + after idle dorunq + } + lappend runq [list {} $script] + set isonrunq($script) 1 +} + +proc filerun {fd script} { + fileevent $fd readable [list filereadable $fd $script] +} + +proc filereadable {fd script} { + global runq currunq + + fileevent $fd readable {} + if {$runq eq {} && ![info exists currunq]} { + after idle dorunq + } + lappend runq [list $fd $script] +} + +proc nukefile {fd} { + global runq + + for {set i 0} {$i < [llength $runq]} {} { + if {[lindex $runq $i 0] eq $fd} { + set runq [lreplace $runq $i $i] + } else { + incr i + } + } +} + +proc dorunq {} { + global isonrunq runq currunq + + set tstart [clock clicks -milliseconds] + set t0 $tstart + while {[llength $runq] > 0} { + set fd [lindex $runq 0 0] + set script [lindex $runq 0 1] + set currunq [lindex $runq 0] + set runq [lrange $runq 1 end] + set repeat [eval $script] + unset currunq + set t1 [clock clicks -milliseconds] + set t [expr {$t1 - $t0}] + if {$repeat ne {} && $repeat} { + if {$fd eq {} || $repeat == 2} { + # script returns 1 if it wants to be readded + # file readers return 2 if they could do more straight away + lappend runq [list $fd $script] + } else { + fileevent $fd readable [list filereadable $fd $script] + } + } elseif {$fd eq {}} { + unset isonrunq($script) + } + set t0 $t1 + if {$t1 - $tstart >= 80} break + } + if {$runq ne {}} { + after idle dorunq + } +} + +proc reg_instance {fd} { + global commfd leftover loginstance + + set i [incr loginstance] + set commfd($i) $fd + set leftover($i) {} + return $i +} + +proc unmerged_files {files} { + global nr_unmerged + + # find the list of unmerged files + set mlist {} + set nr_unmerged 0 + if {[catch { + set fd [open "| git ls-files -u" r] + } err]} { + show_error {} . "[mc "Couldn't get list of unmerged files:"] $err" + exit 1 + } + while {[gets $fd line] >= 0} { + set i [string first "\t" $line] + if {$i < 0} continue + set fname [string range $line [expr {$i+1}] end] + if {[lsearch -exact $mlist $fname] >= 0} continue + incr nr_unmerged + if {$files eq {} || [path_filter $files $fname]} { + lappend mlist $fname + } + } + catch {close $fd} + return $mlist +} + +proc parseviewargs {n arglist} { + global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env + global vinlinediff + global worddiff git_version + + set vdatemode($n) 0 + set vmergeonly($n) 0 + set vinlinediff($n) 0 + set glflags {} + set diffargs {} + set nextisval 0 + set revargs {} + set origargs $arglist + set allknown 1 + set filtered 0 + set i -1 + foreach arg $arglist { + incr i + if {$nextisval} { + lappend glflags $arg + set nextisval 0 + continue + } + switch -glob -- $arg { + "-d" - + "--date-order" { + set vdatemode($n) 1 + # remove from origargs in case we hit an unknown option + set origargs [lreplace $origargs $i $i] + incr i -1 + } + "-[puabwcrRBMC]" - + "--no-renames" - "--full-index" - "--binary" - "--abbrev=*" - + "--find-copies-harder" - "-l*" - "--ext-diff" - "--no-ext-diff" - + "--src-prefix=*" - "--dst-prefix=*" - "--no-prefix" - + "-O*" - "--text" - "--full-diff" - "--ignore-space-at-eol" - + "--ignore-space-change" - "-U*" - "--unified=*" { + # These request or affect diff output, which we don't want. + # Some could be used to set our defaults for diff display. + lappend diffargs $arg + } + "--raw" - "--patch-with-raw" - "--patch-with-stat" - + "--name-only" - "--name-status" - "--color" - + "--log-size" - "--pretty=*" - "--decorate" - "--abbrev-commit" - + "--cc" - "-z" - "--header" - "--parents" - "--boundary" - + "--no-color" - "-g" - "--walk-reflogs" - "--no-walk" - + "--timestamp" - "relative-date" - "--date=*" - "--stdin" - + "--objects" - "--objects-edge" - "--reverse" { + # These cause our parsing of git log's output to fail, or else + # they're options we want to set ourselves, so ignore them. + } + "--color-words*" - "--word-diff=color" { + # These trigger a word diff in the console interface, + # so help the user by enabling our own support + if {[package vcompare $git_version "1.7.2"] >= 0} { + set worddiff [mc "Color words"] + } + } + "--word-diff*" { + if {[package vcompare $git_version "1.7.2"] >= 0} { + set worddiff [mc "Markup words"] + } + } + "--stat=*" - "--numstat" - "--shortstat" - "--summary" - + "--check" - "--exit-code" - "--quiet" - "--topo-order" - + "--full-history" - "--dense" - "--sparse" - + "--follow" - "--left-right" - "--encoding=*" { + # These are harmless, and some are even useful + lappend glflags $arg + } + "--diff-filter=*" - "--no-merges" - "--unpacked" - + "--max-count=*" - "--skip=*" - "--since=*" - "--after=*" - + "--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" - + "--author=*" - "--committer=*" - "--grep=*" - "-[iE]" - + "--remove-empty" - "--first-parent" - "--cherry-pick" - + "-S*" - "-G*" - "--pickaxe-all" - "--pickaxe-regex" - + "--simplify-by-decoration" { + # These mean that we get a subset of the commits + set filtered 1 + lappend glflags $arg + } + "-L*" { + # Line-log with 'stuck' argument (unstuck form is + # not supported) + set filtered 1 + set vinlinediff($n) 1 + set allknown 0 + lappend glflags $arg + } + "-n" { + # This appears to be the only one that has a value as a + # separate word following it + set filtered 1 + set nextisval 1 + lappend glflags $arg + } + "--not" - "--all" { + lappend revargs $arg + } + "--merge" { + set vmergeonly($n) 1 + # git rev-parse doesn't understand --merge + lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD + } + "--no-replace-objects" { + set env(GIT_NO_REPLACE_OBJECTS) "1" + } + "-*" { + # Other flag arguments including - + if {[string is digit -strict [string range $arg 1 end]]} { + set filtered 1 + } else { + # a flag argument that we don't recognize; + # that means we can't optimize + set allknown 0 + } + lappend glflags $arg + } + default { + # Non-flag arguments specify commits or ranges of commits + if {[string match "*...*" $arg]} { + lappend revargs --gitk-symmetric-diff-marker + } + lappend revargs $arg + } + } + } + set vdflags($n) $diffargs + set vflags($n) $glflags + set vrevs($n) $revargs + set vfiltered($n) $filtered + set vorigargs($n) $origargs + return $allknown +} + +proc parseviewrevs {view revs} { + global vposids vnegids + + if {$revs eq {}} { + set revs HEAD + } elseif {[lsearch -exact $revs --all] >= 0} { + lappend revs HEAD + } + if {[catch {set ids [eval exec git rev-parse $revs]} err]} { + # we get stdout followed by stderr in $err + # for an unknown rev, git rev-parse echoes it and then errors out + set errlines [split $err "\n"] + set badrev {} + for {set l 0} {$l < [llength $errlines]} {incr l} { + set line [lindex $errlines $l] + if {!([string length $line] == 40 && [string is xdigit $line])} { + if {[string match "fatal:*" $line]} { + if {[string match "fatal: ambiguous argument*" $line] + && $badrev ne {}} { + if {[llength $badrev] == 1} { + set err "unknown revision $badrev" + } else { + set err "unknown revisions: [join $badrev ", "]" + } + } else { + set err [join [lrange $errlines $l end] "\n"] + } + break + } + lappend badrev $line + } + } + error_popup "[mc "Error parsing revisions:"] $err" + return {} + } + set ret {} + set pos {} + set neg {} + set sdm 0 + foreach id [split $ids "\n"] { + if {$id eq "--gitk-symmetric-diff-marker"} { + set sdm 4 + } elseif {[string match "^*" $id]} { + if {$sdm != 1} { + lappend ret $id + if {$sdm == 3} { + set sdm 0 + } + } + lappend neg [string range $id 1 end] + } else { + if {$sdm != 2} { + lappend ret $id + } else { + lset ret end $id...[lindex $ret end] + } + lappend pos $id + } + incr sdm -1 + } + set vposids($view) $pos + set vnegids($view) $neg + return $ret +} + +# Start off a git log process and arrange to read its output +proc start_rev_list {view} { + global startmsecs commitidx viewcomplete curview + global tclencoding + global viewargs viewargscmd viewfiles vfilelimit + global showlocalchanges + global viewactive viewinstances vmergeonly + global mainheadid viewmainheadid viewmainheadid_orig + global vcanopt vflags vrevs vorigargs + global show_notes + + set startmsecs [clock clicks -milliseconds] + set commitidx($view) 0 + # these are set this way for the error exits + set viewcomplete($view) 1 + set viewactive($view) 0 + varcinit $view + + set args $viewargs($view) + if {$viewargscmd($view) ne {}} { + if {[catch { + set str [exec sh -c $viewargscmd($view)] + } err]} { + error_popup "[mc "Error executing --argscmd command:"] $err" + return 0 + } + set args [concat $args [split $str "\n"]] + } + set vcanopt($view) [parseviewargs $view $args] + + set files $viewfiles($view) + if {$vmergeonly($view)} { + set files [unmerged_files $files] + if {$files eq {}} { + global nr_unmerged + if {$nr_unmerged == 0} { + error_popup [mc "No files selected: --merge specified but\ + no files are unmerged."] + } else { + error_popup [mc "No files selected: --merge specified but\ + no unmerged files are within file limit."] + } + return 0 + } + } + set vfilelimit($view) $files + + if {$vcanopt($view)} { + set revs [parseviewrevs $view $vrevs($view)] + if {$revs eq {}} { + return 0 + } + set args [limit_arg_length [concat $vflags($view) $revs]] + } else { + set args $vorigargs($view) + } + + if {[catch { + set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \ + --parents --boundary $args "--" $files] r] + } err]} { + error_popup "[mc "Error executing git log:"] $err" + return 0 + } + set i [reg_instance $fd] + set viewinstances($view) [list $i] + set viewmainheadid($view) $mainheadid + set viewmainheadid_orig($view) $mainheadid + if {$files ne {} && $mainheadid ne {}} { + get_viewmainhead $view + } + if {$showlocalchanges && $viewmainheadid($view) ne {}} { + interestedin $viewmainheadid($view) dodiffindex + } + fconfigure $fd -blocking 0 -translation lf -eofchar {} + if {$tclencoding != {}} { + fconfigure $fd -encoding $tclencoding + } + filerun $fd [list getcommitlines $fd $i $view 0] + nowbusy $view [mc "Reading"] + set viewcomplete($view) 0 + set viewactive($view) 1 + return 1 +} + +proc stop_instance {inst} { + global commfd leftover + + set fd $commfd($inst) + catch { + set pid [pid $fd] + + if {$::tcl_platform(platform) eq {windows}} { + exec taskkill /pid $pid + } else { + exec kill $pid + } + } + catch {close $fd} + nukefile $fd + unset commfd($inst) + unset leftover($inst) +} + +proc stop_backends {} { + global commfd + + foreach inst [array names commfd] { + stop_instance $inst + } +} + +proc stop_rev_list {view} { + global viewinstances + + foreach inst $viewinstances($view) { + stop_instance $inst + } + set viewinstances($view) {} +} + +proc reset_pending_select {selid} { + global pending_select mainheadid selectheadid + + if {$selid ne {}} { + set pending_select $selid + } elseif {$selectheadid ne {}} { + set pending_select $selectheadid + } else { + set pending_select $mainheadid + } +} + +proc getcommits {selid} { + global canv curview need_redisplay viewactive + + initlayout + if {[start_rev_list $curview]} { + reset_pending_select $selid + show_status [mc "Reading commits..."] + set need_redisplay 1 + } else { + show_status [mc "No commits selected"] + } +} + +proc updatecommits {} { + global curview vcanopt vorigargs vfilelimit viewinstances + global viewactive viewcomplete tclencoding + global startmsecs showneartags showlocalchanges + global mainheadid viewmainheadid viewmainheadid_orig pending_select + global hasworktree + global varcid vposids vnegids vflags vrevs + global show_notes + + set hasworktree [hasworktree] + rereadrefs + set view $curview + if {$mainheadid ne $viewmainheadid_orig($view)} { + if {$showlocalchanges} { + dohidelocalchanges + } + set viewmainheadid($view) $mainheadid + set viewmainheadid_orig($view) $mainheadid + if {$vfilelimit($view) ne {}} { + get_viewmainhead $view + } + } + if {$showlocalchanges} { + doshowlocalchanges + } + if {$vcanopt($view)} { + set oldpos $vposids($view) + set oldneg $vnegids($view) + set revs [parseviewrevs $view $vrevs($view)] + if {$revs eq {}} { + return + } + # note: getting the delta when negative refs change is hard, + # and could require multiple git log invocations, so in that + # case we ask git log for all the commits (not just the delta) + if {$oldneg eq $vnegids($view)} { + set newrevs {} + set npos 0 + # take out positive refs that we asked for before or + # that we have already seen + foreach rev $revs { + if {[string length $rev] == 40} { + if {[lsearch -exact $oldpos $rev] < 0 + && ![info exists varcid($view,$rev)]} { + lappend newrevs $rev + incr npos + } + } else { + lappend $newrevs $rev + } + } + if {$npos == 0} return + set revs $newrevs + set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]] + } + set args [concat $vflags($view) $revs --not $oldpos] + } else { + set args $vorigargs($view) + } + if {[catch { + set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \ + --parents --boundary $args "--" $vfilelimit($view)] r] + } err]} { + error_popup "[mc "Error executing git log:"] $err" + return + } + if {$viewactive($view) == 0} { + set startmsecs [clock clicks -milliseconds] + } + set i [reg_instance $fd] + lappend viewinstances($view) $i + fconfigure $fd -blocking 0 -translation lf -eofchar {} + if {$tclencoding != {}} { + fconfigure $fd -encoding $tclencoding + } + filerun $fd [list getcommitlines $fd $i $view 1] + incr viewactive($view) + set viewcomplete($view) 0 + reset_pending_select {} + nowbusy $view [mc "Reading"] + if {$showneartags} { + getallcommits + } +} + +proc reloadcommits {} { + global curview viewcomplete selectedline currentid thickerline + global showneartags treediffs commitinterest cached_commitrow + global targetid commitinfo + + set selid {} + if {$selectedline ne {}} { + set selid $currentid + } + + if {!$viewcomplete($curview)} { + stop_rev_list $curview + } + resetvarcs $curview + set selectedline {} + unset -nocomplain currentid + unset -nocomplain thickerline + unset -nocomplain treediffs + readrefs + changedrefs + if {$showneartags} { + getallcommits + } + clear_display + unset -nocomplain commitinfo + unset -nocomplain commitinterest + unset -nocomplain cached_commitrow + unset -nocomplain targetid + setcanvscroll + getcommits $selid + return 0 +} + +# This makes a string representation of a positive integer which +# sorts as a string in numerical order +proc strrep {n} { + if {$n < 16} { + return [format "%x" $n] + } elseif {$n < 256} { + return [format "x%.2x" $n] + } elseif {$n < 65536} { + return [format "y%.4x" $n] + } + return [format "z%.8x" $n] +} + +# Procedures used in reordering commits from git log (without +# --topo-order) into the order for display. + +proc varcinit {view} { + global varcstart vupptr vdownptr vleftptr vbackptr varctok varcrow + global vtokmod varcmod vrowmod varcix vlastins + + set varcstart($view) {{}} + set vupptr($view) {0} + set vdownptr($view) {0} + set vleftptr($view) {0} + set vbackptr($view) {0} + set varctok($view) {{}} + set varcrow($view) {{}} + set vtokmod($view) {} + set varcmod($view) 0 + set vrowmod($view) 0 + set varcix($view) {{}} + set vlastins($view) {0} +} + +proc resetvarcs {view} { + global varcid varccommits parents children vseedcount ordertok + global vshortids + + foreach vid [array names varcid $view,*] { + unset varcid($vid) + unset children($vid) + unset parents($vid) + } + foreach vid [array names vshortids $view,*] { + unset vshortids($vid) + } + # some commits might have children but haven't been seen yet + foreach vid [array names children $view,*] { + unset children($vid) + } + foreach va [array names varccommits $view,*] { + unset varccommits($va) + } + foreach vd [array names vseedcount $view,*] { + unset vseedcount($vd) + } + unset -nocomplain ordertok +} + +# returns a list of the commits with no children +proc seeds {v} { + global vdownptr vleftptr varcstart + + set ret {} + set a [lindex $vdownptr($v) 0] + while {$a != 0} { + lappend ret [lindex $varcstart($v) $a] + set a [lindex $vleftptr($v) $a] + } + return $ret +} + +proc newvarc {view id} { + global varcid varctok parents children vdatemode + global vupptr vdownptr vleftptr vbackptr varcrow varcix varcstart + global commitdata commitinfo vseedcount varccommits vlastins + + set a [llength $varctok($view)] + set vid $view,$id + if {[llength $children($vid)] == 0 || $vdatemode($view)} { + if {![info exists commitinfo($id)]} { + parsecommit $id $commitdata($id) 1 + } + set cdate [lindex [lindex $commitinfo($id) 4] 0] + if {![string is integer -strict $cdate]} { + set cdate 0 + } + if {![info exists vseedcount($view,$cdate)]} { + set vseedcount($view,$cdate) -1 + } + set c [incr vseedcount($view,$cdate)] + set cdate [expr {$cdate ^ 0xffffffff}] + set tok "s[strrep $cdate][strrep $c]" + } else { + set tok {} + } + set ka 0 + if {[llength $children($vid)] > 0} { + set kid [lindex $children($vid) end] + set k $varcid($view,$kid) + if {[string compare [lindex $varctok($view) $k] $tok] > 0} { + set ki $kid + set ka $k + set tok [lindex $varctok($view) $k] + } + } + if {$ka != 0} { + set i [lsearch -exact $parents($view,$ki) $id] + set j [expr {[llength $parents($view,$ki)] - 1 - $i}] + append tok [strrep $j] + } + set c [lindex $vlastins($view) $ka] + if {$c == 0 || [string compare $tok [lindex $varctok($view) $c]] < 0} { + set c $ka + set b [lindex $vdownptr($view) $ka] + } else { + set b [lindex $vleftptr($view) $c] + } + while {$b != 0 && [string compare $tok [lindex $varctok($view) $b]] >= 0} { + set c $b + set b [lindex $vleftptr($view) $c] + } + if {$c == $ka} { + lset vdownptr($view) $ka $a + lappend vbackptr($view) 0 + } else { + lset vleftptr($view) $c $a + lappend vbackptr($view) $c + } + lset vlastins($view) $ka $a + lappend vupptr($view) $ka + lappend vleftptr($view) $b + if {$b != 0} { + lset vbackptr($view) $b $a + } + lappend varctok($view) $tok + lappend varcstart($view) $id + lappend vdownptr($view) 0 + lappend varcrow($view) {} + lappend varcix($view) {} + set varccommits($view,$a) {} + lappend vlastins($view) 0 + return $a +} + +proc splitvarc {p v} { + global varcid varcstart varccommits varctok vtokmod + global vupptr vdownptr vleftptr vbackptr varcix varcrow vlastins + + set oa $varcid($v,$p) + set otok [lindex $varctok($v) $oa] + set ac $varccommits($v,$oa) + set i [lsearch -exact $varccommits($v,$oa) $p] + if {$i <= 0} return + set na [llength $varctok($v)] + # "%" sorts before "0"... + set tok "$otok%[strrep $i]" + lappend varctok($v) $tok + lappend varcrow($v) {} + lappend varcix($v) {} + set varccommits($v,$oa) [lrange $ac 0 [expr {$i - 1}]] + set varccommits($v,$na) [lrange $ac $i end] + lappend varcstart($v) $p + foreach id $varccommits($v,$na) { + set varcid($v,$id) $na + } + lappend vdownptr($v) [lindex $vdownptr($v) $oa] + lappend vlastins($v) [lindex $vlastins($v) $oa] + lset vdownptr($v) $oa $na + lset vlastins($v) $oa 0 + lappend vupptr($v) $oa + lappend vleftptr($v) 0 + lappend vbackptr($v) 0 + for {set b [lindex $vdownptr($v) $na]} {$b != 0} {set b [lindex $vleftptr($v) $b]} { + lset vupptr($v) $b $na + } + if {[string compare $otok $vtokmod($v)] <= 0} { + modify_arc $v $oa + } +} + +proc renumbervarc {a v} { + global parents children varctok varcstart varccommits + global vupptr vdownptr vleftptr vbackptr vlastins varcid vtokmod vdatemode + + set t1 [clock clicks -milliseconds] + set todo {} + set isrelated($a) 1 + set kidchanged($a) 1 + set ntot 0 + while {$a != 0} { + if {[info exists isrelated($a)]} { + lappend todo $a + set id [lindex $varccommits($v,$a) end] + foreach p $parents($v,$id) { + if {[info exists varcid($v,$p)]} { + set isrelated($varcid($v,$p)) 1 + } + } + } + incr ntot + set b [lindex $vdownptr($v) $a] + if {$b == 0} { + while {$a != 0} { + set b [lindex $vleftptr($v) $a] + if {$b != 0} break + set a [lindex $vupptr($v) $a] + } + } + set a $b + } + foreach a $todo { + if {![info exists kidchanged($a)]} continue + set id [lindex $varcstart($v) $a] + if {[llength $children($v,$id)] > 1} { + set children($v,$id) [lsort -command [list vtokcmp $v] \ + $children($v,$id)] + } + set oldtok [lindex $varctok($v) $a] + if {!$vdatemode($v)} { + set tok {} + } else { + set tok $oldtok + } + set ka 0 + set kid [last_real_child $v,$id] + if {$kid ne {}} { + set k $varcid($v,$kid) + if {[string compare [lindex $varctok($v) $k] $tok] > 0} { + set ki $kid + set ka $k + set tok [lindex $varctok($v) $k] + } + } + if {$ka != 0} { + set i [lsearch -exact $parents($v,$ki) $id] + set j [expr {[llength $parents($v,$ki)] - 1 - $i}] + append tok [strrep $j] + } + if {$tok eq $oldtok} { + continue + } + set id [lindex $varccommits($v,$a) end] + foreach p $parents($v,$id) { + if {[info exists varcid($v,$p)]} { + set kidchanged($varcid($v,$p)) 1 + } else { + set sortkids($p) 1 + } + } + lset varctok($v) $a $tok + set b [lindex $vupptr($v) $a] + if {$b != $ka} { + if {[string compare [lindex $varctok($v) $ka] $vtokmod($v)] < 0} { + modify_arc $v $ka + } + if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} { + modify_arc $v $b + } + set c [lindex $vbackptr($v) $a] + set d [lindex $vleftptr($v) $a] + if {$c == 0} { + lset vdownptr($v) $b $d + } else { + lset vleftptr($v) $c $d + } + if {$d != 0} { + lset vbackptr($v) $d $c + } + if {[lindex $vlastins($v) $b] == $a} { + lset vlastins($v) $b $c + } + lset vupptr($v) $a $ka + set c [lindex $vlastins($v) $ka] + if {$c == 0 || \ + [string compare $tok [lindex $varctok($v) $c]] < 0} { + set c $ka + set b [lindex $vdownptr($v) $ka] + } else { + set b [lindex $vleftptr($v) $c] + } + while {$b != 0 && \ + [string compare $tok [lindex $varctok($v) $b]] >= 0} { + set c $b + set b [lindex $vleftptr($v) $c] + } + if {$c == $ka} { + lset vdownptr($v) $ka $a + lset vbackptr($v) $a 0 + } else { + lset vleftptr($v) $c $a + lset vbackptr($v) $a $c + } + lset vleftptr($v) $a $b + if {$b != 0} { + lset vbackptr($v) $b $a + } + lset vlastins($v) $ka $a + } + } + foreach id [array names sortkids] { + if {[llength $children($v,$id)] > 1} { + set children($v,$id) [lsort -command [list vtokcmp $v] \ + $children($v,$id)] + } + } + set t2 [clock clicks -milliseconds] + #puts "renumbervarc did [llength $todo] of $ntot arcs in [expr {$t2-$t1}]ms" +} + +# Fix up the graph after we have found out that in view $v, +# $p (a commit that we have already seen) is actually the parent +# of the last commit in arc $a. +proc fix_reversal {p a v} { + global varcid varcstart varctok vupptr + + set pa $varcid($v,$p) + if {$p ne [lindex $varcstart($v) $pa]} { + splitvarc $p $v + set pa $varcid($v,$p) + } + # seeds always need to be renumbered + if {[lindex $vupptr($v) $pa] == 0 || + [string compare [lindex $varctok($v) $a] \ + [lindex $varctok($v) $pa]] > 0} { + renumbervarc $pa $v + } +} + +proc insertrow {id p v} { + global cmitlisted children parents varcid varctok vtokmod + global varccommits ordertok commitidx numcommits curview + global targetid targetrow vshortids + + readcommit $id + set vid $v,$id + set cmitlisted($vid) 1 + set children($vid) {} + set parents($vid) [list $p] + set a [newvarc $v $id] + set varcid($vid) $a + lappend vshortids($v,[string range $id 0 3]) $id + if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} { + modify_arc $v $a + } + lappend varccommits($v,$a) $id + set vp $v,$p + if {[llength [lappend children($vp) $id]] > 1} { + set children($vp) [lsort -command [list vtokcmp $v] $children($vp)] + unset -nocomplain ordertok + } + fix_reversal $p $a $v + incr commitidx($v) + if {$v == $curview} { + set numcommits $commitidx($v) + setcanvscroll + if {[info exists targetid]} { + if {![comes_before $targetid $p]} { + incr targetrow + } + } + } +} + +proc insertfakerow {id p} { + global varcid varccommits parents children cmitlisted + global commitidx varctok vtokmod targetid targetrow curview numcommits + + set v $curview + set a $varcid($v,$p) + set i [lsearch -exact $varccommits($v,$a) $p] + if {$i < 0} { + puts "oops: insertfakerow can't find [shortids $p] on arc $a" + return + } + set children($v,$id) {} + set parents($v,$id) [list $p] + set varcid($v,$id) $a + lappend children($v,$p) $id + set cmitlisted($v,$id) 1 + set numcommits [incr commitidx($v)] + # note we deliberately don't update varcstart($v) even if $i == 0 + set varccommits($v,$a) [linsert $varccommits($v,$a) $i $id] + modify_arc $v $a $i + if {[info exists targetid]} { + if {![comes_before $targetid $p]} { + incr targetrow + } + } + setcanvscroll + drawvisible +} + +proc removefakerow {id} { + global varcid varccommits parents children commitidx + global varctok vtokmod cmitlisted currentid selectedline + global targetid curview numcommits + + set v $curview + if {[llength $parents($v,$id)] != 1} { + puts "oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents" + return + } + set p [lindex $parents($v,$id) 0] + set a $varcid($v,$id) + set i [lsearch -exact $varccommits($v,$a) $id] + if {$i < 0} { + puts "oops: removefakerow can't find [shortids $id] on arc $a" + return + } + unset varcid($v,$id) + set varccommits($v,$a) [lreplace $varccommits($v,$a) $i $i] + unset parents($v,$id) + unset children($v,$id) + unset cmitlisted($v,$id) + set numcommits [incr commitidx($v) -1] + set j [lsearch -exact $children($v,$p) $id] + if {$j >= 0} { + set children($v,$p) [lreplace $children($v,$p) $j $j] + } + modify_arc $v $a $i + if {[info exist currentid] && $id eq $currentid} { + unset currentid + set selectedline {} + } + if {[info exists targetid] && $targetid eq $id} { + set targetid $p + } + setcanvscroll + drawvisible +} + +proc real_children {vp} { + global children nullid nullid2 + + set kids {} + foreach id $children($vp) { + if {$id ne $nullid && $id ne $nullid2} { + lappend kids $id + } + } + return $kids +} + +proc first_real_child {vp} { + global children nullid nullid2 + + foreach id $children($vp) { + if {$id ne $nullid && $id ne $nullid2} { + return $id + } + } + return {} +} + +proc last_real_child {vp} { + global children nullid nullid2 + + set kids $children($vp) + for {set i [llength $kids]} {[incr i -1] >= 0} {} { + set id [lindex $kids $i] + if {$id ne $nullid && $id ne $nullid2} { + return $id + } + } + return {} +} + +proc vtokcmp {v a b} { + global varctok varcid + + return [string compare [lindex $varctok($v) $varcid($v,$a)] \ + [lindex $varctok($v) $varcid($v,$b)]] +} + +# This assumes that if lim is not given, the caller has checked that +# arc a's token is less than $vtokmod($v) +proc modify_arc {v a {lim {}}} { + global varctok vtokmod varcmod varcrow vupptr curview vrowmod varccommits + + if {$lim ne {}} { + set c [string compare [lindex $varctok($v) $a] $vtokmod($v)] + if {$c > 0} return + if {$c == 0} { + set r [lindex $varcrow($v) $a] + if {$r ne {} && $vrowmod($v) <= $r + $lim} return + } + } + set vtokmod($v) [lindex $varctok($v) $a] + set varcmod($v) $a + if {$v == $curview} { + while {$a != 0 && [lindex $varcrow($v) $a] eq {}} { + set a [lindex $vupptr($v) $a] + set lim {} + } + set r 0 + if {$a != 0} { + if {$lim eq {}} { + set lim [llength $varccommits($v,$a)] + } + set r [expr {[lindex $varcrow($v) $a] + $lim}] + } + set vrowmod($v) $r + undolayout $r + } +} + +proc update_arcrows {v} { + global vtokmod varcmod vrowmod varcrow commitidx currentid selectedline + global varcid vrownum varcorder varcix varccommits + global vupptr vdownptr vleftptr varctok + global displayorder parentlist curview cached_commitrow + + if {$vrowmod($v) == $commitidx($v)} return + if {$v == $curview} { + if {[llength $displayorder] > $vrowmod($v)} { + set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]] + set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]] + } + unset -nocomplain cached_commitrow + } + set narctot [expr {[llength $varctok($v)] - 1}] + set a $varcmod($v) + while {$a != 0 && [lindex $varcix($v) $a] eq {}} { + # go up the tree until we find something that has a row number, + # or we get to a seed + set a [lindex $vupptr($v) $a] + } + if {$a == 0} { + set a [lindex $vdownptr($v) 0] + if {$a == 0} return + set vrownum($v) {0} + set varcorder($v) [list $a] + lset varcix($v) $a 0 + lset varcrow($v) $a 0 + set arcn 0 + set row 0 + } else { + set arcn [lindex $varcix($v) $a] + if {[llength $vrownum($v)] > $arcn + 1} { + set vrownum($v) [lrange $vrownum($v) 0 $arcn] + set varcorder($v) [lrange $varcorder($v) 0 $arcn] + } + set row [lindex $varcrow($v) $a] + } + while {1} { + set p $a + incr row [llength $varccommits($v,$a)] + # go down if possible + set b [lindex $vdownptr($v) $a] + if {$b == 0} { + # if not, go left, or go up until we can go left + while {$a != 0} { + set b [lindex $vleftptr($v) $a] + if {$b != 0} break + set a [lindex $vupptr($v) $a] + } + if {$a == 0} break + } + set a $b + incr arcn + lappend vrownum($v) $row + lappend varcorder($v) $a + lset varcix($v) $a $arcn + lset varcrow($v) $a $row + } + set vtokmod($v) [lindex $varctok($v) $p] + set varcmod($v) $p + set vrowmod($v) $row + if {[info exists currentid]} { + set selectedline [rowofcommit $currentid] + } +} + +# Test whether view $v contains commit $id +proc commitinview {id v} { + global varcid + + return [info exists varcid($v,$id)] +} + +# Return the row number for commit $id in the current view +proc rowofcommit {id} { + global varcid varccommits varcrow curview cached_commitrow + global varctok vtokmod + + set v $curview + if {![info exists varcid($v,$id)]} { + puts "oops rowofcommit no arc for [shortids $id]" + return {} + } + set a $varcid($v,$id) + if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] >= 0} { + update_arcrows $v + } + if {[info exists cached_commitrow($id)]} { + return $cached_commitrow($id) + } + set i [lsearch -exact $varccommits($v,$a) $id] + if {$i < 0} { + puts "oops didn't find commit [shortids $id] in arc $a" + return {} + } + incr i [lindex $varcrow($v) $a] + set cached_commitrow($id) $i + return $i +} + +# Returns 1 if a is on an earlier row than b, otherwise 0 +proc comes_before {a b} { + global varcid varctok curview + + set v $curview + if {$a eq $b || ![info exists varcid($v,$a)] || \ + ![info exists varcid($v,$b)]} { + return 0 + } + if {$varcid($v,$a) != $varcid($v,$b)} { + return [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \ + [lindex $varctok($v) $varcid($v,$b)]] < 0}] + } + return [expr {[rowofcommit $a] < [rowofcommit $b]}] +} + +proc bsearch {l elt} { + if {[llength $l] == 0 || $elt <= [lindex $l 0]} { + return 0 + } + set lo 0 + set hi [llength $l] + while {$hi - $lo > 1} { + set mid [expr {int(($lo + $hi) / 2)}] + set t [lindex $l $mid] + if {$elt < $t} { + set hi $mid + } elseif {$elt > $t} { + set lo $mid + } else { + return $mid + } + } + return $lo +} + +# Make sure rows $start..$end-1 are valid in displayorder and parentlist +proc make_disporder {start end} { + global vrownum curview commitidx displayorder parentlist + global varccommits varcorder parents vrowmod varcrow + global d_valid_start d_valid_end + + if {$end > $vrowmod($curview)} { + update_arcrows $curview + } + set ai [bsearch $vrownum($curview) $start] + set start [lindex $vrownum($curview) $ai] + set narc [llength $vrownum($curview)] + for {set r $start} {$ai < $narc && $r < $end} {incr ai} { + set a [lindex $varcorder($curview) $ai] + set l [llength $displayorder] + set al [llength $varccommits($curview,$a)] + if {$l < $r + $al} { + if {$l < $r} { + set pad [ntimes [expr {$r - $l}] {}] + set displayorder [concat $displayorder $pad] + set parentlist [concat $parentlist $pad] + } elseif {$l > $r} { + set displayorder [lrange $displayorder 0 [expr {$r - 1}]] + set parentlist [lrange $parentlist 0 [expr {$r - 1}]] + } + foreach id $varccommits($curview,$a) { + lappend displayorder $id + lappend parentlist $parents($curview,$id) + } + } elseif {[lindex $displayorder [expr {$r + $al - 1}]] eq {}} { + set i $r + foreach id $varccommits($curview,$a) { + lset displayorder $i $id + lset parentlist $i $parents($curview,$id) + incr i + } + } + incr r $al + } +} + +proc commitonrow {row} { + global displayorder + + set id [lindex $displayorder $row] + if {$id eq {}} { + make_disporder $row [expr {$row + 1}] + set id [lindex $displayorder $row] + } + return $id +} + +proc closevarcs {v} { + global varctok varccommits varcid parents children + global cmitlisted commitidx vtokmod curview numcommits + + set missing_parents 0 + set scripts {} + set narcs [llength $varctok($v)] + for {set a 1} {$a < $narcs} {incr a} { + set id [lindex $varccommits($v,$a) end] + foreach p $parents($v,$id) { + if {[info exists varcid($v,$p)]} continue + # add p as a new commit + incr missing_parents + set cmitlisted($v,$p) 0 + set parents($v,$p) {} + if {[llength $children($v,$p)] == 1 && + [llength $parents($v,$id)] == 1} { + set b $a + } else { + set b [newvarc $v $p] + } + set varcid($v,$p) $b + if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} { + modify_arc $v $b + } + lappend varccommits($v,$b) $p + incr commitidx($v) + if {$v == $curview} { + set numcommits $commitidx($v) + } + set scripts [check_interest $p $scripts] + } + } + if {$missing_parents > 0} { + foreach s $scripts { + eval $s + } + } +} + +# Use $rwid as a substitute for $id, i.e. reparent $id's children to $rwid +# Assumes we already have an arc for $rwid. +proc rewrite_commit {v id rwid} { + global children parents varcid varctok vtokmod varccommits + + foreach ch $children($v,$id) { + # make $rwid be $ch's parent in place of $id + set i [lsearch -exact $parents($v,$ch) $id] + if {$i < 0} { + puts "oops rewrite_commit didn't find $id in parent list for $ch" + } + set parents($v,$ch) [lreplace $parents($v,$ch) $i $i $rwid] + # add $ch to $rwid's children and sort the list if necessary + if {[llength [lappend children($v,$rwid) $ch]] > 1} { + set children($v,$rwid) [lsort -command [list vtokcmp $v] \ + $children($v,$rwid)] + } + # fix the graph after joining $id to $rwid + set a $varcid($v,$ch) + fix_reversal $rwid $a $v + # parentlist is wrong for the last element of arc $a + # even if displayorder is right, hence the 3rd arg here + modify_arc $v $a [expr {[llength $varccommits($v,$a)] - 1}] + } +} + +# Mechanism for registering a command to be executed when we come +# across a particular commit. To handle the case when only the +# prefix of the commit is known, the commitinterest array is now +# indexed by the first 4 characters of the ID. Each element is a +# list of id, cmd pairs. +proc interestedin {id cmd} { + global commitinterest + + lappend commitinterest([string range $id 0 3]) $id $cmd +} + +proc check_interest {id scripts} { + global commitinterest + + set prefix [string range $id 0 3] + if {[info exists commitinterest($prefix)]} { + set newlist {} + foreach {i script} $commitinterest($prefix) { + if {[string match "$i*" $id]} { + lappend scripts [string map [list "%I" $id "%P" $i] $script] + } else { + lappend newlist $i $script + } + } + if {$newlist ne {}} { + set commitinterest($prefix) $newlist + } else { + unset commitinterest($prefix) + } + } + return $scripts +} + +proc getcommitlines {fd inst view updating} { + global cmitlisted leftover + global commitidx commitdata vdatemode + global parents children curview hlview + global idpending ordertok + global varccommits varcid varctok vtokmod vfilelimit vshortids + + set stuff [read $fd 500000] + # git log doesn't terminate the last commit with a null... + if {$stuff == {} && $leftover($inst) ne {} && [eof $fd]} { + set stuff "\0" + } + if {$stuff == {}} { + if {![eof $fd]} { + return 1 + } + global commfd viewcomplete viewactive viewname + global viewinstances + unset commfd($inst) + set i [lsearch -exact $viewinstances($view) $inst] + if {$i >= 0} { + set viewinstances($view) [lreplace $viewinstances($view) $i $i] + } + # set it blocking so we wait for the process to terminate + fconfigure $fd -blocking 1 + if {[catch {close $fd} err]} { + set fv {} + if {$view != $curview} { + set fv " for the \"$viewname($view)\" view" + } + if {[string range $err 0 4] == "usage"} { + set err "Gitk: error reading commits$fv:\ + bad arguments to git log." + if {$viewname($view) eq [mc "Command line"]} { + append err \ + " (Note: arguments to gitk are passed to git log\ + to allow selection of commits to be displayed.)" + } + } else { + set err "Error reading commits$fv: $err" + } + error_popup $err + } + if {[incr viewactive($view) -1] <= 0} { + set viewcomplete($view) 1 + # Check if we have seen any ids listed as parents that haven't + # appeared in the list + closevarcs $view + notbusy $view + } + if {$view == $curview} { + run chewcommits + } + return 0 + } + set start 0 + set gotsome 0 + set scripts {} + while 1 { + set i [string first "\0" $stuff $start] + if {$i < 0} { + append leftover($inst) [string range $stuff $start end] + break + } + if {$start == 0} { + set cmit $leftover($inst) + append cmit [string range $stuff 0 [expr {$i - 1}]] + set leftover($inst) {} + } else { + set cmit [string range $stuff $start [expr {$i - 1}]] + } + set start [expr {$i + 1}] + set j [string first "\n" $cmit] + set ok 0 + set listed 1 + if {$j >= 0 && [string match "commit *" $cmit]} { + set ids [string range $cmit 7 [expr {$j - 1}]] + if {[string match {[-^<>]*} $ids]} { + switch -- [string index $ids 0] { + "-" {set listed 0} + "^" {set listed 2} + "<" {set listed 3} + ">" {set listed 4} + } + set ids [string range $ids 1 end] + } + set ok 1 + foreach id $ids { + if {[string length $id] != 40} { + set ok 0 + break + } + } + } + if {!$ok} { + set shortcmit $cmit + if {[string length $shortcmit] > 80} { + set shortcmit "[string range $shortcmit 0 80]..." + } + error_popup "[mc "Can't parse git log output:"] {$shortcmit}" + exit 1 + } + set id [lindex $ids 0] + set vid $view,$id + + lappend vshortids($view,[string range $id 0 3]) $id + + if {!$listed && $updating && ![info exists varcid($vid)] && + $vfilelimit($view) ne {}} { + # git log doesn't rewrite parents for unlisted commits + # when doing path limiting, so work around that here + # by working out the rewritten parent with git rev-list + # and if we already know about it, using the rewritten + # parent as a substitute parent for $id's children. + if {![catch { + set rwid [exec git rev-list --first-parent --max-count=1 \ + $id -- $vfilelimit($view)] + }]} { + if {$rwid ne {} && [info exists varcid($view,$rwid)]} { + # use $rwid in place of $id + rewrite_commit $view $id $rwid + continue + } + } + } + + set a 0 + if {[info exists varcid($vid)]} { + if {$cmitlisted($vid) || !$listed} continue + set a $varcid($vid) + } + if {$listed} { + set olds [lrange $ids 1 end] + } else { + set olds {} + } + set commitdata($id) [string range $cmit [expr {$j + 1}] end] + set cmitlisted($vid) $listed + set parents($vid) $olds + if {![info exists children($vid)]} { + set children($vid) {} + } elseif {$a == 0 && [llength $children($vid)] == 1} { + set k [lindex $children($vid) 0] + if {[llength $parents($view,$k)] == 1 && + (!$vdatemode($view) || + $varcid($view,$k) == [llength $varctok($view)] - 1)} { + set a $varcid($view,$k) + } + } + if {$a == 0} { + # new arc + set a [newvarc $view $id] + } + if {[string compare [lindex $varctok($view) $a] $vtokmod($view)] < 0} { + modify_arc $view $a + } + if {![info exists varcid($vid)]} { + set varcid($vid) $a + lappend varccommits($view,$a) $id + incr commitidx($view) + } + + set i 0 + foreach p $olds { + if {$i == 0 || [lsearch -exact $olds $p] >= $i} { + set vp $view,$p + if {[llength [lappend children($vp) $id]] > 1 && + [vtokcmp $view [lindex $children($vp) end-1] $id] > 0} { + set children($vp) [lsort -command [list vtokcmp $view] \ + $children($vp)] + unset -nocomplain ordertok + } + if {[info exists varcid($view,$p)]} { + fix_reversal $p $a $view + } + } + incr i + } + + set scripts [check_interest $id $scripts] + set gotsome 1 + } + if {$gotsome} { + global numcommits hlview + + if {$view == $curview} { + set numcommits $commitidx($view) + run chewcommits + } + if {[info exists hlview] && $view == $hlview} { + # we never actually get here... + run vhighlightmore + } + foreach s $scripts { + eval $s + } + } + return 2 +} + +proc chewcommits {} { + global curview hlview viewcomplete + global pending_select + + layoutmore + if {$viewcomplete($curview)} { + global commitidx varctok + global numcommits startmsecs + + if {[info exists pending_select]} { + update + reset_pending_select {} + + if {[commitinview $pending_select $curview]} { + selectline [rowofcommit $pending_select] 1 + } else { + set row [first_real_row] + selectline $row 1 + } + } + if {$commitidx($curview) > 0} { + #set ms [expr {[clock clicks -milliseconds] - $startmsecs}] + #puts "overall $ms ms for $numcommits commits" + #puts "[llength $varctok($view)] arcs, $commitidx($view) commits" + } else { + show_status [mc "No commits selected"] + } + notbusy layout + } + return 0 +} + +proc do_readcommit {id} { + global tclencoding + + # Invoke git-log to handle automatic encoding conversion + set fd [open [concat | git log --no-color --pretty=raw -1 $id] r] + # Read the results using i18n.logoutputencoding + fconfigure $fd -translation lf -eofchar {} + if {$tclencoding != {}} { + fconfigure $fd -encoding $tclencoding + } + set contents [read $fd] + close $fd + # Remove the heading line + regsub {^commit [0-9a-f]+\n} $contents {} contents + + return $contents +} + +proc readcommit {id} { + if {[catch {set contents [do_readcommit $id]}]} return + parsecommit $id $contents 1 +} + +proc parsecommit {id contents listed} { + global commitinfo + + set inhdr 1 + set comment {} + set headline {} + set auname {} + set audate {} + set comname {} + set comdate {} + set hdrend [string first "\n\n" $contents] + if {$hdrend < 0} { + # should never happen... + set hdrend [string length $contents] + } + set header [string range $contents 0 [expr {$hdrend - 1}]] + set comment [string range $contents [expr {$hdrend + 2}] end] + foreach line [split $header "\n"] { + set line [split $line " "] + set tag [lindex $line 0] + if {$tag == "author"} { + set audate [lrange $line end-1 end] + set auname [join [lrange $line 1 end-2] " "] + } elseif {$tag == "committer"} { + set comdate [lrange $line end-1 end] + set comname [join [lrange $line 1 end-2] " "] + } + } + set headline {} + # take the first non-blank line of the comment as the headline + set headline [string trimleft $comment] + set i [string first "\n" $headline] + if {$i >= 0} { + set headline [string range $headline 0 $i] + } + set headline [string trimright $headline] + set i [string first "\r" $headline] + if {$i >= 0} { + set headline [string trimright [string range $headline 0 $i]] + } + if {!$listed} { + # git log indents the comment by 4 spaces; + # if we got this via git cat-file, add the indentation + set newcomment {} + foreach line [split $comment "\n"] { + append newcomment " " + append newcomment $line + append newcomment "\n" + } + set comment $newcomment + } + set hasnote [string first "\nNotes:\n" $contents] + set diff "" + # If there is diff output shown in the git-log stream, split it + # out. But get rid of the empty line that always precedes the + # diff. + set i [string first "\n\ndiff" $comment] + if {$i >= 0} { + set diff [string range $comment $i+1 end] + set comment [string range $comment 0 $i-1] + } + set commitinfo($id) [list $headline $auname $audate \ + $comname $comdate $comment $hasnote $diff] +} + +proc getcommit {id} { + global commitdata commitinfo + + if {[info exists commitdata($id)]} { + parsecommit $id $commitdata($id) 1 + } else { + readcommit $id + if {![info exists commitinfo($id)]} { + set commitinfo($id) [list [mc "No commit information available"]] + } + } + return 1 +} + +# Expand an abbreviated commit ID to a list of full 40-char IDs that match +# and are present in the current view. +# This is fairly slow... +proc longid {prefix} { + global varcid curview vshortids + + set ids {} + if {[string length $prefix] >= 4} { + set vshortid $curview,[string range $prefix 0 3] + if {[info exists vshortids($vshortid)]} { + foreach id $vshortids($vshortid) { + if {[string match "$prefix*" $id]} { + if {[lsearch -exact $ids $id] < 0} { + lappend ids $id + if {[llength $ids] >= 2} break + } + } + } + } + } else { + foreach match [array names varcid "$curview,$prefix*"] { + lappend ids [lindex [split $match ","] 1] + if {[llength $ids] >= 2} break + } + } + return $ids +} + +proc readrefs {} { + global tagids idtags headids idheads tagobjid + global otherrefids idotherrefs mainhead mainheadid + global selecthead selectheadid + global hideremotes + + foreach v {tagids idtags headids idheads otherrefids idotherrefs} { + unset -nocomplain $v + } + set refd [open [list | git show-ref -d] r] + while {[gets $refd line] >= 0} { + if {[string index $line 40] ne " "} continue + set id [string range $line 0 39] + set ref [string range $line 41 end] + if {![string match "refs/*" $ref]} continue + set name [string range $ref 5 end] + if {[string match "remotes/*" $name]} { + if {![string match "*/HEAD" $name] && !$hideremotes} { + set headids($name) $id + lappend idheads($id) $name + } + } elseif {[string match "heads/*" $name]} { + set name [string range $name 6 end] + set headids($name) $id + lappend idheads($id) $name + } elseif {[string match "tags/*" $name]} { + # this lets refs/tags/foo^{} overwrite refs/tags/foo, + # which is what we want since the former is the commit ID + set name [string range $name 5 end] + if {[string match "*^{}" $name]} { + set name [string range $name 0 end-3] + } else { + set tagobjid($name) $id + } + set tagids($name) $id + lappend idtags($id) $name + } else { + set otherrefids($name) $id + lappend idotherrefs($id) $name + } + } + catch {close $refd} + set mainhead {} + set mainheadid {} + catch { + set mainheadid [exec git rev-parse HEAD] + set thehead [exec git symbolic-ref HEAD] + if {[string match "refs/heads/*" $thehead]} { + set mainhead [string range $thehead 11 end] + } + } + set selectheadid {} + if {$selecthead ne {}} { + catch { + set selectheadid [exec git rev-parse --verify $selecthead] + } + } +} + +# skip over fake commits +proc first_real_row {} { + global nullid nullid2 numcommits + + for {set row 0} {$row < $numcommits} {incr row} { + set id [commitonrow $row] + if {$id ne $nullid && $id ne $nullid2} { + break + } + } + return $row +} + +# update things for a head moved to a child of its previous location +proc movehead {id name} { + global headids idheads + + removehead $headids($name) $name + set headids($name) $id + lappend idheads($id) $name +} + +# update things when a head has been removed +proc removehead {id name} { + global headids idheads + + if {$idheads($id) eq $name} { + unset idheads($id) + } else { + set i [lsearch -exact $idheads($id) $name] + if {$i >= 0} { + set idheads($id) [lreplace $idheads($id) $i $i] + } + } + unset headids($name) +} + +proc ttk_toplevel {w args} { + global use_ttk + eval [linsert $args 0 ::toplevel $w] + if {$use_ttk} { + place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1 + } + return $w +} + +proc make_transient {window origin} { + global have_tk85 + + # In MacOS Tk 8.4 transient appears to work by setting + # overrideredirect, which is utterly useless, since the + # windows get no border, and are not even kept above + # the parent. + if {!$have_tk85 && [tk windowingsystem] eq {aqua}} return + + wm transient $window $origin + + # Windows fails to place transient windows normally, so + # schedule a callback to center them on the parent. + if {[tk windowingsystem] eq {win32}} { + after idle [list tk::PlaceWindow $window widget $origin] + } +} + +proc show_error {w top msg} { + global NS + if {![info exists NS]} {set NS ""} + if {[wm state $top] eq "withdrawn"} { wm deiconify $top } + message $w.m -text $msg -justify center -aspect 400 + pack $w.m -side top -fill x -padx 20 -pady 20 + ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top" + pack $w.ok -side bottom -fill x + bind $top "grab $top; focus $top" + bind $top "destroy $top" + bind $top "destroy $top" + bind $top "destroy $top" + tkwait window $top +} + +proc error_popup {msg {owner .}} { + if {[tk windowingsystem] eq "win32"} { + tk_messageBox -icon error -type ok -title [wm title .] \ + -parent $owner -message $msg + } else { + set w .error + ttk_toplevel $w + make_transient $w $owner + show_error $w $w $msg + } +} + +proc confirm_popup {msg {owner .}} { + global confirm_ok NS + set confirm_ok 0 + set w .confirm + ttk_toplevel $w + make_transient $w $owner + message $w.m -text $msg -justify center -aspect 400 + pack $w.m -side top -fill x -padx 20 -pady 20 + ${NS}::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" + pack $w.ok -side left -fill x + ${NS}::button $w.cancel -text [mc Cancel] -command "destroy $w" + pack $w.cancel -side right -fill x + bind $w "grab $w; focus $w" + bind $w "set confirm_ok 1; destroy $w" + bind $w "set confirm_ok 1; destroy $w" + bind $w "destroy $w" + tk::PlaceWindow $w widget $owner + tkwait window $w + return $confirm_ok +} + +proc setoptions {} { + global use_ttk + + if {[tk windowingsystem] ne "win32"} { + option add *Panedwindow.showHandle 1 startupFile + option add *Panedwindow.sashRelief raised startupFile + if {[tk windowingsystem] ne "aqua"} { + option add *Menu.font uifont startupFile + } + } else { + option add *Menu.TearOff 0 startupFile + } + option add *Button.font uifont startupFile + option add *Checkbutton.font uifont startupFile + option add *Radiobutton.font uifont startupFile + option add *Menubutton.font uifont startupFile + option add *Label.font uifont startupFile + option add *Message.font uifont startupFile + option add *Entry.font textfont startupFile + option add *Text.font textfont startupFile + option add *Labelframe.font uifont startupFile + option add *Spinbox.font textfont startupFile + option add *Listbox.font mainfont startupFile +} + +proc setttkstyle {} { + eval font configure TkDefaultFont [fontflags mainfont] + eval font configure TkTextFont [fontflags textfont] + eval font configure TkHeadingFont [fontflags mainfont] + eval font configure TkCaptionFont [fontflags mainfont] -weight bold + eval font configure TkTooltipFont [fontflags uifont] + eval font configure TkFixedFont [fontflags textfont] + eval font configure TkIconFont [fontflags uifont] + eval font configure TkMenuFont [fontflags uifont] + eval font configure TkSmallCaptionFont [fontflags uifont] +} + +# Make a menu and submenus. +# m is the window name for the menu, items is the list of menu items to add. +# Each item is a list {mc label type description options...} +# mc is ignored; it's so we can put mc there to alert xgettext +# label is the string that appears in the menu +# type is cascade, command or radiobutton (should add checkbutton) +# description depends on type; it's the sublist for cascade, the +# command to invoke for command, or {variable value} for radiobutton +proc makemenu {m items} { + menu $m + if {[tk windowingsystem] eq {aqua}} { + set Meta1 Cmd + } else { + set Meta1 Ctrl + } + foreach i $items { + set name [mc [lindex $i 1]] + set type [lindex $i 2] + set thing [lindex $i 3] + set params [list $type] + if {$name ne {}} { + set u [string first "&" [string map {&& x} $name]] + lappend params -label [string map {&& & & {}} $name] + if {$u >= 0} { + lappend params -underline $u + } + } + switch -- $type { + "cascade" { + set submenu [string tolower [string map {& ""} [lindex $i 1]]] + lappend params -menu $m.$submenu + } + "command" { + lappend params -command $thing + } + "radiobutton" { + lappend params -variable [lindex $thing 0] \ + -value [lindex $thing 1] + } + } + set tail [lrange $i 4 end] + regsub -all {\yMeta1\y} $tail $Meta1 tail + eval $m add $params $tail + if {$type eq "cascade"} { + makemenu $m.$submenu $thing + } + } +} + +# translate string and remove ampersands +proc mca {str} { + return [string map {&& & & {}} [mc $str]] +} + +proc cleardropsel {w} { + $w selection clear +} +proc makedroplist {w varname args} { + global use_ttk + if {$use_ttk} { + set width 0 + foreach label $args { + set cx [string length $label] + if {$cx > $width} {set width $cx} + } + set gm [ttk::combobox $w -width $width -state readonly\ + -textvariable $varname -values $args \ + -exportselection false] + bind $gm <> [list $gm selection clear] + } else { + set gm [eval [linsert $args 0 tk_optionMenu $w $varname]] + } + return $gm +} + +proc makewindow {} { + global canv canv2 canv3 linespc charspc ctext cflist cscroll + global tabstop + global findtype findtypemenu findloc findstring fstring geometry + global entries sha1entry sha1string sha1but + global diffcontextstring diffcontext + global ignorespace + global maincursor textcursor curtextcursor + global rowctxmenu fakerowmenu mergemax wrapcomment + global highlight_files gdttype + global searchstring sstring + global bgcolor fgcolor bglist fglist diffcolors selectbgcolor + global uifgcolor uifgdisabledcolor + global filesepbgcolor filesepfgcolor + global mergecolors foundbgcolor currentsearchhitbgcolor + global headctxmenu progresscanv progressitem progresscoords statusw + global fprogitem fprogcoord lastprogupdate progupdatepending + global rprogitem rprogcoord rownumsel numcommits + global have_tk85 have_tk86 use_ttk NS + global git_version + global worddiff + + # The "mc" arguments here are purely so that xgettext + # sees the following string as needing to be translated + set file { + mc "&File" cascade { + {mc "&Update" command updatecommits -accelerator F5} + {mc "&Reload" command reloadcommits -accelerator Shift-F5} + {mc "Reread re&ferences" command rereadrefs} + {mc "&List references" command showrefs -accelerator F2} + {xx "" separator} + {mc "Start git &gui" command {exec git gui &}} + {xx "" separator} + {mc "&Quit" command doquit -accelerator Meta1-Q} + }} + set edit { + mc "&Edit" cascade { + {mc "&Preferences" command doprefs} + }} + set view { + mc "&View" cascade { + {mc "&New view..." command {newview 0} -accelerator Shift-F4} + {mc "&Edit view..." command editview -state disabled -accelerator F4} + {mc "&Delete view" command delview -state disabled} + {xx "" separator} + {mc "&All files" radiobutton {selectedview 0} -command {showview 0}} + }} + if {[tk windowingsystem] ne "aqua"} { + set help { + mc "&Help" cascade { + {mc "&About gitk" command about} + {mc "&Key bindings" command keys} + }} + set bar [list $file $edit $view $help] + } else { + proc ::tk::mac::ShowPreferences {} {doprefs} + proc ::tk::mac::Quit {} {doquit} + lset file end [lreplace [lindex $file end] end-1 end] + set apple { + xx "&Apple" cascade { + {mc "&About gitk" command about} + {xx "" separator} + }} + set help { + mc "&Help" cascade { + {mc "&Key bindings" command keys} + }} + set bar [list $apple $file $view $help] + } + makemenu .bar $bar + . configure -menu .bar + + if {$use_ttk} { + # cover the non-themed toplevel with a themed frame. + place [ttk::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1 + } + + # the gui has upper and lower half, parts of a paned window. + ${NS}::panedwindow .ctop -orient vertical + + # possibly use assumed geometry + if {![info exists geometry(pwsash0)]} { + set geometry(topheight) [expr {15 * $linespc}] + set geometry(topwidth) [expr {80 * $charspc}] + set geometry(botheight) [expr {15 * $linespc}] + set geometry(botwidth) [expr {50 * $charspc}] + set geometry(pwsash0) [list [expr {40 * $charspc}] 2] + set geometry(pwsash1) [list [expr {60 * $charspc}] 2] + } + + # the upper half will have a paned window, a scroll bar to the right, and some stuff below + ${NS}::frame .tf -height $geometry(topheight) -width $geometry(topwidth) + ${NS}::frame .tf.histframe + ${NS}::panedwindow .tf.histframe.pwclist -orient horizontal + if {!$use_ttk} { + .tf.histframe.pwclist configure -sashpad 0 -handlesize 4 + } + + # create three canvases + set cscroll .tf.histframe.csb + set canv .tf.histframe.pwclist.canv + canvas $canv \ + -selectbackground $selectbgcolor \ + -background $bgcolor -bd 0 \ + -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll" + .tf.histframe.pwclist add $canv + set canv2 .tf.histframe.pwclist.canv2 + canvas $canv2 \ + -selectbackground $selectbgcolor \ + -background $bgcolor -bd 0 -yscrollincr $linespc + .tf.histframe.pwclist add $canv2 + set canv3 .tf.histframe.pwclist.canv3 + canvas $canv3 \ + -selectbackground $selectbgcolor \ + -background $bgcolor -bd 0 -yscrollincr $linespc + .tf.histframe.pwclist add $canv3 + if {$use_ttk} { + bind .tf.histframe.pwclist { + bind %W {} + .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0] + .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0] + } + } else { + eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0) + eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1) + } + + # a scroll bar to rule them + ${NS}::scrollbar $cscroll -command {allcanvs yview} + if {!$use_ttk} {$cscroll configure -highlightthickness 0} + pack $cscroll -side right -fill y + bind .tf.histframe.pwclist {resizeclistpanes %W %w} + lappend bglist $canv $canv2 $canv3 + pack .tf.histframe.pwclist -fill both -expand 1 -side left + + # we have two button bars at bottom of top frame. Bar 1 + ${NS}::frame .tf.bar + ${NS}::frame .tf.lbar -height 15 + + set sha1entry .tf.bar.sha1 + set entries $sha1entry + set sha1but .tf.bar.sha1label + button $sha1but -text "[mc "SHA1 ID:"] " -state disabled -relief flat \ + -command gotocommit -width 8 + $sha1but conf -disabledforeground [$sha1but cget -foreground] + pack .tf.bar.sha1label -side left + ${NS}::entry $sha1entry -width 40 -font textfont -textvariable sha1string + trace add variable sha1string write sha1change + pack $sha1entry -side left -pady 2 + + set bm_left_data { + #define left_width 16 + #define left_height 16 + static unsigned char left_bits[] = { + 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00, + 0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00, + 0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01}; + } + set bm_right_data { + #define right_width 16 + #define right_height 16 + static unsigned char right_bits[] = { + 0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c, + 0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c, + 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01}; + } + image create bitmap bm-left -data $bm_left_data -foreground $uifgcolor + image create bitmap bm-left-gray -data $bm_left_data -foreground $uifgdisabledcolor + image create bitmap bm-right -data $bm_right_data -foreground $uifgcolor + image create bitmap bm-right-gray -data $bm_right_data -foreground $uifgdisabledcolor + + ${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26 + if {$use_ttk} { + .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray] + } else { + .tf.bar.leftbut configure -image bm-left + } + pack .tf.bar.leftbut -side left -fill y + ${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26 + if {$use_ttk} { + .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray] + } else { + .tf.bar.rightbut configure -image bm-right + } + pack .tf.bar.rightbut -side left -fill y + + ${NS}::label .tf.bar.rowlabel -text [mc "Row"] + set rownumsel {} + ${NS}::label .tf.bar.rownum -width 7 -textvariable rownumsel \ + -relief sunken -anchor e + ${NS}::label .tf.bar.rowlabel2 -text "/" + ${NS}::label .tf.bar.numcommits -width 7 -textvariable numcommits \ + -relief sunken -anchor e + pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \ + -side left + if {!$use_ttk} { + foreach w {rownum numcommits} {.tf.bar.$w configure -font textfont} + } + global selectedline + trace add variable selectedline write selectedline_change + + # Status label and progress bar + set statusw .tf.bar.status + ${NS}::label $statusw -width 15 -relief sunken + pack $statusw -side left -padx 5 + if {$use_ttk} { + set progresscanv [ttk::progressbar .tf.bar.progress] + } else { + set h [expr {[font metrics uifont -linespace] + 2}] + set progresscanv .tf.bar.progress + canvas $progresscanv -relief sunken -height $h -borderwidth 2 + set progressitem [$progresscanv create rect -1 0 0 $h -fill "#00ff00"] + set fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow] + set rprogitem [$progresscanv create rect -1 0 0 $h -fill red] + } + pack $progresscanv -side right -expand 1 -fill x -padx {0 2} + set progresscoords {0 0} + set fprogcoord 0 + set rprogcoord 0 + bind $progresscanv adjustprogress + set lastprogupdate [clock clicks -milliseconds] + set progupdatepending 0 + + # build up the bottom bar of upper window + ${NS}::label .tf.lbar.flabel -text "[mc "Find"] " + + set bm_down_data { + #define down_width 16 + #define down_height 16 + static unsigned char down_bits[] = { + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, + 0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d, + 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}; + } + image create bitmap bm-down -data $bm_down_data -foreground $uifgcolor + ${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1} + .tf.lbar.fnext configure -image bm-down + + set bm_up_data { + #define up_width 16 + #define up_height 16 + static unsigned char up_bits[] = { + 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, + 0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01}; + } + image create bitmap bm-up -data $bm_up_data -foreground $uifgcolor + ${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1} + .tf.lbar.fprev configure -image bm-up + + ${NS}::label .tf.lbar.flab2 -text " [mc "commit"] " + + pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \ + -side left -fill y + set gdttype [mc "containing:"] + set gm [makedroplist .tf.lbar.gdttype gdttype \ + [mc "containing:"] \ + [mc "touching paths:"] \ + [mc "adding/removing string:"] \ + [mc "changing lines matching:"]] + trace add variable gdttype write gdttype_change + pack .tf.lbar.gdttype -side left -fill y + + set findstring {} + set fstring .tf.lbar.findstring + lappend entries $fstring + ${NS}::entry $fstring -width 30 -textvariable findstring + trace add variable findstring write find_change + set findtype [mc "Exact"] + set findtypemenu [makedroplist .tf.lbar.findtype \ + findtype [mc "Exact"] [mc "IgnCase"] [mc "Regexp"]] + trace add variable findtype write findcom_change + set findloc [mc "All fields"] + makedroplist .tf.lbar.findloc findloc [mc "All fields"] [mc "Headline"] \ + [mc "Comments"] [mc "Author"] [mc "Committer"] + trace add variable findloc write find_change + pack .tf.lbar.findloc -side right + pack .tf.lbar.findtype -side right + pack $fstring -side left -expand 1 -fill x + + # Finish putting the upper half of the viewer together + pack .tf.lbar -in .tf -side bottom -fill x + pack .tf.bar -in .tf -side bottom -fill x + pack .tf.histframe -fill both -side top -expand 1 + .ctop add .tf + if {!$use_ttk} { + .ctop paneconfigure .tf -height $geometry(topheight) + .ctop paneconfigure .tf -width $geometry(topwidth) + } + + # now build up the bottom + ${NS}::panedwindow .pwbottom -orient horizontal + + # lower left, a text box over search bar, scroll bar to the right + # if we know window height, then that will set the lower text height, otherwise + # we set lower text height which will drive window height + if {[info exists geometry(main)]} { + ${NS}::frame .bleft -width $geometry(botwidth) + } else { + ${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight) + } + ${NS}::frame .bleft.top + ${NS}::frame .bleft.mid + ${NS}::frame .bleft.bottom + + # gap between sub-widgets + set wgap [font measure uifont "i"] + + ${NS}::button .bleft.top.search -text [mc "Search"] -command dosearch + pack .bleft.top.search -side left -padx 5 + set sstring .bleft.top.sstring + set searchstring "" + ${NS}::entry $sstring -width 20 -textvariable searchstring + lappend entries $sstring + trace add variable searchstring write incrsearch + pack $sstring -side left -expand 1 -fill x + ${NS}::radiobutton .bleft.mid.diff -text [mc "Diff"] \ + -command changediffdisp -variable diffelide -value {0 0} + ${NS}::radiobutton .bleft.mid.old -text [mc "Old version"] \ + -command changediffdisp -variable diffelide -value {0 1} + ${NS}::radiobutton .bleft.mid.new -text [mc "New version"] \ + -command changediffdisp -variable diffelide -value {1 0} + + ${NS}::label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: " + pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap + spinbox .bleft.mid.diffcontext -width 5 \ + -from 0 -increment 1 -to 10000000 \ + -validate all -validatecommand "diffcontextvalidate %P" \ + -textvariable diffcontextstring + .bleft.mid.diffcontext set $diffcontext + trace add variable diffcontextstring write diffcontextchange + lappend entries .bleft.mid.diffcontext + pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap + ${NS}::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \ + -command changeignorespace -variable ignorespace + pack .bleft.mid.ignspace -side left -padx 5 + + set worddiff [mc "Line diff"] + if {[package vcompare $git_version "1.7.2"] >= 0} { + makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \ + [mc "Markup words"] [mc "Color words"] + trace add variable worddiff write changeworddiff + pack .bleft.mid.worddiff -side left -padx 5 + } + + set ctext .bleft.bottom.ctext + text $ctext -background $bgcolor -foreground $fgcolor \ + -state disabled -undo 0 -font textfont \ + -yscrollcommand scrolltext -wrap none \ + -xscrollcommand ".bleft.bottom.sbhorizontal set" + if {$have_tk85} { + $ctext conf -tabstyle wordprocessor + } + ${NS}::scrollbar .bleft.bottom.sb -command "$ctext yview" + ${NS}::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h + pack .bleft.top -side top -fill x + pack .bleft.mid -side top -fill x + grid $ctext .bleft.bottom.sb -sticky nsew + grid .bleft.bottom.sbhorizontal -sticky ew + grid columnconfigure .bleft.bottom 0 -weight 1 + grid rowconfigure .bleft.bottom 0 -weight 1 + grid rowconfigure .bleft.bottom 1 -weight 0 + pack .bleft.bottom -side top -fill both -expand 1 + lappend bglist $ctext + lappend fglist $ctext + + $ctext tag conf comment -wrap $wrapcomment + $ctext tag conf filesep -font textfontbold -fore $filesepfgcolor -back $filesepbgcolor + $ctext tag conf hunksep -fore [lindex $diffcolors 2] + $ctext tag conf d0 -fore [lindex $diffcolors 0] + $ctext tag conf dresult -fore [lindex $diffcolors 1] + $ctext tag conf m0 -fore [lindex $mergecolors 0] + $ctext tag conf m1 -fore [lindex $mergecolors 1] + $ctext tag conf m2 -fore [lindex $mergecolors 2] + $ctext tag conf m3 -fore [lindex $mergecolors 3] + $ctext tag conf m4 -fore [lindex $mergecolors 4] + $ctext tag conf m5 -fore [lindex $mergecolors 5] + $ctext tag conf m6 -fore [lindex $mergecolors 6] + $ctext tag conf m7 -fore [lindex $mergecolors 7] + $ctext tag conf m8 -fore [lindex $mergecolors 8] + $ctext tag conf m9 -fore [lindex $mergecolors 9] + $ctext tag conf m10 -fore [lindex $mergecolors 10] + $ctext tag conf m11 -fore [lindex $mergecolors 11] + $ctext tag conf m12 -fore [lindex $mergecolors 12] + $ctext tag conf m13 -fore [lindex $mergecolors 13] + $ctext tag conf m14 -fore [lindex $mergecolors 14] + $ctext tag conf m15 -fore [lindex $mergecolors 15] + $ctext tag conf mmax -fore darkgrey + set mergemax 16 + $ctext tag conf mresult -font textfontbold + $ctext tag conf msep -font textfontbold + $ctext tag conf found -back $foundbgcolor + $ctext tag conf currentsearchhit -back $currentsearchhitbgcolor + $ctext tag conf wwrap -wrap word -lmargin2 1c + $ctext tag conf bold -font textfontbold + + .pwbottom add .bleft + if {!$use_ttk} { + .pwbottom paneconfigure .bleft -width $geometry(botwidth) + } + + # lower right + ${NS}::frame .bright + ${NS}::frame .bright.mode + ${NS}::radiobutton .bright.mode.patch -text [mc "Patch"] \ + -command reselectline -variable cmitmode -value "patch" + ${NS}::radiobutton .bright.mode.tree -text [mc "Tree"] \ + -command reselectline -variable cmitmode -value "tree" + grid .bright.mode.patch .bright.mode.tree -sticky ew + pack .bright.mode -side top -fill x + set cflist .bright.cfiles + set indent [font measure mainfont "nn"] + text $cflist \ + -selectbackground $selectbgcolor \ + -background $bgcolor -foreground $fgcolor \ + -font mainfont \ + -tabs [list $indent [expr {2 * $indent}]] \ + -yscrollcommand ".bright.sb set" \ + -cursor [. cget -cursor] \ + -spacing1 1 -spacing3 1 + lappend bglist $cflist + lappend fglist $cflist + ${NS}::scrollbar .bright.sb -command "$cflist yview" + pack .bright.sb -side right -fill y + pack $cflist -side left -fill both -expand 1 + $cflist tag configure highlight \ + -background [$cflist cget -selectbackground] + $cflist tag configure bold -font mainfontbold + + .pwbottom add .bright + .ctop add .pwbottom + + # restore window width & height if known + if {[info exists geometry(main)]} { + if {[scan $geometry(main) "%dx%d" w h] >= 2} { + if {$w > [winfo screenwidth .]} { + set w [winfo screenwidth .] + } + if {$h > [winfo screenheight .]} { + set h [winfo screenheight .] + } + wm geometry . "${w}x$h" + } + } + + if {[info exists geometry(state)] && $geometry(state) eq "zoomed"} { + wm state . $geometry(state) + } + + if {[tk windowingsystem] eq {aqua}} { + set M1B M1 + set ::BM "3" + } else { + set M1B Control + set ::BM "2" + } + + if {$use_ttk} { + bind .ctop { + bind %W {} + %W sashpos 0 $::geometry(topheight) + } + bind .pwbottom { + bind %W {} + %W sashpos 0 $::geometry(botwidth) + } + } + + bind .pwbottom {resizecdetpanes %W %w} + pack .ctop -fill both -expand 1 + bindall <1> {selcanvline %W %x %y} + #bindall {selcanvline %W %x %y} + if {[tk windowingsystem] == "win32"} { + bind . { windows_mousewheel_redirector %W %X %Y %D } + bind $ctext { windows_mousewheel_redirector %W %X %Y %D ; break } + } else { + bindall "allcanvs yview scroll -5 units" + bindall "allcanvs yview scroll 5 units" + bind $ctext