mirror of
https://github.com/frej/fast-export.git
synced 2026-01-14 18:22:05 +01:00
In git 1.6.0, most git tools with a dash in the name will no longer be installed in $bindir. This patch makes hg-fast-export use the "git <command>" form so it will work even if "git" is the only piece of git machinery in the user's PATH. On the other hand, the "git <command>" form does not help for sourcing a shell script (with "."). So use the full path to source "git-sh-setup". Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
66 lines
1.4 KiB
Bash
Executable File
66 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Copyright (c) 2007 Rocco Rutte <pdmef@gmx.net>
|
|
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
|
|
|
|
ROOT="`dirname $0`"
|
|
REPO=""
|
|
PFX="hg2git"
|
|
SFX_MARKS="marks"
|
|
SFX_HEADS="heads"
|
|
SFX_STATE="state"
|
|
QUIET=""
|
|
PYTHON=${PYTHON:-python}
|
|
|
|
USAGE="[-r <repo>] -R <rev>"
|
|
LONG_USAGE="Print SHA1s of latest changes per branch up to <rev> useful
|
|
to reset import and restart at <rev>.
|
|
If <repo> is omitted, use last hg repository as obtained from state file,
|
|
GIT_DIR/$PFX-$SFX_STATE by default.
|
|
|
|
Options:
|
|
-R Hg revision to reset to
|
|
-r Mercurial repository to use
|
|
"
|
|
|
|
. "$(git --exec-path)/git-sh-setup"
|
|
cd_to_toplevel
|
|
|
|
while case "$#" in 0) break ;; esac
|
|
do
|
|
case "$1" in
|
|
-r|--r|--re|--rep|--repo)
|
|
shift
|
|
REPO="$1"
|
|
;;
|
|
-*)
|
|
# pass any other options down to hg2git.py
|
|
break
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
# for convenience: get default repo from state file
|
|
if [ x"$REPO" = x -a -f "$GIT_DIR/$PFX-$SFX_STATE" ] ; then
|
|
REPO="`egrep '^:repo ' "$GIT_DIR/$PFX-$SFX_STATE" | cut -d ' ' -f 2`"
|
|
echo "Using last hg repository \"$REPO\""
|
|
fi
|
|
|
|
# make sure we have a marks cache
|
|
if [ ! -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then
|
|
touch "$GIT_DIR/$PFX-$SFX_MARKS"
|
|
fi
|
|
|
|
GIT_DIR="$GIT_DIR" $PYTHON "$ROOT/hg-reset.py" \
|
|
--repo "$REPO" \
|
|
--marks "$GIT_DIR/$PFX-$SFX_MARKS" \
|
|
--heads "$GIT_DIR/$PFX-$SFX_HEADS" \
|
|
--status "$GIT_DIR/$PFX-$SFX_STATE" \
|
|
"$@"
|
|
|
|
exit $?
|