X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fgit-hg-sub-import;fp=scripts%2Fgit-hg-sub-import;h=cf2b44fbde45e921657271a7eab91aeec18b94fc;hb=383e625e4defb96cd77756cc7426932a5a825643;hp=41617d1058c81431031f3ff655d9edf5c522bbad;hpb=1ec225aa6edcc264613071a943f99ba7f6aa0d06;p=hvutilities.git diff --git a/scripts/git-hg-sub-import b/scripts/git-hg-sub-import index 41617d1..cf2b44f 100755 --- a/scripts/git-hg-sub-import +++ b/scripts/git-hg-sub-import @@ -5,7 +5,7 @@ set -o errexit # http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/ # Uncomment to have verbose debug output -#debug=1 +debug=1 print_usage() { @@ -16,7 +16,9 @@ print_usage() # git-remote-hg doesn't work with Mercurial subpaths extension, # so use it manually hg_subpaths_config() { - subpaths=$(hg showconfig | grep "subpaths") + subpaths=$(hg showconfig | grep "subpaths" | grep "HG_REPO") + + echo "subpaths = ${subpaths}" if [ -n ${subpaths} ]; then sp_src=${subpaths//subpaths./} @@ -118,11 +120,22 @@ while read sub; do # "BRANCH___-___NAME" branch="${branch// /___}" + if [ -n "${debug}" ]; then + echo "branch: ${branch}" + fi + git clone "hg::${src}" "${dest}" + cd "${dest}" + + if [ -x ${HOME}/scripts/git-set-local-author.sh ]; then + # Make sure commits have correct author for LSI + ${HOME}/scripts/git-set-local-author.sh + fi + if [ "x${branch}" != "xdefault" ]; then - cd "${dest}" - git checkout "branches/${branch}" + # Make tracking branch + git checkout -f "branches/${branch}" # Adjusting git tree to specific commit specified in # .hgsubstate: @@ -131,10 +144,10 @@ while read sub; do # to a hash in git using the ${num} variable: git_rev=$(git log --oneline | sed -n "${num}p" | awk '{print $1}') git reset --hard ${git_rev} - - cd .. fi + cd .. + if ! grep -q "${dest}" .gitignore ; then # Ignore subrepo in top-level git repository echo "${dest}" >> .gitignore