hg-fast-export: work still if git-commands are not in PATH

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>
This commit is contained in:
Jonathan Nieder
2008-07-18 01:32:37 -05:00
committed by Rocco Rutte
parent 205c76749a
commit 8be4e6b3d0
3 changed files with 5 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ Options:
-r Mercurial repository to import
"
. git-sh-setup
. "$(git --exec-path)/git-sh-setup"
cd_to_toplevel
while case "$#" in 0) break ;; esac
@@ -69,7 +69,7 @@ GIT_DIR="$GIT_DIR" $PYTHON "$ROOT/hg-fast-export.py" \
--heads "$GIT_DIR/$PFX-$SFX_HEADS" \
--status "$GIT_DIR/$PFX-$SFX_STATE" \
"$@" \
| git-fast-import $QUIET --export-marks="$GIT_DIR/$PFX-$SFX_MARKS.tmp" \
| git fast-import $QUIET --export-marks="$GIT_DIR/$PFX-$SFX_MARKS.tmp" \
|| die 'Git fast-import failed'
# move recent marks cache out of the way...
@@ -89,7 +89,7 @@ rm -rf "$GIT_DIR/$PFX-$SFX_MARKS.old" "$GIT_DIR/$PFX-$SFX_MARKS.tmp"
# save SHA1s of current heads for incremental imports
# and connectivity (plus sanity checking)
for head in `git branch | sed 's#^..##'` ; do
id="`git-rev-parse $head`"
id="`git rev-parse $head`"
echo ":$head $id"
done > "$GIT_DIR/$PFX-$SFX_HEADS"

View File

@@ -23,7 +23,7 @@ Options:
-r Mercurial repository to use
"
. git-sh-setup
. "$(git --exec-path)/git-sh-setup"
cd_to_toplevel
while case "$#" in 0) break ;; esac

View File

@@ -86,7 +86,7 @@ def save_cache(filename,cache):
def get_git_sha1(name,type='heads'):
try:
# use git-rev-parse to support packed refs
cmd="GIT_DIR='%s' git-rev-parse --verify refs/%s/%s 2>/dev/null" % (os.getenv('GIT_DIR','/dev/null'),type,name)
cmd="GIT_DIR='%s' git rev-parse --verify refs/%s/%s 2>/dev/null" % (os.getenv('GIT_DIR','/dev/null'),type,name)
p=os.popen(cmd)
l=p.readline()
p.close()