From 701ed2851f85f47681855fe0d288671d396a057d Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 10 Jul 2016 09:25:12 -0700 Subject: [PATCH] fast-export.git: pick up latest and adopt changes This update handles "unnamed" heads that get gc'd making their mark(s) invalid. The change is only effective when running Git 1.8.5 or later. Signed-off-by: Kyle J. McKay --- fast-export.git | 2 +- shlib.sh | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/fast-export.git b/fast-export.git index 52ef1b3..882b08e 160000 --- a/fast-export.git +++ b/fast-export.git @@ -1 +1 @@ -Subproject commit 52ef1b34057e759d4a0228f939181e238289e4a3 +Subproject commit 882b08e7beaa2c62f6f200fe22854b405774dc33 diff --git a/shlib.sh b/shlib.sh index f6cb1c7..ddc246e 100644 --- a/shlib.sh +++ b/shlib.sh @@ -67,8 +67,10 @@ get_girocco_config_var_list() ( # var_git_ver The version number part from `git version` # var_git_exec_path The result of $cfg_git_bin --exec-dir # var_perl_bin Full path to the perl interpreter to use + # var_have_git_171 Set to 1 if git version >= 1.7.1 otherwise '' # var_have_git_172 Set to 1 if git version >= 1.7.2 otherwise '' # var_have_git_173 Set to 1 if git version >= 1.7.3 otherwise '' + # var_have_git_185 Set to 1 if git version >= 1.8.5 otherwise '' # var_window_memory Value to use for repack --window-memory= # var_big_file_threshold Value to use for core.bigFileThreshold # var_redelta_threshold Recompute deltas if no more than this many objs @@ -86,8 +88,10 @@ get_girocco_config_var_list() ( printf 'var_git_ver=%s\n' "$_gver" printf 'var_git_exec_path="%s"\n' "$("$cfg_git_bin" --exec-path 2>/dev/null)" printf 'var_perl_bin="%s"\n' "${cfg_perl_bin:-$(unset -f perl; command -v perl)}" + printf 'var_have_git_171=%s\n' "$([ $(vcmp "$_gver" 1.7.1) -ge 0 ] && echo 1)" printf 'var_have_git_172=%s\n' "$([ $(vcmp "$_gver" 1.7.2) -ge 0 ] && echo 1)" printf 'var_have_git_173=%s\n' "$([ $(vcmp "$_gver" 1.7.3) -ge 0 ] && echo 1)" + printf 'var_have_git_185=%s\n' "$([ $(vcmp "$_gver" 1.8.5) -ge 0 ] && echo 1)" __girocco_conf="$GIROCCO_CONF" [ -n "$__girocco_conf" ] || __girocco_conf="Girocco::Config" [ -z "$basedir" ] || __girocco_extrainc="-I$basedir" @@ -535,8 +539,38 @@ set_utf8_locale() { git_hg_fetch() ( set_utf8_locale _python="${PYTHON:-python}" - [ -e hg2git-marks ] || >hg2git-marks - rm -f hg2git-marks.new + rm -f hg2git-marks.old hg2git-marks.new + if [ -f hg2git-marks -a -s hg2git-marks ]; then + LC_ALL=C sed 's/^:\([^ ][^ ]*\) \([^ ][^ ]*\)$/\2 \1/' hg2git-marks.old + if [ -n "$var_have_git_171" ] && \ + git rev-parse --quiet --verify refs/notes/hg >/dev/null; then + if [ -z "$var_have_git_185" ] || \ + ! LC_ALL=C cmp -s hg2git-marks hg2git-marks.old; then + _nm='hg-fast-export' + GIT_AUTHOR_NAME="$_nm" + GIT_COMMITTER_NAME="$_nm" + GIT_AUTHOR_EMAIL="$_nm" + GIT_COMMITTER_EMAIL="$_nm" + export GIT_AUTHOR_NAME + export GIT_COMMITTER_NAME + export GIT_AUTHOR_EMAIL + export GIT_COMMITTER_EMAIL + git notes --ref=refs/notes/hg prune + unset GIT_AUTHOR_NAME + unset GIT_COMMITTER_NAME + unset GIT_AUTHOR_EMAIL + unset GIT_COMMITTER_EMAIL + fi + fi + else + >hg2git-marks.old + fi _err1= _err2= exec 3>&1 @@ -548,7 +582,7 @@ git_hg_fetch() ( _af="$(git config hg.authorsfile || :)" _cmd='GIT_DIR="$(pwd)" "$_python" "$cfg_basedir/bin/hg-fast-export.py" \ --repo "$(pwd)/repo.hg" \ - --marks "$(pwd)/hg2git-marks" \ + --marks "$(pwd)/hg2git-marks.old" \ --mapping "$(pwd)/hg2git-mapping" \ --heads "$(pwd)/hg2git-heads" \ --status "$(pwd)/hg2git-state" \ @@ -560,7 +594,7 @@ git_hg_fetch() ( { _e2=0 git fast-import \ - --import-marks="$(pwd)/hg2git-marks" \ + --import-marks="$(pwd)/hg2git-marks.old" \ --export-marks="$(pwd)/hg2git-marks.new" \ --export-pack-edges="$(pwd)/gfi-packs" \ --force 3>&- || _e2=$? @@ -571,6 +605,7 @@ git_hg_fetch() ( exec 3>&- [ "$_err1" = 0 -a "$_err2" = 0 ] || return 1 mv -f hg2git-marks.new hg2git-marks + rm -f hg2git-marks.old git for-each-ref --format='%(refname) %(objectname)' refs/heads | \ LC_ALL=C sed -e 's,^refs/heads/,:,' >hg2git-heads ) -- 2.11.4.GIT