From 8be4e6b3d02c928456f8ca58c5ea01a2fbf69a5d Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 18 Jul 2008 01:32:37 -0500 Subject: [PATCH] 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 " 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 " 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 --- hg-fast-export.sh | 6 +++--- hg-reset.sh | 2 +- hg2git.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hg-fast-export.sh b/hg-fast-export.sh index 3fc8f71..d73bb2b 100755 --- a/hg-fast-export.sh +++ b/hg-fast-export.sh @@ -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" diff --git a/hg-reset.sh b/hg-reset.sh index 2b7b775..8d1730c 100755 --- a/hg-reset.sh +++ b/hg-reset.sh @@ -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 diff --git a/hg2git.py b/hg2git.py index 717ab5c..057ea9e 100755 --- a/hg2git.py +++ b/hg2git.py @@ -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() -- 2.11.4.GIT